Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
How to disable CSRF_COOKIE_SECURE in django
CSRF_COOKIE_SAMESITE = 'None' CSRF_COOKIE_SECURE = False My frontend and backend run on different domains in development, I'm trying to enable setting csrf-token cookie using HTTP, but I guess False value for CSRF_COOKIE_SECURE option somehow gets interpreted as 'not set' and Chrome says My second guess is that it has to be True, otherwise it's not allowed to send cookies between domains. So my question is whether it's possible to set cookies via plain HTTP with cross-domain requests and if it is, what are the right Django settings for achieving this -
"Python 'banktype' cannot be converted to a MySQL type" error in django
When connecting to the banking portal, this error is given, which seems to be because the information is not being entered into the mysql database. Of course, this works correctly locally on sqlite3, but when it comes to the server, this error is given This is error: TypeError at /gotogateway/ Python 'banktype' cannot be converted to a MySQL type Request Method: GET Request URL: https://omidzaferan.ir/gotogateway/ Django Version: 4.1.5 Exception Type: TypeError Exception Value: Python 'banktype' cannot be converted to a MySQL type Exception Location: /home/omidzaf1/virtualenv/OmidZaferan/3.9/lib/python3.9/site-packages/mysql/connector/conversion.py, line 223, in to_mysql Raised during: core.views.go_to_gateway_view Python Executable: /home/omidzaf1/virtualenv/OmidZaferan/3.9/bin/python3.9 Python Version: 3.9.12 Python Path: ['', '/home/omidzaf1/OmidZaferan', '/home/omidzaf1/virtualenv/OmidZaferan/3.9/lib64/python39.zip', '/home/omidzaf1/virtualenv/OmidZaferan/3.9/lib64/python3.9', '/home/omidzaf1/virtualenv/OmidZaferan/3.9/lib64/python3.9/lib-dynload', '/opt/alt/python39/lib64/python3.9', '/opt/alt/python39/lib/python3.9', '/home/omidzaf1/virtualenv/OmidZaferan/3.9/lib/python3.9/site-packages'] Server time: Tue, 31 Jan 2023 15:15:54 +0330 -
Implement autopayment in PayPal Django?
Can we implement auto payment using PayPal in the Django Application? I want to implement an auto payment system using PayPal, but I am not able to find any proper solution regarding this. Can anyone help? -
Why doesn't django have a `pgettext_noop` function?
gettext_noop Is really great when you want to tag enum values to be translated dynamically later, and pgettext is also really great when some words can be used in different contexts with different meanings. Why is there no pgettext_noop to get best of both ? -
return Database.Cursor.execute(self, query, params) django.db.utils.OperationalError: no such column: api_ingredient.meal_id
I try to save menu.json file data to my database sql in django rest_framework api. Can you help me? Can you check my database model is it okey? also I got error I mentioned below. models.py class Meal(models.Model): id = models.AutoField(primary_key=True) name = models.CharField(max_length=100) is_vegetarian = models.BooleanField(default=False) is_vegan = models.BooleanField(default=False) def __str__(self): return self.name class Ingredient(models.Model): id = models.AutoField(primary_key=True) name = models.CharField(max_length=100) groups = models.CharField(max_length=100) meal = models.ForeignKey(Meal, on_delete=models.CASCADE) def __str__(self): return self.name class Option(models.Model): id = models.AutoField(primary_key=True) ingredient = models.ForeignKey(Ingredient, on_delete=models.CASCADE) name = models.CharField(max_length=100) quality = models.CharField(max_length=100) price = models.FloatField() per_amount = models.CharField(max_length=100) def __str__(self): return self.name class MealIngredient(models.Model): id = models.AutoField(primary_key=True) meal = models.ForeignKey(Meal, on_delete=models.CASCADE) ingredient = models.ForeignKey(Ingredient, on_delete=models.CASCADE) path = r"C:\Users\OSMAN MERT\Desktop\menu\menu_core\menu.json" with open(path) as f: data = json.loads(f.read()) for meal in data["meals"]: id = meal["id"] name = meal["name"] meal_obj, created = Meal.objects.get_or_create(name=name) for ingredient in meal["ingredients"]: name_in = ingredient["name"] ingredient_obj, created = Ingredient.objects.get_or_create(name=name_in) MealIngredient.objects.get_or_create(meal=meal_obj, ingredient=ingredient_obj) for ingre in data["ingredients"]: ingre_name = ingre["name"] ingre_obj, created = Ingredient.objects.get_or_create(name=ingre_name) for opti in ingre["options"]: opt_name = opti["name"] opt_quality = opti["quality"] opt_price = opti["price"] opt_amount = opti["per_amount"] Option.objects.get_or_create(ingredient=ingre_obj, name=opt_name, quality=opt_quality, price=opt_price, per_amount=opt_amount) I tried delete my database and makemigrations, migrate but it did not solve my problem. My error is: File … -
Is there anyway to remove the ul element from the django forms.errors?
I was wondering if there is anyway to remove the ul element form the django form.errors. Image what the page looks like This is what it looks like, but I don't like that indented offset look it has to it. Here is the code for template. {% extends 'base.html' %} {% block title %} Register {% endblock title %} {% block content %} {% if form.errors %} {% for field in form %} {{ field.errors }} {% endfor %} {% endif %} <form method="post"> {% csrf_token %} <div class="mt-4 mb-4"> <label for="{{ form.first_name.label }}"> {{ form.first_name.label }} </label> {{ form.first_name }} </div> <div class="mb-4"> <label for="{{ form.last_name.label }}"> {{ form.last_name.label }} </label> {{ form.last_name }} </div> <div class="mb-4"> <label for="{{ form.username.label }}"> {{ form.username.label }} </label> {{ form.username }} </div> <div class="mb-4"> <label for="{{ form.email.label }}"> {{ form.email.label }} </label> {{ form.email }} </div> <div class="mb-4"> <label for="{{ form.password.label }}"> {{ form.password.label }} </label> {{ form.password }} </div> <div class="mb-4"> <label for="{{ form.password2.label }}"> {{ form.password2.label }} </label> {{ form.password2 }} </div> <button class="btn btn-primary" type="submit"> Register </button> </form> {% endblock content %} I have set ul > errorlist to list-display-type: none, in my css but that didn't fix the … -
How do I update this form field so it stays hidden on page load?
I have this form in my Django project. On page load it should only show the entity name, but it's showing both the entity-name and quote-text fields. The page should only show the quote-text field when the entity-name is not in the database. The toggle works for all cases except page load. It's the line if (entities.length === 0) I need to update but I'm not sure what to update it to. <form> <label for="entity-name">Entity Name:</label> <input type="text" id="entity-name" name="entity-name" onkeyup="searchEntities()"> <div id="search_results"></div> </form> <form id="quote-form"> <label for="quote-text">Quote Text:</label> <textarea class="form-control" id="quote-text" name="quote-text" rows="3"></textarea> <button type="submit" class="btn btn-primary">Submit</button> </form> <script> function searchEntities() { const entityName = document.querySelector('#entity-name').value; console.log('hi'); console.log(entityName); fetch(`/search-entities/?entity_name=${entityName}`) .then(response => response.json()) .then(entities => { const searchResults = document.querySelector('#search_results'); searchResults.innerHTML = ''; if (entities.length === 0) { // Show the quote field document.querySelector('#quote-form').style.display = 'block'; } else { entities.forEach(entity => { const p = document.createElement('p'); p.innerHTML = entity.name; searchResults.appendChild(p); }); // Show the quote field document.querySelector('#quote-form').style.display = 'none'; } }); } </script> -
How to learn django ? Do i need to learn flask first?
I'm new to this coding and i recently finished learning python and i wanna learn django but my senior tell me to learn flask first and then only django bcoz django has many prewritten codes that they say is hard to understand .is that right? please tell me which way is better just to learn django right after python or to learn flask and then django? can somebody suggest me which way is better? -
You don't have permission to access that port
In my Django, when I try to run the server, it displays this error. What should be done to fix the error?enter image description here What should be done to fix the error?[ -
Query Database and remove Charfield Choices based on what is in database
I have created a booking form using Django forms. For selecting a time I have a series of choices. However, I want to only display those choices in the form if they don't already exist on that data and time. Here is my models.py: from django.db import models from django.contrib.auth.models import User from django.core import validators import datetime TIME_CHOICES = ( ('12:00:00', '12pm'), ('12:15:00', '12:15pm'), ('12:30:00', '12:30pm'), ('12:45:00', '12:45pm'), ('13:00:00', '1pm'), ('13:15:00', '1:15pm'), ('13:30:00', '1:30pm'), ('13:45:00', '1:45pm'), ('14:00:00', '2pm'), ('14:15:00', '2:15pm'), ('14:30:00', '2:30pm'), ('14:45:00', '2:45pm'), ('15:00:00', '3pm'), ('15:15:00', '3:15pm'), ('15:30:00', '3:30pm'), ('15:45:00', '3:45pm'), ('16:00:00', '4pm'), ('16:15:00', '4:15pm'), ('16:30:00', '4:30pm'), ('16:45:00', '4:45pm'), ('17:00:00', '5pm'), ('17:15:00', '5:15pm'), ('17:30:00', '5:30pm'), ('17:45:00', '5:45pm'), ('18:00:00', '6pm'), ('18:15:00', '6:15pm'), ('18:30:00', '6:30pm'), ('18:45:00', '6:45pm'), ('19:00:00', '7pm'), ('19:15:00', '7:15pm'), ('19:30:00', '7:30pm'), ('19:45:00', '7:45pm'), ('20:00:00', '8pm'), ('20:15:00', '8:15pm'), ('20:30:00', '8:30pm'), ('20:45:00', '8:45pm'), ('21:00:00', '9pm'), ('21:15:00', '9:15pm'), ('21:30:00', '9:30pm'), ('21:45:00', '9:45pm'), ('22:00:00', '10pm'), ('22:15:00', '10:15pm'), ('22:30:00', '10:30pm'), ('22:45:00', '10:45pm'), ) class Booking(models.Model): user = models.ForeignKey( User, on_delete=models.CASCADE, null=True, blank=True ) first_name = models.CharField(max_length=25, null=False, blank=False) last_name = models.CharField(max_length=25, null=False, blank=False) email_address = models.EmailField(default="email@email.com") phone_number = models.IntegerField() date_of_booking = models.DateField(default=datetime.date.today()) time_of_booking = models.CharField( max_length=10, choices=TIME_CHOICES, default="" ) number_of_people = models.IntegerField() special_requests = models.CharField(max_length=200) def __str__(self): # code adapted from Models Part … -
How to implement Redis db without caching in django
I want to implement the Redis Database and Postgres in the Django cache, but I need to implement them separately. means I need to check the Redis manually and not through the Django caching. Could any help me implement this? -
django image gives me an error "This field is required."
When I send an image to the bank to save, it always returns this message "This field is required." but I fill the field with an image but it always returns this error. Views enter image description here Models enter image description here Forms enter image description here HTML enter image description here URLS enter image description here -
Websocket connection failed: With django and vue.js
I'm trying to set up websockets to show any new entry in Post model (I'm new with websockets) class Post(models.Model): title = models.CharField(max_length=200, unique=True) content = models.TextField() status = models.IntegerField(choices=STATUS, default=0) author = models.ForeignKey( User, related_name="blog_posts", on_delete=models.CASCADE, ) created_at = models.DateTimeField(auto_now_add=True) updated_at = models.DateTimeField(auto_now=True) This is the consumers.py class PostConsumer(ListModelMixin, GenericAsyncAPIConsumer): queryset = Post.objects.all() serializer_class = PostSerializer permissions = (permissions.AllowAny,) For checking if it works I have an html and I'm handling the websockets with vue.js here's the more relevant part of the index.html <title>Testing Websockets</title> </head> <body> <div id="app" class="row mt-5"> <div class="col-1"></div> <div class="col-10"> <div class="card"> <p class="card-header">Display list of all the posts in Real-Time</p> <div class="card-body"> <table class="table align-middle mb-0 bg-white"> <thead class="bg-light"> <tr> <th>Title</th> <th>Status</th> <th>Author</th> </tr> </thead> <tbody> <tr v-for="post in posts"> <td> <p class="fw-normal mb-1">[[ post.title ]]</p> </td> <td> <span class="badge rounded-pill d-inline" :class="{'bg-success': post.status !== 'Draft', 'bg-warning': post.status === 'Draft'}" > [[ post.status ]] </span> </td> <td>[[ post.author ]]</td> </tr> </tbody> </table> </div> </div> </div> </div> <script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous" ></script> <!-- JavaScript Bundle with Popper --> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0/dist/js/bootstrap.bundle.min.js" integrity="sha384-A3rJD856KowSb7dwlZdYEkO39Gagi7vIsF0jrRAoQmDKKtQBHUuLZ9AsSv4jD4Xa" crossorigin="anonymous" ></script> <script src="https://cdn.jsdelivr.net/npm/vue@2.6.14"></script> <script> vueApp = new Vue({ el: "#app", delimiters: ["[[", "]]"], data() { return { posts: [], }; }, }); … -
How to convert this SQL query to Django Queryset?
I have this query which selects values from two different tables and used array agg over matched IDs how can I get same results using the queryset. Thank you! select sf.id_s2_users , array_agg(sp.id) from s2_followers sf left join s2_post sp on sp.id_s2_users = sf.id_s2_users1 where sp.id_s2_post_status = 1 and sf.id_s2_user_status = 1 group by sf.id_s2_users -
TabularInline and date range overlap constraint
I use the following formset to avoid overlapping date ranges: class OccupancyInlineFormset(BaseInlineFormSet): def clean(self): super().clean() for form in self.forms: conflicts = Occupancy.objects.filter(unit=form.cleaned_data['unit'], begin__lte=form.cleaned_data['end'], end__gte=form.cleaned_data['begin']) if any(conflicts): raise ValidationError(_('Overlapping occupancies!'), code='overlap') This works well in principle, but my current Occupancy instance always needs to have an end date of 9999-12-31. When I change this date in the admin form for the current instance (and add a new instance with an ende date of 9999-12-31), the clean() function will always raise an exception based on the values stored in the database. I do not really see how I could avoid this without changing the offending end date (9999-12-31 → 2023-01-31) first in a different (unconstrained) form, which defeats the purpose of the TabularInline form. Thanks for any help! -
djnago waiting for server response time problem in production
i have a django app that its main purpose is to make an api . it has: api/ url for api that renders data from db test/ url for a test page that only returns HttpResponse("Done") insert/ url for inserting data to db the speed is ok(255 ms) in development but it's sometimes fast (260 ms) and most of the time slow(30-40 s) in production even for loading that test page which only shows a single word. is this problem related to the code or to the hosting provider? note: we use react for frontend and routes are like: mainsite.com/home and we use subdomain like: api.mainsite.com/api or api.mainsite.com/insert for backend -
Fetch request being blocked by cors policy when GET request is sending a specific value
I have a website which is using the Vue.js framework which connects to a django api. The django api has the following settings: MIDDLEWARE = [ .. "corsheaders.middleware.CorsMiddleware", .. ] CORS_ALLOWED_ORIGINS = ["http://localhost:3000", 'http://127.0.0.1:3000'] The following request works fine: fetch("http://127.0.0.1:8000/select?user_sent=1") However this request causes an error: fetch("http://127.0.0.1:8000/select?user_sent=2") The error caused by the second request: Access to fetch at 'http://127.0.0.1:8000/select?user_sent=2' from origin 'http://localhost:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled. The weird thing is that the second request used to work before. I made a change to my django urls and changed the name of the select path but then changed it back to select and now it is no longer working. I tried changing the name of the select path to /sele and when I do that the request will work fine on the new path. However, I would like to know why it is not working on the /select path. -
Initializing firebase database causes error in project bundled with rollup and babel
I have a project where i'm using typescript to extend the Nakama game server. The portion of code i'm dealing with is basically a typescript project that is bundled with rollup and babel before being imported into the game server. I'm having issues using firebase in the project. let firebaseConfig = { apiKey: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', appId: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', messagingSenderId: 'xxxxxx', projectId: 'xxxxxxx', authDomain: 'xxxxxxxxxxxxxxxxxxxxxxxx', databaseURL: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', storageBucket: 'xxxxxxxxxxxxxxxxxxxxxxxxx', measurementId: 'xxxxxxxx', }; logger.info("after firebase config"); let app = initializeApp(firebaseConfig); logger.info("initialized firebase"); let db = getDatabase(app); logger.info("initialzed database"); let dbRef = ref(db); logger.info("after initialize db ref");` Immediately the line let db = getDatabase(app); is hit, the program runs into the following error: {"level":"info","ts":"2023-01-31T12:43:46.052+0300","caller":"server/runtime_javascript_logger.go:74","msg":"after firebase config","mid":"dbeec043-ed6d-4dab-9b91-92ff54dd41e5"} {"level":"info","ts":"2023-01-31T12:43:46.055+0300","caller":"server/runtime_javascript_logger.go:74","msg":"initialized firebase","mid":"dbeec043-ed6d-4dab-9b91-92ff54dd41e5"} {"level":"error","ts":"2023-01-31T12:43:46.060+0300","caller":"server/runtime_javascript_logger.go:94","msg":"GoError: error creating match: error creating match: TypeError: Cannot add property [DEFAULT], object is not extensible at getImmediate (index.js:2536:13(73))","rpc_id":"create_match"} As you can see, all the lines above the let db = getDatabase(app); run with no issue until this particular line is encountered. I suspected it may be an issue with my rollup and babel config so i tried getting help from firebase's documentation and also nakama's documentation for configuring rollup and babel. But the issue is still present. I don't know what to do next. Here is … -
Getting forbidden error while accessing a directory in using nginx inside docker
I am using Docker version 4.14 to build a Django application and Nginx as a web service. I have two Dockerfiles, one for nginx and one for the Django app, The Django workflow and API serving are fine with nginx, and even static files are served well through nginx. I use Django logging to log the exceptions in the app to a directory named logs, but when I try to access the directory through nginx, I get a 403 Forbidden error. **nginx docker file** FROM nginx:1.21-alpine RUN rm /etc/nginx/conf.d/default.conf COPY nginx.conf /etc/nginx/conf.d **nginx conf** server { listen 80; include mime.types; types { text/plain log txt; } location / { proxy_pass http://web:8000; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $host; proxy_redirect off; } location /static/ { alias /code/static/; } location /logs { alias /code/logs/; } } \*\*root dockerfile \*\* FROM python:3.10.2-slim-bullseye ENV PIP_DISABLE_PIP_VERSION_CHECK 1 ENV PYTHONDONTWRITEBYTECODE 1 ENV PYTHONUNBUFFERED 1 WORKDIR /code COPY ./requirements.txt . RUN pip install -r requirements.txt # Copy project COPY . . \*\*docker compose \*\* version: "3.9" services: web: build: . ports: \- "8000:8000" command: gunicorn tech_plotz.wsgi:application --bind 0.0.0.0:8000 volumes: \- static_volume:/code/static \- logs_volume:/code/logs expose: \- 8000 depends_on: \- db db: image: postgres:13 volumes: \- postgres_data:/var/lib/postgresql/data/ environment: \- "POSTGRES_HOST_AUTH_METHOD=trust" … -
'Context' object has no attribute 'render_context'
I am running Django==3.2.12 and trying to generate a rendered tewmplate string. The following is the nuts and bolts of it.... I am recieving the error "'Context' object has no attribute 'render_context'" and can not make any sence of it. It used to work fine. I'm using {% load mjml %} which is installed using node_modules with MJML_BACKEND_MODE = "cmd" MJML_EXEC_CMD = "node_modules/.bin/mjml" from django.template import Template, Context template = Template(verbatum) context = Context({}) try: html_template = template.render(context) except Exception as err: html_template = str(err) -
AttributeError at / 'tuple' object has no attribute 'get'
When i started my Django server, it`s not success. Error: AttributeError at / 'tuple' object has no attribute 'get' Request Method: GET Request URL: http://127.0.0.1:8000/ Django Version: 4.1.5 Exception Type: AttributeError Exception Value: 'tuple' object has no attribute 'get' Exception Location: C:\Users\Admin-16.DESKTOP-PDDKOLS\AppData\Local\Programs\Python\Python39\lib\site-packages\django\middleware\clickjacking.py, line 26, in process_response Raised during: weather.views.index Python Executable: C:\Users\Admin-16.DESKTOP-PDDKOLS\AppData\Local\Programs\Python\Python39\python.exe Python Version: 3.9.0 Python Path: ['C:\Users\Admin-16.DESKTOP-PDDKOLS\Desktop\Погода\WeatherApp', 'C:\Users\Admin-16.DESKTOP-PDDKOLS\AppData\Local\Programs\Python\Python39\python39.zip', 'C:\Users\Admin-16.DESKTOP-PDDKOLS\AppData\Local\Programs\Python\Python39\DLLs', 'C:\Users\Admin-16.DESKTOP-PDDKOLS\AppData\Local\Programs\Python\Python39\lib', 'C:\Users\Admin-16.DESKTOP-PDDKOLS\AppData\Local\Programs\Python\Python39', 'C:\Users\Admin-16.DESKTOP-PDDKOLS\AppData\Local\Programs\Python\Python39\lib\site-packages'] Server time: Tue, 31 Jan 2023 10:09:23 +0000 can be corrected? P.S. my english is bad. I wanted to run a Django server, but he doesn`t -
Django Channels - Websocket connection failed (production)
I decided to add websockets to my project in order to communicate with the database instantly. But at first I decided to just check if websockets will work on production. I made a test version with chat from Django documentation. To my deep regret they only work locally and I tried to figure out what's wrong. But it didn't work for me. The problem is that on localhost websockets work fine, but when I pour them into production, an error occurs. In asgi I tried to replace test.routing with path(...), but it did not change anything. asgi.py import os from channels.auth import AuthMiddlewareStack from channels.routing import ProtocolTypeRouter, URLRouter from django.core.asgi import get_asgi_application import test.routing os.environ.setdefault("DJANGO_SETTINGS_MODULE", "ERA.settings") ERA_asgi_app = get_asgi_application() application = ProtocolTypeRouter({ "http": ERA_asgi_app, "websocket": AuthMiddlewareStack( URLRouter( test.routing.websocket_urlpatterns ) ), }) routing.py from django.urls import re_path from test import consumers websocket_urlpatterns = [ re_path(r'chat/(?P<room_name>\w+)/$', consumers.ChatConsumer.as_asgi()), ] nginx.conf location /ws/ { proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header Host $host; proxy_http_version 1.1; proxy_redirect off; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Host $server_name; proxy_pass http://0.0.0.0:8443; } javascript code const roomName = JSON.parse(document.getElementById('room-name').textContent); if (window.location.protocol === 'https:') { var chatSocket = new WebSocket( 'wss://' + window.location.host + '/chat/' + roomName + '/' … -
Django - Can not join 2 models
Problem: Joining 2 models in Django. Error: Error during template rendering. Direct assignment to the reverse side of a many-to-many set is prohibited. Use entity_id.set() instead. I have read through all the threads on SO. Tried all the suggested solutions, read the Django documentation and think I just must be fundamentally misunderstanding something. Any help would be much appreciated. I have 2 models. Entity and File. An Entity can have multiples Files but each File only has 1 Entity. The primary keys of each table are just auto incrementing integers. Therefore I want to join column entity_id from File with entity_id from Entity. According to the documentation I have set entity_id in File as a ForeignKey. And I have set entity_id as unique in Entity class Entity(models.Model): pk_entity = models.AutoField(primary_key=True) entity_id = models.IntegerField(blank=True, null=True, unique=True) name = models.CharField(blank=True, null=True) class Meta: managed = False db_table = 'entities' class File(models.Model): pk_file = models.AutoField(primary_key=True) filename = models.CharField(blank=True, null=True) entity_id = models.ForeignKey(Entity, on_delete= models.CASCADE, to_field='entity_id') The view is just trying to render this. I have tried using .all() rather than select_related() but no data renders. class TestListView(ListView): queryset = File.objects.select_related() template_name = "operations/files/test_list.html" And this is the html: {% extends "base.html" %} {% … -
AUTH_USER_MODEL refers to model 'account.User' that has not been installed
hello my setting structure is: enter image description here and in base part added: enter image description here enter image description here and its ok in create-users admin-panell and etc but when im calling enter image description here i got: enter image description here please help me i need user model but get error -
I have to add sms.to for sending otp in my django-rest-framework project . I didn't find any python package for that. how can i implement this?
In this project, I have to send opt to the user. I have to use 'sms.to', can someone tell me how I can do this?