Category "django-models"

Django ValueError for deleted fields when running migrations

My models.py file is as follows: from django.db import models from django.utils import timezone from random import randint # Create your models here. class Fil

Nested Category In django

how do I use nested categories in django as Im nwe to django and doing this and find some solutions but didnt work anything class MainCategory(models.Model)

How to get django queryset results with formatted datetime field

I've Django model which has foreign keys associated with other models. Each model is having same field names(attributes) created_at and updated_at In every dja

Why should I set max_length when using Choices in a Django model?

In the official Django 2 tutorial I found this: from django.db import models class Student(models.Model): FRESHMAN = 'FR' SOPHOMORE = 'SO' JUNIOR

Understanding ManyToMany fields in Django with a through model

I'm having trouble understanding the use of ManyToMany models fields with a through model. I can easily achieve the same without the ManyToMany field. Consideri

How to upload multiple files in Django using Dropzone js?

Info: I want to upload multiple files using Dropzone js in Django project. I have two models. One for the Post and the other would be for the File. My files mod

Django model fields not appearing in admin

I have a relatively simple model in my Django project (I should note that the wording is weird in that the app itself is called 'games' and within it the model

'ProgrammingError: function avg(character varying) does not exist' - Django project

I have recently deployed a Django project to Heroku. While testing out the functionality in the browser, I've come across a new error when attempting to render

How to add username to the filefield?

I am making use of file fields in my model and I want it to be saved as username_field.jpeg (or whatever format it is in), for example for rent_agreement I want

Django 3.2: AttributeError: 'NoneType' object has no attribute 'attname'

I am working with Django 3.2, and have come across a problem that seems to have answers here and here also, and I have tried the solutions offered in the accept

This QueryDict instance is immutable

I have a Branch model with a foreign key to account (the owner of the branch): class Branch(SafeDeleteModel): _safedelete_policy = SOFT_DELETE_CASCADE

django.db.utils.IntegrityError: UNIQUE constraint failed: rango_category__new.slug

I'm learning Django from Tango with Django but I keep getting this error when I type: python manage.py makemigrations rango python manage.py migrate This is

Python(Django) :I want the payment form(code) triggered whenever a user clicks the submit button and only saved into DB if payment is succesful

I am currently using DJANGO How can I make the payment form(code) triggered when a user clickn submit and also make it saved into DB after successful payment. P

django permissions: new permission is inserted after all other migrations

I added a new permission to my model, and than used manage.py makemigrations. it created a migration that alters the model options (specificly the permisions..)

"Local variable referenced before assignment" Django error

I have no idea what may cause this issue. The only change I've made was add the loginquiredmixins to my class-based views. Once I started stylising the login pa

Add field to AbstractUser admin page

I have an AbstractUser class in models.py file in order to extend the django user default class, class Profile(AbstractUser): address = models.CharField('A

Create a save data using Django post_save() Signal

Here I want to create a heatmap when a Lead is created, it'll create an example api for the particular API. This is my lead model and another model for the api,

Django model validator not working on create

I have model with a field validator from django.db import models from django.core.validators import MinValueValidator, MaxValueValidator class MyModel(model.

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=