Category "django"

Can I build my form without using Django form?

I'm using Django and I just did a big form Using HTML5 and bootstrap. Can I still send the form via the post method to django if I'm not using it to generate th

Unable To Install Simple JWT in my Django Project

Here's my setup right now: Pip Freeze: asgiref==3.3.1 Django==3.0 djangorestframework==3.10.0 djangorestframework-simplejwt==4.6.0 PyJWT==2.0.1 pytz==2021.1 sql

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,

How to wrap text in Django admin(set column width)

I have a model Item class Item(models.Model): id = models.IntegerField(primary_key=True) title = models.CharField(max_length=140, blank=True) descr

Django REST Framework ModelSerializer get_or_create functionality

When I try to deserialize some data into an object, if I include a field that is unique and give it a value that is already assigned to an object in the databas

Redirect is not allowed for a preflight request

I have this problem where i get the response when trying to use a rest api: "Access to fetch at 'https://kollektivet.app:8082/api/login/' from origin 'https://k

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.

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

403 CSRF error on page refresh after login() Django?

So the code is very simple: views.py @csrf_protect def index(request): global userPersonalInformation if request.method == "POST": username =

django: return string from view

I know this is a simple question, sorry. I just want to return a simple string, no templates. I have my view: def myview(request): return "return this st

How To Open and Read a File of Type FileField in Django?

I am trying to open a file that would be uploaded through the django FileField attribute. I also want to read the contents of the file and output it. But when I

Python Django 1.6 execute function for every request before getting to view

I'm writing some API functionality for my project using Python 3.4 and Django 1.6. All functionality works fine, but I want execute one function for all that k

Pyinstaller and Django Rest

I am trying to use Pyinstaller with django rest, it generates the .exe well but there is an error at the moment of executing the .exe, the error is this Module

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=

Django Rest Framework - prevent access to API?

I'm using Django Rest Framework and Token Authentication. Everything works great so far. http://www.django-rest-framework.org/api-guide/authentication#tokenaut

psycopg2.errors.UndefinedTable: relation "libman_classbooks" does not exist

I had mistakenly deleted my migration folders for all my apps in my project. I therefore had to redo makemigrations and migrate for each of those apps. When th

Channels websocket AsyncJsonWebsocketConsumer disconnect not reached

I have the following consumer: class ChatConsumer(AsyncJsonWebsocketConsumer): pusher = None async def connect(self): print(self.scope)

AWS beanstalk + Django: 502 Bad Gateway - ModuleNotFoundError: No module named 'application'

I'm trying to deploy Django project to Elastic Beanstalk. I'm following their guide: https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create-deploy-python