开发者

what is the 'extra' mean in this django code

开发者 https://www.devze.com 2022-12-25 10:17 出处:网络
TOPIC_COUNT_SQL = \"\"\" SELECT COUNT(*) FROM topics_topic WHERE topics_topic.object_id = maps_ma开发者_如何学编程p.id AND
TOPIC_COUNT_SQL = """
SELECT COUNT(*)
FROM topics_topic
WHERE
    topics_topic.object_id = maps_ma开发者_如何学编程p.id AND
    topics_topic.content_type_id = %s
"""
MEMBER_COUNT_SQL = """
SELECT COUNT(*)
FROM maps_map_members
WHERE maps_map_members.map_id = maps_map.id
"""

maps = maps.extra(select=SortedDict([
    ('member_count', MEMBER_COUNT_SQL),
    ('topic_count', TOPIC_COUNT_SQL),
]), select_params=(content_type.id,))

i don't know this mean,

thanks


It's a method of QuerySet.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号