Category "django-models"

Django says that model has no ForeignKey to another model but it really does

Will you help me to figure out why Django raises this error? SolutionsForLanguagesApp.LanguageLevel: (fields.E336) The model is used as an in termediate

I would like to run for loop to each of li tag and want to add content dynamically from django backend admin

I have created a navbar and content can be added from the backend but only the home nav bar shows the icon and the other navbar name is with the same icon. I wa

Configuring PostgreSQL schema for default Django DB working with PgBouncer connection pool

I need to set the default DB schema for a Django project, so that all tables of all apps (including 3rd party apps) store their tables in the configured Postgre

How to print multiple object from table def __str__(self):return self.title

I created a article models below models.py class Article(models.Model): user = models.ForeignKey(User, on_delete=models.CASCADE, blank=True) is_deleted

Detect when user register/Login on Context Proccessor Django

I have to do some checks all the time with the context proccessor.The value must be 'True' as soon as the user logs in.But when navigating the site after loggin

How can we add more than 3 authors field for a single magzine? in Django models

I created a magzine model in django. But their are more than three authors of a magzine. I have written below code for three authors. If I write the code of two

Images are not rendering on Django template from a multi-model view

Problem: I cannot get images to appear on my template plant_detail.html. I think I'm calling on variables incorrectly, but not sure what to change. Context: I c

Django dumpdata serializing an int as string

I've been trying to make a custom class/type, defined in a separate db.py file, to be properly serialized as an int when doing a manage.py dumpdata command, but

The response content must be rendered before it can be iterated over. Django Rest Framework

I have a Cart model and Cartserializers. I am trying to do that is if cart defects exist in the cart and then update the cart by increasing the quantity of cart

How to get foreign key detailed values based on id in html template in django

In Models.py class Interview(models.Model): Current_Date = models.DateField(auto_now_add=True ) User = models.ForeignKey(User,

How to have multiple Auth models in django

I have an application where I've two models both models have same fields client buyer I'm using separate models because client can also signs up as a buyer usin

How to mention users using @ in django

I have been working on a project on django and it is very similar to instagram and twitter, one of the functions it needs to have is to mention users using "@"

ValueError: Field 'id' expected a number but got 'Abidjan'

Hello I'm new to django and I don't understand the following error: ValueError: Field 'id' expected a number but got 'Abidjan'. Here is the model code for more

Using CreateView with 2 Models at the same time

should I be building a function to achieve what I am trying to do?

When django load data to memory?

Lets have simple model: class NewModel(models.Model): json_data = models.JSONField(default=dict) Then lets get it: model = NewModel.objects.get(pk=1)

Django can't login the superuser in admin page

So , I am trying to make an register and login system . I want to customize it using the custom user model , where I can save my data and extend the model. I am

Django model default value in response

I want to have a default value in my django model response value Sample model query myModel.objects.filter().values("username", "user_gender") I want to have a

How to create a persigned url for a private s3 bucket using django rest framework

models.py def upload_org_logo(instance, filename): ts = calendar.timegm(time.gmtime()) filepath = f"Timesheet/org_logo/{ts}" if instance: b

Why does Django use `Meta` inner class in models?

If I want to describe some information such as ordering, if the model is proxy or abstract, which fields must be unique together, then I need to put this inform

Django throws AttributeError: 'str' object has no attribute '_meta' when I register my Model

Im novice and I didnt find solution for this problem. Im writing code for a blog. I have a model Post where I want to create field author which is ForeighKey to