python - Django how are filter parameter names named? -
i'm following django tutorial here https://docs.djangoproject.com/en/1.8/intro/tutorial01/. i've come across filter , get functions. i'm confused why valid:
question.objects.get(pub_date__year=current_year)
i understand defined pub_date in question model, how did pub_date__year created?
basically, filter (and other django , python functions) can take number of arbitrarily named keyword arguments, or kwargs, , django parses these kwargs pass.
django defines functionality in models.queryset object. might interested in queryset source code.
see django documentation here, , referenced python documentation on functionality here.
Comments
Post a Comment