Category "django-orm"

Django ORM: get the monthly average of price for each category

Imagine this simple model: class Expense(models.Model): price = models.DecimalField(decimal_places=2, max_digits=6) description = models.CharField(max_len

Bulk save edited items with Django?

I am editing a large number of model instances in django and I would like to save all these changes at once. The instances are already created so I am not looki

Is it possible to modify Django Q() objects after construction?

Is it possible to modify Django Q() objects after construction? I create a Q() object like so: q = Q(foo=1) is it possible to later change q to be the same

Foreignkey relationship returning an AttributeError when queried in Django

Hy please am new to Django,I have a childmodel(relationship) referencing a parent model(Profile) through a foreign key. I want to get the relationship status of

Database relationship between a match and its players

I'm trying to design a database that would save matches and players in a 3v3 game. So far my models look like this : class Player(models.Model): user = mode

Django ORM returns non-iterable object

The model is class WeeklyStrMst(BaseModel): StoreId = models.AutoField(primary_key=True) TDLinx_No = models.IntegerField(blank=True, null=True, default=

LEAD and LAG window fucntions in Django orm, how to apply on single object?

Question is regarding Window functions usage in Django. I have a following model: class EntriesChangeLog(models.Model): content_type = models.ForeignKey(

Django CheckConstraint: Elements of reverse ForeignKey lookup must not be empty

I've got these models: class Container(models.Model): ... class Meta: constraints = [ models.CheckConstraint( chec

Django queryset TruncMonth output format issue

I'm using Django ORM queryset for chart, and having difficulty with changing the format of output 'source': ActivityLog.objects.filter(requestType='add',doDat

Why can't I add a ManyToMany relation to an object in Django?

I've got an api made in Django which has two models linked by a ManyToMany relation. class Type(models.Model): name = models.CharField(max_length=64) ap

How to make a query on related_name field?

I have to models connected by a ForeignKey class User(AbstractUser): ... and class PrivateMessage(models.Model): user_from = models.ForeignKey(