Category "django-models"

Django Stripping Blanks In Between Words When Generating Blanks

I am working on a Hangman game using Django and I'm having some trouble generating the blanks from the words if the answer is two words, such as a first and las

Django membership site

Please what's the best way to implement a membership system in a Django site?

I cannot register new admin panel block Django

I'm trying to register my model in admin panel by this code from django.contrib import admin from advertisements.models import Advertisement @admin.re

Django constraints when removing columns in manual migrations

Django silently removes constraints when removing columns, then arbitrarily chooses to include them in migrations. I've encountered an odd bug(?) in Django in o

Update django model objects from editable dash data-table

I want to update my models by an editable plotly dash-table (populated by a dataframe, himself populated by sqlconnection with models) in Django but I don't kno

Model object attribute not change without assign to variable

I try here to change title but this not work. but when assign object to variable, change works. I need any one explain why it work when I assign object to va

Images from database not displaying in Heroku Django after hosting

I have few images in my SQLite database which I will be changing from admin panel over a period of time. I have hosted the django app in heorku(free service). A

Django models: is it possible to force icontains on filter/get for specific field using a manager?

Let's say I have a model with a string field similar to this class Product(models.Model): upc = models.CharField(max_length=12, blank=False, null=False) Is

How to show on template just a Model with Foreign Key Django?

I'm getting on the template all the Router Model created. I mean if user A create a Router Model when I log in with user B I can see what user A create. how can

Ho to create serializer for model having foreign keys to access that foreign keys tables data also?

I want to rewrite the following API in a more efficient way using the serializer. In the following API, the user and group are foreign keys. I want to return al

django.core.exceptions.FieldError: Unknown field(s) (Actions) specified for Copyrightrece

I want to create 2 models in models.py and 2 forms in forms.py for webpage. but it shows unknown field error #models.py class Copyrightapp(models.Model): S

Django form with dropdown list using Database returns empty fields

I'm discovering Django and I'm trying to develop a simple application. I have three tables in my database : One big table to report all the information to users

in Django : Why nothing happens when I try to Create new note with the html form in the notes.html page

I've just started my first app with Django by following a video on YouTube. The app is a students dashboard with 8 tools and features to help the student to mak

How to separate tables based on the model using FSM and FSM-Log?

I'm currently logging status changes to several models in my Django REST API using the django-fsm and django-fsm-log packages. However, all of the logs are stor

Django: How to run a celery task only on start up?

I have a django app that uses celery to run tasks. Sometimes, I have a "hard shutdown" and a bunch of models aren't cleaned up. I created a task called clean_up

django create a field that hold array of tupels or array of array

I want to add a field in my models that hold value like this field = [(1,2,3),(6,5,4),(5,6,7)] or field = [[1,2,3],[6,5,4],[5,6,7]] I am using po

Optimize Django generated SQL query

I have the these models: class Person(models.Model): firstname = models.CharField(max_length=20) lastname = models.CharField(max_length=20, blank=True,

how to display models.full_clean() ValidationError in django admin?

https://docs.djangoproject.com/en/4.0/ref/models/instances/#validating-objects from django.core.exceptions import ValidationError try: article.full_clean()

Need to override save method for image field and save it as base64 string using django

models.py class Organisation(models.Model): org_id = models.CharField(max_length=50,default=uuid.uuid4, editable=False, unique=True, primary_key=True)

Selectively hit the update signal for a model

I have a model called as nodes: class node(models.Model): name = models.CharField(max_length=200) status = models.CharField( max_length=32,