django-orm
Django: Use a model instance in another model's method
Let\'s say I have a model coconut: class Coconut(models.Model): carrier = models.ForeignKey(\'birds.Swallow\')[详细]
2023-04-12 14:38 分类:问答Testing postgres database accessibility from django
I am using the django ORM with a postgres database. A small group of users interact with it using import and export scripts. The database is only available on our intranet. If someone tries to use the[详细]
2023-04-07 17:14 分类:问答How to use custom manager with related objects?
I have a custom manager. I want to use it for related objects. I founduse_for_related_fields in docs. But it does not work the way I used it:[详细]
2023-04-06 00:37 分类:问答django many-to-many query outputs <foo: <built-in function id>>
I am using Django 1.3 and sqlite3. My models are: class Trial(models.Model): person = models.ManyToManyField(Person, blank=True)[详细]
2023-04-05 16:17 分类:问答How to edit m2m in Django via ModelForm
I have 2 models: class Case(models.Model): Priority = ( (\'Blocker\', \'Blocker\'), (\'High\', \'High\'),[详细]
2023-04-04 20:53 分类:问答Django ORM JOIN's
I have a table \'Comments\' 开发者_运维百科and inside field the \'user\', I would get in addition to the profile Profile in the same query. Currently I have something like that[详细]
2023-03-28 01:43 分类:问答Filtering Django Query by the Record with the Maximum Column Value
Is there an easy way to filter a Django query based on which record has a max/min value in a column? I\'m essentially asking these questions, but in the specific context of Django\'s ORM.[详细]
2023-03-26 23:27 分类:问答How to create an object for a Django model with a many to many field?
My model: class Sample(models.Model): users = models.ManyToManyField(User) I want to save both user1 and user2 in that model:[详细]
2023-03-26 18:47 分类:问答How to get database records only with filled field?
I have model w开发者_运维知识库ith an optional ForeignKey field. I need filter all records with filled this field. How do I do this?Model.objects.exclude(foreignkey__isnull=True)[详细]
2023-03-26 04:06 分类:问答Django query optimization: retrieve values in groups possible?
I have: active = Node.objects.filter(status = \'a\') potential = Node.objects.filter(status = \'p\') hotspot = Node.objects.filter(status = \'h\')[详细]
2023-03-25 14:54 分类:问答