Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
multiple permissions for multiple roles in django
im currently working on a news project which i have news-writer , article-writer etc . im using proxy models , i created a base User model and i created more user models in the name of NewsWritetUser and it has inherited in Meta class in proxy model from my base User model . i have a problem , a user , can be news_writer , article writer and etc together , i want to create a permission system to handle it , this is my models.py : `from django.db import models from django.contrib.auth.models import AbstractBaseUser, PermissionsMixin from home.urls import app_name class User(AbstractBaseUser , PermissionsMixin): USER_TYPE_CHOICES = [ ('chief_editor', 'Chief Editor'), ('news_writer', 'News Writer'), ('article_writer', 'Article Writer'), ('hadith_writer', 'Hadith Writer'), ('contactus_admin', 'Contact Us User'), ('none' , 'No Specified Duty') ] email = models.EmailField(max_length=225 , unique=True) phone_number = models.CharField(max_length=11 , unique=True) full_name = models.CharField(max_length=100) is_active = models.BooleanField(default=True) is_admin = models.BooleanField(default=False) is_staff = models.BooleanField(default = True) is_superuser = models.BooleanField(default = False) national_id = models.CharField(max_length=15 , unique=True) date_joint = models.DateTimeField(auto_now_add=True) duty_type = models.CharField(max_length=30 , choices=USER_TYPE_CHOICES , default='none') USERNAME_FIELD = 'national_id' REQUIRED_FIELDS = ['email' , 'phon_number' , 'full_name' , 'national_id'] def __str__(self): return f' ID : {self.national_id} - Name : {self.full_name} - Phone : {self.phone_number} … -
Django + Celery + PySpark inside Docker raises SystemExit: 1 and NoSuchFileException when creating SparkSession
I'm running a Django application that uses Celery tasks and PySpark inside a Docker container. One of my Celery tasks calls a function that initializes a SparkSession using getOrCreate(). However, when this happens, the worker exits unexpectedly with a SystemExit: 1 and a NoSuchFileException. Here is the relevant part of the stack trace: SystemExit: 1 [INFO] Worker exiting (pid: 66009) ... WARN NativeCodeLoader: Unable to load native-hadoop library for your platform... WARN DependencyUtils: Local jar /...antlr4-4.9.3.jar does not exist, skipping. ... Exception in thread "main" java.nio.file.NoSuchFileException: /tmp/tmpagg4d47k/connection8081375827469483762.info ... [ERROR] Worker (pid:66009) was sent SIGKILL! Perhaps out of memory? how can i solve the problem -
Django overwriting save_related & copying from linked sql tables
In django python, I am able to overwrite the save_related function (when save_as = True) so the instance I am trying to copy is saved and copied properly. When I save, though, I want other objects in other tables linked by an ID in the sql database that should be copied when the. For example we have table A, and I can copy instances in A, but I need B, a related sql table to A, to duplicate in B's table where a's id is equal to b's id. -
writable nested model serializer requires manual parsing of request.data
After a lot of trouble I finally got a Django writable nested model serializer working using drf-writable-nested, for nested data with a reverse foreign key relationship. Currently this requires me to copy and manually parse request.data for all fields to create a new object before sending it to my serializer. If I don't do this I get the following (prints of serializer.data and errors respectively): serializer.data { "leerling": "2", "omschrijving": "Basispakket", "betaaltermijn": "14 dagen", "is_credit": false, "tegoeden": [ { "[aantal]": "1", "[prijs]": "450", "[btw_tarief]": "9%" }, { "[aantal]": "1", "[prijs]": "45", "[btw_tarief]": "21%" } ] } serializer.errors { "tegoeden": [ { "btw_tarief": [ "This field is required." ] }, { "btw_tarief": [ "This field is required." ] } ] } Some fields don't error because they are not required/have a default value. I tried manually declaring the JSON without brackets as input for the serializer, and then it works. So the problem is caused by the brackets. Its working now, manually parsing the request.data Querydict, but it feels hacky and probably not how it's supposed to be done. I'm probably missing something. -
Invalid block tag on line 7: 'render_meta'. Did you forget to register or load this tag?
models and template codes are here: models.py from django.db import models from meta.models import ModelMeta ... class Tool(ModelMeta,models.Model): title = models.CharField(max_length = 250,help_text='Title') photo = ResizedImageField(size=[250, 225]) description = RichTextUploadingField(blank=True) _metadata = { 'title': 'get_title', 'description': 'get_description', 'image': 'get_image', } def get_title(self): return self.title def get_description(self): return self.description[:150] def get_image(self): if self.photo: return self.photo.url return None html file is: {% load meta %} <!DOCTYPE html> <html lang="en" > <head> {% render_meta %} </head> <body> ok </body> </html> but i get this error: Invalid block tag on line 7: 'render_meta'. Did you forget to register or load this tag? I use Django==4.2 and django-meta==2.5.0. -
Django/Apache/mod_wsgi Deployment Issue: Internal Server Error & Redirect Loop on cPanel (AlmaLinux 9)
I'm an intern trying to deploy a Django application on a cPanel server, and I've run into a persistent "Internal Server Error" coupled with an Apache redirect loop. I've been troubleshooting for over two days with various AI helpers, but I can't pinpoint the exact cause. Any fresh perspectives ?? My Setup: Server OS : AlmaLinux 9.6 (Sage Margay) Hosting Environment: cPanel (My cPanel account does not have the "Setup Python App" option, which is why I'm using a manual Apache/mod_wsgi configuration.) Django Deployment: Apache + mod_wsgi No .htaccess content at all. Project Structure: I have two Django instances (production and staging) for CI/CD, each with its own settings, environment variables, database, and domain. validator/settings/base.py validator/settings/production.py (inherits from base) validator/settings/staging.py (inherits from base) Environment files are stored in /etc/validator/envs WSGI files are stored in /etc/validator/wsgi/ Django project roots: /home/<username>/<app_name>/ (prod) and /home/<username>/<app_name_test>/ (staging). Python Version: My virtual environments are running Python 3.12.9, and my WSGI files assert this. The Problem: When I try to access either domain.in (production) or test.domain.in (staging), I receive an "Internal Server Error". My Apache error log (specifically /var/log/httpd/error_log) shows the following critical error message: [Fri May 30 00:26:38.624027 2025] [core:error] [pid 253617:tid 253705] [client 45.115.89.80:26970] … -
Getting Attribute error in django BaseCommand- Check
I am working on a tutorial project. The same code works for the instructor but doesn't work for me. I have a file for custom commands: from psycopg2 import OperationalError as Psycopg2OpError from django.db.utils import OperationalError from django.core.management.base import BaseCommand, CommandError class Command(BaseCommand): def handle(self, *args, **options): self.stdout.write('waiting for database...') db_up = False while db_up is False: try: self.check(databases=['default']) db_up = True except(Psycopg2OpError, OperationalError): self.stdout.write("Database unavailable, waiting 1 second...") time.sleep(1) self.stdout.write(self.style.SUCCESS('Database available!')) And I am writing test case for the same in a file called test_command.py which is below: from unittest.mock import patch from psycopg2 import OperationalError as Psycopg2OpError from django.core.management import call_command from django.db.utils import OperationalError from django.test import SimpleTestCase @patch('core.management.commands.wait_for_db.Command.Check') class CommandTests(SimpleTestCase): def test_wait_for_db_ready(self, patched_check): """test waiting for db if db ready""" patched_check.return_value = True call_command('wait_for_db') patched_check.assert_called_once_with(databases=['default']) @patch('time.sleep') def test_wait_for_db_delay(self, patched_sleep, patched_check): """test waiting for db when getting operational error""" patched_check.side_effect = [Psycopg2OpError] * 2 + \ [OperationalError] * 3 + [True] call_command('wait_for_db') self.assertEqual(patched_check.call_count, 6) patched_check.assert_called_with(databases=['default']) When I run the tests, I get an error message- AttributeError: <class 'core.management.commands.wait_for_db.Command'> does not have the attribute 'Check' I am unable to resolve the error. The structure of the files are added below: ![Project Structure Here] (https://ibb.co/R44Swzs0) -
How to reduce latency in translating the speech to text (real time) in a Django-React project?
I have implemented a speech to text translation in my django-react project. I am capturing the audio using the Web Audio API, ie, using navigator.mediaDevices.getUserMedia to access the microphone, AudioContext to create a processing pipeline, MediaStreamAudioSourceNode to input the audio stream, AudioWorkletNode to process chunks into Float32Array data, and AnalyserNode for VAD-based segmentation.processes it into 16-bit PCM-compatible segments, and streams it to the Django backend via web socket. The backend, implemented in consumers.py as an AudioConsumer (an AsyncWebsocketConsumer), receives audio segments or batches from the frontend via WebSocket, intelligently queues them using a ServerSideQueueManager for immediate or batched processing based on duration and energy, and processes them using the Gemini API (Gemini-2.0-flash-001) for transcription and translation into English. Audio data is converted to WAV format, sent to the Gemini API for processing, and the resulting transcription/translation is broadcast to connected clients in the Zoom meeting room group. The system optimizes performance with configurable batching (e.g., max batch size of 3, 3-second wait time) and handles errors with retries and logging. Now there is a latency in displaying the translated text in the frontend. There is an intial delay of 10s inorder to display the first translated text. Subsequent text will … -
How to change the breakpoint at which changelist table becomes stacked?
In Unfold admin, the changelist table switches to a stacked layout on small screens — likely due to Tailwind classes like block and lg:table. I’d like to change the breakpoint at which this layout switch happens (for example, use md instead of lg, or disable it entirely to keep horizontal scrolling). How can this behavior be customized or overridden cleanly? -
How to find and join active Django communities for learning and collaboration?
How can I actively engage with the Django community? Looking for forums, Discord/Slack groups, or events to discuss best practices, ask questions, and contribute. Any recommendations? I want to connect with the Django community for learning and collaboration. I checked the official Django forum but couldn't find active discussions. What I tried: Searching Meetup.com for local Django groups (none in my area) Browsing Reddit's r/django (mostly news, not interactive) What I expect: Active Discord/Slack channels for real time help Local study groups or hackathons Contribution opportunities for beginners Any recommendations beyond official docs? -
How to use login_not_required with class-based views
Django 5.1 introduced the LoginRequiredMiddleware. This comes with the companion decorator login_not_required() for function-based views that don't need authentication. What do I do for a class-based view that doesn't need authentication? -
Django SSL error during send_mail() while explicitly using TLS
I'm trying to perform a send_mail() call in my Django application, but the mails are not sending. Checking the logs, I see the following error: [Thu May 29 09:35:20.097725 2025] [wsgi:error] [pid 793757:tid 140153008285440] [remote {ip.ad.dr.ess}:65062] Error sending email: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate (_ssl.c:1147) My smtp relay uses TLS w/ whitelisting, not SSL, and I've reflected that in my /project/settings/base.py file by setting EMAIL_USE_TLS = True. I've checked my certificate and it's up-to-date and my website's HTTPS is functional. I don't understand where the disconnect lies - why could an SSL error be preventing my email from sending when I'm using TLS? -
Django manage.py Command KeyboardInterrupt cleanup code execution
do you have an idea how to use signals in custom management commands in Django? My Command's handle method processes continious stuff which needs to be cleaned up, when Command is interrupted. Without any specific additional signal handling, my Command class could look like this: class Command(BaseCommand): def handle(self, *args, **kwargs): while True: print("do continuous stuff") time.sleep(1) def cleanup(self, *args, **kwargs): print("do cleanup after continuous stuff is interrupted") Does not work out, because signal is already caught by django: def handle(self, *args, **kwargs): try: while True: print("do continuous stuff") time.sleep(1) except KeyboardInterrupt as e: self.cleanup() raise e Does not work out, because signal is not passed here: def handle(self, *args, **kwargs): self.is_interrupted = False signal.signal(signal.SIGINT, self.cleanup) while not self.is_interrupted: print("do continuous stuff") time.sleep(1) def cleanup(self, *args, **kwargs): self.is_interrupted = True print("do cleanup after continuous stuff is interrupted") raise KeyboardInter Do you have an idea? -
Working in django with data with a saved history of changes
I am creating an information system in which some entities have separate attributes or a set of them, for which it is necessary to store a history of changes with reference to the date of their relevance for further processing in conjunction with other entities. In particular, I have main entity Customer and one or a related set of date-related attributes (for example, the official names of Customer), which may change over time. What is the best or possible way to implement the interaction of the model for main entity, but with their history must be preserved? Here’s what I’ve come up with so far. The class code is probably redundant, but this is done specifically to demonstrate the problem. Main class: class Customer(models.Model): name = models.CharField(max_length=128, verbose_name='Customer system name') # A key for relation with current value of secondary class # I have doubts about the correctness of adding this field, # but so far I have not come up with anything better. legal_names = models.ForeignKey('CustomerNames', on_delete=models.SET_NULL, null=True, blank=True, verbose_name='Legal customer names') Auxiliary (secondary) class: class CustomerNames(models.Model): # A key for relation with the main model, specifying a list of names customer = models.ForeignKey(Customer, on_delete=models.CASCADE, related_name='customer_names', verbose_name='Customer') short_name = … -
Why postgres service if If you buy a managed PostgreSQL database from DigitalOcean?
Why do we need to add postgres service if we buy postgress database on DigitalOcean ? For me there is two ways to setup our database : Solution 1 : Let docker handle it by taking advantage of docker network. We configure Docker then to run PostgreSQL as a service. For this solution, no need to buy DigitalOcean database since we can map with volumes (./data/db:/var/lib/postgresql/data). Data persisted with volumes then Solution 2 : Buy DigitalOcean database. For this solution no need to setup postgress service with docker. PostgreSQL runs on DigitalOcean's infrastructure. We take advantages of DigitalOcean. DigitalOcean handles maintenance, backups, security, ... in this case. So for me, No PostgreSQL Docker service needed. So I am in this django project and despite the fact that we have our PostgreSQL runs on DigitalOcean's infrastructure in the docker-compose we steel have postgres service. So my question is why then do we need postgress service if we decide to take DigitalOcean database offer ? why do we need postgress service in this case for docker ? Just wanna understand. My crew gave me some explanations but do not understand very well. So can anyone help me to understood ? -
How to handle unfamiliar real-time tasks in Django projects without proper documentation?
We’re working with backend developers who frequently encounter real-time tasks that fall outside their core experience—for example, integrating Django applications with older third-party systems (e.g., SOAP-based services, custom XML APIs) or poorly documented internal tools. A common issue involves connecting to a SOAP API using zeep, and getting stuck handling WSSE or custom header authentication. The developers often find minimal guidance in the official docs, and very few examples online. In situations like this, where tasks are time-sensitive and documentation is lacking, what’s an effective way to: Break down the problem Debug effectively Find reliable patterns or tools to apply We’re looking to understand how experienced Django or backend developers approach unknowns like this under time pressure. I used the zeep library in Django to connect with a SOAP API. I followed the official docs and tried loading the WSDL and passing headers via the client. I expected a successful response from the server, but instead, I’m getting authentication or connection errors. I’ve tried different header formats and debug logs but can’t figure out what’s wrong. Looking for better ways to handle such situations. -
ModelViewSet does not overwrite DEFAULT_PERMISSION_CLASSES'
Hello I'm working on making all urls requires user to be authenticate , but some urls i want them to be accessible by public, so i use permission_classes = [AllowAny] and authentication_classes = ([]) to overwrite default configurations it work in APIVIEW but not in viewsets.ModelViewSet why ? settings.py REST_FRAMEWORK = { 'DEFAULT_PERMISSION_CLASSES': [ 'rest_framework.permissions.IsAuthenticated', ], 'DEFAULT_FILTER_BACKENDS': [ 'django_filters.rest_framework.DjangoFilterBackend', ], 'DEFAULT_AUTHENTICATION_CLASSES': [ 'rest_framework_simplejwt.authentication.JWTAuthentication', ], 'DATETIME_FORMAT': "%Y-%m-%d %H:%M:%S", } views.py class ToolsListViewSet(viewsets.ModelViewSet): serializer_class = ToolsListSerializer permission_classes = [AllowAny] authentication_classes = ([]) pagination_class = None def get_queryset(self): return Tools.objects.filter(is_active=True) enter code here error { "detail": "Authentication credentials were not provided." } -
How can I organize the structure of entering the city/restaurant tables of the Django database?
Good day! I have a plan for the database structure. An example is in the figure below. For example, I have - all coffee shops - within one region - state or several regions. In one city there are several cafes. In total, there can be 200 cafes and 10 cities. The problem is how to enter data on cafes in the database tables. And also change them if necessary. Enter data through forms. Each cafe also has the following parameters - address, Internet page, profitability, income, number of staff, i.e. data belonging to one cafe. As well as staff and menu. I think to first enter the cities in which there will be cafes. And then enter the names of the cafes. And even later other parameters through other forms. How can I make it so that at the second stage only the name, address is entered and then successively filled with other data? How can I organize the structure of entering the city / restaurant tables of the Django database? from django.db import models # Create your models here. class CityCafe (models.Model): city = models.CharField(verbose_name="City") class ObjectCafe (models.Model): name = models.TextField(verbose_name="Cafe Name") name_city = models.ForeignKey(CityCafe) class BaseParametrCafe (models.Model): … -
Update LANGUAGE_CODE in Wagtail before internationalization?
I've developed a site in Wagtail, but missed to update the LANGUAGE_CODE before the first (and several other) migrations. In the Internationalization instructions the following is noted: "If you have changed the LANGUAGE_CODE setting since updating to Wagtail 2.11, you will need to manually update the record in the Locale model too before enabling internationalization, as your existing content will be assigned to the old code." But, how do I manually update the the record in the Locale model? -
Low RPS when perfomance testings django website
I have a code like this that caches a page for 60 minutes: import os import time from django.conf import settings from django.core.cache import cache from django.core.mail import send_mail from django.contrib import messages from django.http import FileResponse, Http404, HttpResponse from django.shortcuts import render from django.utils.translation import get_language, gettext as _ from apps.newProduct.models import Product, Variants, Category from apps.vendor.models import UserWishList, Vendor from apps.ordering.models import ShopCart from apps.blog.models import Post from apps.cart.cart import Cart # Cache timeout for common data CACHE_TIMEOUT_COMMON = 900 # 15 minutes def cache_anonymous_page(timeout=CACHE_TIMEOUT_COMMON): from functools import wraps from django.utils.cache import _generate_cache_header_key def decorator(view): @wraps(view) def wrapper(request, *args, **kw): if request.user.is_authenticated: return view(request, *args, **kw) lang = get_language() # i18n curr = request.session.get('currency', '') country = request.session.get('country', '') cache_key = f"{view.__module__}.{view.__name__}:{lang}:{curr}:{country}" resp = cache.get(cache_key) if resp is not None: return HttpResponse(resp) response = view(request, *args, **kw) if response.status_code == 200: cache.set(cache_key, response.content, timeout) return response return wrapper return decorator def get_cached_products(cache_key, queryset, timeout=CACHE_TIMEOUT_COMMON): lang = get_language() full_key = f"{cache_key}:{lang}" data = cache.get(full_key) if data is None: data = list(queryset) cache.set(full_key, data, timeout) return data def get_cached_product_variants(product_list, cache_key='product_variants', timeout=CACHE_TIMEOUT_COMMON): lang = get_language() full_key = f"{cache_key}:{lang}" data = cache.get(full_key) if data is None: data = [] for product in … -
Django Admin site css not loading so site is lokking broken
I am using django's admin site and in that css is not loadung so site is looking totally broken.In last 3-4 days i almost tried everything which is available around the web to fix it but its not getting fixed. As this is my new account i am not able to post the images. If anyone have any idea to solve this issue then please tell me!! from pathlib import Path # Build paths inside the project like this: BASE_DIR / 'subdir'. BASE_DIR = Path(__file__).resolve().parent.parent # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/5.2/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = 'django-insecure--yt4su$h2u!*nnnl=)_)7@0(z!63t2jvf#zb@+3sa^cc-514)!' # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True ALLOWED_HOSTS = [] # Application definition INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', ] MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', ] ROOT_URLCONF = 'sample.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', ], }, }, ] WSGI_APPLICATION = 'sample.wsgi.application' # Database # https://docs.djangoproject.com/en/5.2/ref/settings/#databases DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': BASE_DIR / 'db.sqlite3', } } # Password validation # https://docs.djangoproject.com/en/5.2/ref/settings/#auth-password-validators … -
Problems integrating Django and Tableau with Web Data Connector (WDC)
I’m working on a project where I need to integrate data from my Django application into Tableau using a Web Data Connector (WDC). However, I’m running into several issues and would appreciate any help or guidance from the community. Setup: Backend: Django (Python) Goal: Tableau Dashboard Connection: Web Data Connector (WDC) What I’ve done so far: I created a WDC that fetches data from my Django API. The API provides JSON data, which I want to pass to Tableau via the WDC. The WDC was built using JavaScript and connects to the Django API. Issues: CORS Errors: Tableau seems to have issues with the Cross-Origin Resource Sharing (CORS) settings in my Django application. I’ve installed and configured django-cors-headers, but the error persists. Slow Data Transfer: When dealing with large datasets, the transfer from Django to Tableau is extremely slow. Authentication: My Django API uses token-based authentication, but I’m unsure how to implement this securely in the WDC. My Questions: How can I resolve CORS issues between Django and Tableau? Are there best practices to speed up data transfer between Django and Tableau? How can I securely implement authentication (e.g., token-based or OAuth) in the WDC for Django? Additional Information: Django … -
unexpected behaviour with django with django channels
class SessionTakeOverAPIView(generics.GenericAPIView): """ This API view allows a human or AI to take over a chat session. The view handles session takeover validation, updates the session state, and broadcasts relevant events to the chat group. A POST request is used to trigger either a human or AI takeover of a session. Authentication is required to access this view. """ def __init__(self, **kwargs): super().__init__(**kwargs) self.room_group_name = None permission_classes = [BotUserHasRequiredPermissionForMethod] post_permission_required = ['session.reply_session'] queryset = Session.objects.select_related('bot').all() serializer_class = SessionTakeOverSerializer def get_object(self): """ Retrieves the session object based on the session_id provided in the request data. Raises a 404 error if the session is not found. """ try: return super().get_queryset().get(session_id=self.request.data.get('session_id')) except Session.DoesNotExist: raise Http404 # Return 404 error if session not found def handle_human_take_over(self): """ Handles the logic when a human takes over the chat session. It performs the following: - Validates if the session is already taken over by another human. - Updates the session to reflect the current user as the human taking over. - Sends a message to the chat group about the takeover. - Creates a log entry for the takeover asynchronously. """ request = self.request session: Session = self.get_object() # Check if the session is already taken … -
How to use schema with variable to pass though different environnement
I try to variabilise schema name because i use different environnment for my project. So i do this in my models.py: # from django.contrib.auth.models import AbstractUser from django.contrib.auth.models import AbstractUser #Pour plus d'information sur le fonctionnement des models : https://docs.djangoproject.com/fr/5.1/topics/db/models/ from django.conf import settings if settings.ENV == "DEV": schema="applications_db" elif settings.ENV == "VIP": schema="applications_vip_db" elif settings.ENV == "PROD": schema="applications_prod_db" class ApplicationDjango(models.Model): a_name = models.CharField(max_length=100,verbose_name="Nom") a_portail_name = models.CharField(max_length=100,verbose_name="Nom portail") a_views_name = models.CharField(max_length=100,verbose_name="Views name") a_url_home = models.CharField(max_length=100,verbose_name="Url home") def __str__(self): return self.a_name+"_"+self.a_portail_name #class pour ajouter une contrainte d'unicité class Meta: managed= True db_table = f'{schema}.\"ApplicationDjango\"' i make my migration --> noproblem then when i migrate i got this error : ./manage.py migrate Applications Operations to perform: Apply all migrations: Applications Running migrations: Applying Applications.0004_alter_applicationdjango_table_alter_user_table...Traceback (most recent call last): File "/home/webadmin/.local/lib/python3.9/site-packages/django/db/backends/utils.py", line 87, in _execute return self.cursor.execute(sql) psycopg2.errors.SyntaxError: syntax error at or near "." LINE 1: ...ons_applicationdjango" RENAME TO "applications_db"."Applicat... ^ i try several things but it dont work. I hope that i can variablise schema name :/ Thanks for the help -
How can I send data via copy paste operation in Django Views or model?
I have such a very difficult problem. Which is very specific and not easy to enter data. I am thinking how to send data to the database or, as an option, just send data to the code in the internal Django code for processing in Views. Is it possible, for example, to have the ability to send data not one by one in the singular, to fill in the input field. Fill in the input field not only one in the singular. For example, as the most common case of data processing in office or other applications - the copy / paste operation. So in this frequent popular operation - for example, we want to copy several elements in an Excel table and try to insert them somehow send to the code in the internal Django code for processing in Views. Is it possible to implement something similar? So as not to manually enter data, but somehow have the ability to do this in a semi-automatic form - by copying several cells with data and pasting them into some kind of form or something similar? How can I send data via copy paste operation in Django Views or model? from …