A very easy way to dynamically build queries in Django is to use Python kwargs (keyword arguments). Let’s say we have a model that looks something like this: class Entry( models.Model ): user = models.ForeignKey( User, related_name = 'entries' ) category = models.ForeignKey( Category, related_name = 'entries' ) title = models.CharField( max_length = 64 ) [...]
↧