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:
I developing a custom manager class with chainable method. Got a problem. I need to randomize filtered query. To get a random record I need a count of filtered and distinct records. But I don\'t know
I have a model that looks like this and stores data as key-value pairs. class Setting(models.Model): company = models.ForeignKey(
So, I\'ve read most of the docs and I\'ve been looking around on SO a bit, but I can\'t quite find the answer to my question. I\'ll start with the code.
I\'m using a soft delete in my django admin, done like this. The issue is that when I delete a foreign key item, that it doesn\'t seem to trigger the deletes for all the items it\'s linked to. Or may
I have two models like so: class Visit(models.Model): id = models.AutoField(primary_key=True) name = models.CharField(max_length=65535, null=False)
Consider the following case: class MyModelManager(models.Manager): def my_filter(self): return [some code here].filter(field_A__gt=3)
This is a piece of my code from django.db import models from django.db.models.query import QuerySet from mptt.models import MPTTModel
I have a model like this: class UserSubmission(models.Model): mantra = models.CharField(max_length=64) ip = models.CharField(max_length=15) # xxx.xxx.xxx.xxx
How to organize my domain layer using django? I know I can write custom managers to hold my queries b开发者_StackOverflow中文版ut what if I want something more flexible like the specification pattern