Every Django model class and every instance of every Django model class has an attribute on it named _meta
OpenGoo: An Open Source Web Office - 0 views
Office 2.0 Database - 0 views
flickrCC - 0 views
Home - Pencil Project - 0 views
Kevin Kelly - 0 views
Cool Tools - 0 views
Working with models, part 2 - 0 views
thinkfree view - 0 views
-
ThinkFree Viewers allow web bloggers, designers, and application developers access to use our Publisher, API's, and WordPress Plug-in to link live documents from their own sites.
-
Users can view ThinkFree or Microsoft Office word processing, spreadsheet, and presentation files without having any other office applications installed.
Django Tagging - 0 views
-
>>> tags = Tag.objects.usage_for_model(Widget, counts=True)
-
[('cheese', 1), ('house', 2), ('thing', 1), ('toast', 1)]
-
def usage_for_model(self, model, counts=False, min_count=None, filters=None): """ Obtain a list of tags associated with instances of the given Model class. If ``counts`` is True, a ``count`` attribute will be added to each tag, indicating how many times it has been used against the Model class in question. If ``min_count`` is given, only tags which have a ``count`` greater than or equal to ``min_count`` will be returned. Passing a value for ``min_count`` implies ``counts=True``. To limit the tags (and counts, if specified) returned to those used by a subset of the Model's instances, pass a dictionary of field lookups to be applied to the given Model as the ``filters`` argument. """ if filters is None: filters = {} if min_count is not None: counts = True model_table = qn(model._meta.db_table) model_pk = '%s.%s' % (model_table, qn(model._meta.pk.column)) query = """ SELECT DISTINCT %(tag)s.id, %(tag)s.name%(count_sql)s FROM %(tag)s INNER JOIN %(tagged_item)s ON %(tag)s.id = %(tagged_item)s.tag_id INNER JOIN %(model)s ON %(tagged_item)s.object_id = %(model_pk)s %%s WHERE %(tagged_item)s.content_type_id = %(content_type_id)s %%s GROUP BY %(tag)s.id, %(tag)s.name %%s ORDER BY %(tag)s.name ASC""" % { 'tag': qn(self.model._meta.db_table), 'count_sql': counts and (', COUNT(%s)' % model_pk) or '', 'tagged_item': qn(self._get_related_model_by_accessor('items')._meta.db_table), 'model': model_table, 'model_pk': model_pk, 'content_type_id': ContentType.objects.get_for_model(model).pk, } extra_joins = '' extra_criteria = '' min_count_sql
-
usage_for_model
Django | 23. Giving models a custom manager | Django Documentation - 0 views
-
class PersonManager(models.Manager): def get_fun_people(self): return self.filter(fun=True)
-
objects = PersonManager()
« First
‹ Previous
241 - 253 of 253
Showing 20▼ items per page