Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Problems using mdeditor markdown with Django
I'm trying to use the django-mdeditor plugin for markdown in my Django application, but following the documentation I was unable to implement it via form, only manually with static paths. Which brings me some questions: Why are the paths not identified on the client when loaded via form? Why when loaded manually does it cause incompatibilities with bootstrap? Should I talk to my team and migrate to ckeditor? Note: All settings described in the documentation were made (https://pandao.github.io/editor.md/en.html) Models.py class Entrega(models.Model): usuario = models.ForeignKey(User, on_delete=models.CASCADE, editable=False) descricao = MDTextField(blank=True) data_criacao = models.DateTimeField(auto_now_add=True) [...] Forms.py class EntregaForm(forms.Form): descricao = MDTextFormField () When I use just {{form}} in my template, errors are generated in the console When I manually load the paths, errors are generated in the selector-engine template [...] <link href="{% static 'mdeditor/css/editormd.min.css' %}" rel="stylesheet"> <script src="{% static 'mdeditor/js/editormd.min.js' %}"></script> <div class="mb-3" id="texteditor"><textarea class="form-control" id="descricao" name="descricao"></textarea></div> <script type="text/javascript"> $(function () { editormd("texteditor", { width : "100%", height : 500, path : "{% static 'mdeditor/js/lib/' %}", htmlDecode : "style,script,iframe", tex : true, emoji : true, taskList : true, flowChart : true, sequenceDiagram : true, placeholder : '' }); }) </script> -
Django Migrations Not Using Configured Database Connection
I am using supabase postgresql along with django. By default it uses the public schema, but now I want to link the user_id field in model to auth.users.id where auth is the schema, users is the table name and id is the UUID field Models definition here # auth/models.py class SupabaseUser(models.Model): id = models.UUIDField( primary_key=True, default=uuid.uuid4, verbose_name="User ID", help_text="Supabase managed user id", editable=False, ) class Meta: managed = False db_table = "users" # myapp/models.py class MyModel(models.Model): user = models.ForeignKey( SupabaseUser, on_delete=models.CASCADE, verbose_name="Supabase User", help_text="Supabase user associated with the screenshot account", null=False, ) In the settings I have two database connections DATABASES = { "default": dj_database_url.config(), "supabase_auth": dj_database_url.config(), } DATABASES["supabase_auth"]["OPTIONS"] = { "options": "-c search_path=auth", } And of course model router is configured as from django.db.models import Model from django.db.models.options import Options class ModelRouter: @staticmethod def db_for_read(model: Model, **kwargs): return ModelRouter._get_db_schema(model._meta) @staticmethod def db_for_write(model: Model, **kwargs): return ModelRouter._get_db_schema(model._meta) @staticmethod def allow_migrate(db, app_label, model: Model, model_name=None, **kwargs): return True @staticmethod def _get_db_schema(options: Options) -> str: if options.app_label == "auth": return "supabase_auth" return "default" When I use the ./manage.py shell and run the following script, it works from auth.models import SupabaseUser assert SupabaseUser.objects.count() == 1 But when I apply migration for myapp, I … -
Cors Error on some user on hosted website
I have created a bot chatting website using Django and react and i have hosted this website on HOSTINGER. The backend is hosted using VPS. The problem is some of the user can see the full website and some use are getting CORS error. The API are not working for them In the backend settings.py i have set allowed host for all and tried every possible solution i got on stackoverflow for cors but still nothing works. if anybody has any about it please help. i have also set all the middlewares as well. ALLOWED_HOSTS = ['*'] i have set this to star -
Web Socket don't make connection with Wss /https Django
This is my asgi.py. import os, django from django.core.asgi import get_asgi_application from channels.routing import get_default_application django_asgi_app = get_asgi_application() # from django.core.asgi import get_asgi_application from channels.routing import ProtocolTypeRouter, URLRouter from channels.auth import AuthMiddlewareStack from django.urls import path from scraptaxiapp.consumers import UploadFileConsumer from scraptaxiapp.routing import websocket_urlpatterns print("websockets", websocket_urlpatterns, URLRouter(websocket_urlpatterns)) os.environ.setdefault("DJANGO_SETTINGS_MODULE", "ScrapTaxi.settings") django.setup() application = ProtocolTypeRouter({ 'https': django_asgi_app, 'websocket': AuthMiddlewareStack(URLRouter(websocket_urlpatterns)) }) This is my routing.py from django.urls import re_path from .consumers import UploadFileConsumer websocket_urlpatterns = [ re_path(r"^ws/UploadFile/$", UploadFileConsumer.as_asgi()), re_path("hello/", UploadFileConsumer.as_asgi()) ] This is my settings CHANNEL_LAYERS = { "default": { "BACKEND": "channels.layers.InMemoryChannelLayer", }, } i have started daphne as daphne -e ssl:8001:privateKey=private_key.pem:certKey=certificate.pem ScrapTaxi.asgi:application -p 8001 -b x.x.x.x my ssl is self signed. now after this i am able to connect web socket with ws but not with wss C:\Users\PC>wscat -c "wss://x.x.x.x:8001/ws/UploadFile/" --no-check error: Client network socket disconnected before secure TLS connection was established Now i am using runserverplus for django application so i have to use wss for channel connection. -
Is deploying React app as part of Django application possible?
I have django application that serves as backend and a multi page react app as frontend. I have bought one domain name and I want to deploy these app on that. I have a couple of questions, Is it possible to deploy this which is catered by the single domain name? If possible how? If yes then will this expose the backend APIs from django application? -
Login redirects in Django
I have a auth system with django-allauth library, and i have some login, logout functionally implemented and it works fine. But i want to implement a profile page on my own. With this i'm so confusing right with Django redirects. I have a class based view called HomeRequestHandler that inherits a LoginRequiredMixin: from django.contrib.auth.mixins import LoginRequiredMixin from django.views.generic import TemplateView class HomeRequestHandler(LoginRequiredMixin, TemplateView): template_name = "home.html" and in my urls i just call it to "": from django.views.generic import TemplateView from django.urls import path from . import views urlpatterns = [ path("", views.HomeRequestHandler.as_view(), name="home"), path("profile/", TemplateView.as_view(template_name="account/profile.html"), name="profile"), ] in my settings.py i have a constant for LOGIN_REDIRECT_URL: LOGIN_REDIRECT_URL = reverse_lazy('profile') When i try login, i am redirected to "/" even with LOGIN_REDIRECT_URL defined. But if i change one thing in my view: from django.contrib.auth.mixins import LoginRequiredMixin from django.views.generic import TemplateView class HomeRequestHandler(LoginRequiredMixin, TemplateView): template_name = "home.html" redirect_field_name = "redirect_to" It change my url http://localhost:8000/accounts/login/?next=/ to http://localhost:8000/accounts/login/?redirect_to=/ and now the constant works normally, why??? -
Better way to insert a very large data into PostgreSQL tables
What is the better way to insert a very large data into PostgreSQL Table? OS: Ubuntu 22.04 LTS DB: PostgreSQL 14 Framework: Python 3.11 Django For now I am using insert into statement of 100,000 rows at a time. It is taking 2 Minutes for the whole process of inserting average of 1,000,000 rows, which is within my acceptable range. But I want to know if there is any better way to do this. It was working fine but somehow it is taking more time and sometimes giving errors like OperationalError: (psycopg2.OperationalError) server closed the connection unexpectedly from django.db import connection cursor = connection.cursor() batch_size = 100000 offset = 0 while True: transaction_list_query = SELECT * FROM {source_table} LIMIT {batch_size} OFFSET {offset}; cursor.execute(transaction_list_query) transaction_list = dictfetchall(cursor) if not transaction_list: break data_to_insert = [] for transaction in transaction_list: # Some Process Intensive Calculations insert_query = INSERT INTO {per_transaction_table} ({company_ref_id_id_column}, {rrn_column},{transaction_type_ref_id_id_column}, {transactionamount_column}) VALUES {",".join(data_to_insert)} ON CONFLICT ({rrn_column}) DO UPDATE SET {company_ref_id_id_column} = EXCLUDED.{company_ref_id_id_column}; cursor.execute(insert_query) offset += batch_size -
Failed to resolve 'minio' ([Errno -2] Name or service not known)")) in django project
Hello I'm trying to start Minio using docker, but i get this error: urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='minio', port=9000): Max retries exceeded with url: /local-static?location= (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x7fd2de09e490>: Failed to resolve 'minio' ([Errno -2] Name or service not known)")) this happens when it checks if the bucket exists during start up here: if self.auto_create_bucket and not self.client.bucket_exists( it seems it doesn't recognize the host 'minio' this is my docker-compose for minio: minio: image: minio/minio hostname: minio container_name: minio-storage ports: - "9000:9000" - "9001:9001" env_file: - packages/backend/.env environment: MINIO_ROOT_USER: ${MINIO_ROOT_USER} MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PASSWORD} volumes: - minio_data:/data command: server --console-address ":9001" /data Any help would be appreciated! -
Why do the sklearn classifiers not have threshold parameter?
I'm using a sklearn.svm support vector classifier on some dataset with the default parameters: model = SVC().fit(X_train, y_train) This gives me the following precision-recall curve and scores: My understanding of the precision-recall curve is that amog just getting more insight into the model it also helps finding a better threshold based on the specific needs regarding precision or recall. Let's say I wanted to slightly lower the threshold in this example in order to sacrifice precision and get a better recall. Why do the classifiers - SVC in this example - not have a parameter for that so that I can use something like y_pred = model.predict(X_test, threshold=-0.2)? -
Remove relationship from ModelA to ModelB but do NOT remove from ModelB to ModeA in Django ManyToMany Fields
I have a this model structue, ModelA: model_b = models.ManyToManyField( ModelB, blank=True, ) ... ModelB: ... Now I want to delete the relationship from ModelA to ModelB using, model_a.model_b.clear() but I want model_b.model_a_set.all() to still retain the ModelB object. It's kinda I want independent OneToMany and ManyToOne relationship. How can I implement it? PS: In my case ModelB always have relation to a single object of ModelA, if this can reduce the complexity of the implementation. -
Open edX - How to move courses from one environment to another (eg: Prod-Staging-UAT)
I'm looking through the edx documentation but couldn't find a proper direction. So posting this here if someone has already figured this out. So here's my use case: I would like to automate the process of moving the courses from one environment (eg: Production) to another environment (eg: Staging) with all the configurations I made for the course earlier. The goal is to reduce the manual work of course creators. We are currently using the Olive version of open edX and the documentation has not helped me so far, but I'm still going through all the possibilities. Looking forward to some insights! :) TIA -
How to push data from a website to another website
In my Django + Angular web app, I create a job description using a form. Afterward, I need to push the same job description to an external career website of a company. How can I achieve this? -
django.core.exceptions.MultipleObjectsReturned error in Django-Allauth
I'm encountering an issue when trying to access the 'kakao' provider in Django-allauth. (Actually, google has a version issue now so, I want to figure it out kakao first) I have an exception for MultipleObjectsReturned or ObjectDoesNotExist. I have followed the documentation and tried various troubleshooting steps, but the problem persists. Here is the code from my views.py file: def kakao_callback(request): code = request.GET.get("code") print(f"code : {code}") # ---- Access Token Request ---- token_req = requests.get( f"https://kauth.kakao.com/oauth/token?grant_type=authorization_code&client_id={KAKAO_REST_API_KEY}&redirect_uri={KAKAO_REDIRECT_URI}&code={code}" ) token_req_json = token_req.json() error = token_req_json.get("error", None) if error is not None: raise JSONDecodeError(f"Failed to decode JSON: {error}", '{"error": "your_error_message"}', 0) access_token = token_req_json.get("access_token") print(f"access_token : {access_token}") # ---- Email Request ---- profile_request = requests.post( "https://kapi.kakao.com/v2/user/me", headers={"Authorization": f"Bearer {access_token}"}, ) profile_json = profile_request.json() error = profile_json.get("error", None) if error is not None: raise JSONDecodeError("Failed to decode JSON", '{"error": "your_error_message"}', 0) kakao_account = profile_json.get("kakao_account") email = kakao_account.get("email", None) profile = kakao_account.get("profile") nickname = profile.get("nickname") profile_image = profile.get("thumbnail_image_url") # print(email) # ---- Signup or Signin Request ---- try: user = User.objects.get(email=email) social_user = SocialAccount.objects.get(user=user) if social_user is None: return JsonResponse( {"err_msg": "email exists but not kakao social user"}, status=status.HTTP_400_BAD_REQUEST, ) if social_user.provider != "kakao": return JsonResponse( {"err_msg": "no matching social type"}, status=status.HTTP_400_BAD_REQUEST, ) data … -
Django template addition inside {% with %} is not working
I'm populating table with forloop in django template <tbody> {% with total=0 %} {% for inv in row.investmentdetails_set.all %} <tr> <th>{{ inv.investment_type }}</th> <td class="text-center">{{ inv.enterprise }}</td> <td class="text-center">{{ inv.investment }}</td> <td class="text-center">{{ inv.investment_date|date:'Y-m-d' }}</td> <td class="text-center">{{ inv.maturity_date|date:'Y-m-d' }}</td> <td class="text-center">{{ inv.monthly_returns }}</td> <td class="text-center">{{ inv.maturity_status }}</td> </tr> {% with total=total|add:inv.monthly_returns %}{% endwith %} {% endfor %} <tr> <td colspan="7">{{total}}</td> </tr> {% endwith %} </tbody> total always printed 0 i tried {{ total }} between inner with it printed "2000" everytime instead of printing 2000 4000 6000 I'm populating table with forloop in django template <tbody> {% with total=0 %} {% for inv in row.investmentdetails_set.all %} <tr> <th>{{ inv.investment_type }}</th> <td class="text-center">{{ inv.enterprise }}</td> <td class="text-center">{{ inv.investment }}</td> <td class="text-center">{{ inv.investment_date|date:'Y-m-d' }}</td> <td class="text-center">{{ inv.maturity_date|date:'Y-m-d' }}</td> <td class="text-center">{{ inv.monthly_returns }}</td> <td class="text-center">{{ inv.maturity_status }}</td> </tr> {% with total=total|add:inv.monthly_returns %}{% endwith %} {% endfor %} <tr> <td colspan="7">{{total}}</td> </tr> {% endwith %} </tbody> total always printed 0 i tried {{ total }} between inner with it printed "2000" everytime instead of printing 2000 4000 6000 -
Django admin pannel shows empty list on foreignkey dropdown menu
I do have record in my DB, but there is only a search box in the dropdown menu: errorimage When I type in something that is actually not there, it will show "No result found" error2 A js error occured when click on the dropdown: select2.min.js:2 Uncaught TypeError: Cannot read properties of undefined (reading 'call') Code: admin.py class ModelAAdmin(admin.ModelAdmin): model = ModelA admin.site.register(ModelA, ModelAAdmin) Model.py class ModelB(models.Model): id = models.IntegerField(unique=True, primary_key=True) name = models.CharField(max_length=15, null=False) def __str__(self): return self.name class ModelA(models.Model): id = models.IntegerField(unique=True, primary_key=True) name = models.TextField(max_length=15, null=False) link = models.ForeignKey(ModelB, on_delete=models.PROTECT, null=False) def __str__(self): return self.name I've searched for a few hours but I don't find anyone have the same issue as me. What should I do to solve this? -
Create a custom donation button with django-paypal package
I want to create a custom donate button using the django-paypal package. I have created an html page using tailwindcss and alpineJS which allows users to pick from the options or enter their own amount What i am trying to archived is to pass the amount the user selected to be the amount for the PayPAl. So if they choose any of the radio inputs, that should be the amount, Also if they type in an amount that should be the amount. #html <form action="" x-data="{ showOtherAmount: false }"> <div class="flex flex-wrap gap-3"> <label class="cursor-pointer"> <input @click="showOtherAmount=false" type="radio" value="10" class="peer sr-only" name="pricing" /> <div class="w-32 max-w-xl rounded-md bg-white p-5 text-gray-600 ring-2 ring-transparent transition-all hover:shadow peer-checked:text-white peer-checked:ring-blue-400 peer-checked:ring-offset-2 peer-checked:bg-blue-400"> <div class="flex flex-col gap-1"> <div class="flex justify-center items-center flex-col"> <div class="flex"> <span class="text-lg">£</span> <h1 class="py-1">10</h1> </div> <span class="text-xs">GBP</span> </div> </div> </div> </label> <label class="cursor-pointer"> <input @click="showOtherAmount=false" type="radio" value="50"class="peer sr-only" name="pricing" /> <div class="w-32 max-w-xl rounded-md bg-white p-5 text-gray-600 ring-2 ring-transparent transition-all hover:shadow peer-checked:text-white peer-checked:ring-blue-400 peer-checked:ring-offset-2 peer-checked:bg-blue-400"> <div class="flex flex-col gap-1"> <div class="flex justify-center items-center flex-col"> <div class="flex"> <span class="text-lg">£</span> <h1 class="py-1">50</h1> </div> <span class="text-xs">GBP</span> </div> </div> </div> </label> <label class="cursor-pointer"> <input @click="showOtherAmount=false" type="radio" value="100" class="peer sr-only" name="pricing" /> <div class="w-32 max-w-xl rounded-md … -
Running django application on Compute Engine machine and expose it to the internet
I have a Django application that is running on port 8000 on a GCE instance like this: gunicorn --bind 0.0.0.0:8000 AImage.wsgi:application [2024-01-05 03:59:35 +0000] [158846] [INFO] Starting gunicorn 21.2.0 [2024-01-05 03:59:35 +0000] [158846] [INFO] Listening at: http://0.0.0.0:8000 (158846) [2024-01-05 03:59:35 +0000] [158846] [INFO] Using worker: sync [2024-01-05 03:59:35 +0000] [158847] [INFO] Booting worker with pid: 158847 I have created a file here: sudo nano /etc/nginx/sites-available/AImage and created this symlink: sudo ln -s /etc/nginx/sites-available/AImage /etc/nginx/sites-enabled/ with this content: server { listen 80; server_name <GCE IP>; location / { proxy_pass http://0.0.0.0:8000; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; } } and restart nginx service. From what I can tell this should be enough for the app to be accessed through GCE IP on the browser. I can ping GCE IP through console from my local machine just fine, but when I access it through the browser it keeps saying This site can’t be reached.I'm not sure if there's anything else I need to do before it's available. -
WinError 10060 A connection attempt failed because the connected party did not properly respond after a period of time,
[WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond faced error , email verification for user registration in Django it tried some solution and not worked -
Raspbian returns command not found when running sudo daphne
Goal is to run daphne on port 443. When I run the following: sudo daphne -e ssl:443:privateKey=/etc/ssl/mycerts/apache.key:certKey=/etc/ssl/mycerts/apache.pem myProject.asgi:application The following error is generated: sudo: daphne: command not found running which sudo returns /usr/bin/sudo -- sudo is installed. running which daphne returns /home/pi/.local/bin/daphne -- daphne is installed. echo $PATH returns **/home/pi/.local/bin**:/lib/python3.9:/usr/local/sbin:/usr/local/bin:/usr/sbin:**/usr/bin**:/sbin:/bin:/usr/local/games:/usr/games So, both /usr/bin and /home/pi/.local/bin are on the path. I can run daphne on port 8001 (without sudo) without any problems (ex. daphne -b 0.0.0.0 -p 8001 myProject.asgi:application) Why does the error command not found appear if sudo is installed, daphne is installed and both locations are on the PATH? -
Is there a robust way to automatically set update_fields when saving a model?
I've been having some issues with Django model saving and concurrency. It seems unnecessary that every time you call .save() on a model it overwrites every field even if you're only intending to write one field. I can't think of a specific use case for why that would be the default behavior since it is safer for concurrency and more performant to only write the necessary fields. I was thinking about expanding off of this thread to automatically determine which fields have been updated to specify update_fields (if they aren't already specified) accordingly in the save method. Has anyone tried this? Am I overlooking something that will cause other issues? -
Multiple timeseries in TimescaleDB using Django as framework
I'm trying to setup multiple timeseries in timescaledb. The issue comes with different records have the same timestamp, for example from django.db import models from timescale.db.models.models import TimescaleModel from .assets import Asset class TimeseriesData(TimescaleModel): time = models.DateTimeField(primary_key=True) asset = models.ForeignKey(Asset, on_delete=models.CASCADE) close_price = models.DecimalField(max_digits=10, decimal_places=2) volume = models.BigIntegerField() class Meta: unique_together = (('time', 'asset'),) # Create a composite unique constraint I might have different assets with the same time, and timescaledb requires time to be the primary key, so how can I work around this? It feels bad practice to create a new timescalemodel for each asset, is this how timescaledb suppose to be used? I tried adding an id column as a primary key but it fails as timescaledb requires time to be the pk, I'm not sure what else to try. -
Reorganizing a Legacy Django Project with Database Challenges
I'm dealing with a sizable Django project housing crucial data, but the database structure lacks organization, with tables lacking proper relationships and relying on unique IDs. Additionally, the poorly written Django application is shared among three projects. I've been tasked with creating a common central codebase – a Python package installable across all three projects. The goal is to manage common functionality centrally, while keeping application-specific parts separate. The admin panel, shared among the projects, will be moved to this package. However, I'm facing challenges in making the package suitable for all three projects. While the model names are consistent, variations in field structures and the absence of relationship fields pose hurdles. My current plan is to create a new project with a new database, restructuring the existing project. The new application will go live, allowing admins to access the old dashboards for checking legacy data. The plan involves a gradual migration from the old to the new database until the old project can be completely retired. I'd appreciate feedback on this approach or suggestions for alternative strategies. I've opted for a new database to avoid jeopardizing the existing data. What are your thoughts on this plan, and do you … -
How can I use composite primary keys in django?
I want to use composite primary keys in django but I can't find a solution, I tried it in different ways, even trying to make an alter in the table but it won't let me, I want to use it based on this model class Contiene(models.Model): id_boleto = models.OneToOneField("Boleto", primary_key=True, on_delete=models.CASCADE) boleto_cdg = models.CharField(default='', max_length=50) # Asegúrate de que este campo sea opcional num_orden = models.ForeignKey("OrdenCompra", on_delete=models.CASCADE) cantidad_total = models.IntegerField() def generate_random_code(self): numbers = ''.join(random.choices(string.digits, k=12)) # Genera 12 números aleatorios letters = ''.join(random.choices(string.ascii_uppercase, k=3)) # Genera 3 letras aleatorias return numbers + letters def save(self, *args, **kwargs): # Si no se ha proporcionado un boleto_cdg, entonces genera uno automáticamente if not self.boleto_cdg: self.boleto_cdg = self.generate_random_code() # Llamar al método save de la superclase para guardar el objeto super(Contiene, self).save(*args, **kwargs) def __str__(self): return f"{self.id_boleto}{self.num_orden}{self.cantidad_total}{self.boleto_cdg}"` Where num_orden and id_boleto would become composite pk, please help!!! I tried different composite key libraries but it gave errors when migrating -
500 Internal Server Error on Django App Deployment on Render.com
I am encountering a persistent 500 Internal Server Error when trying to deploy my Django project on Render.com. The error message is not providing detailed information, and I am struggling to diagnose the issue. Here's the error log from Render: 127.0.0.1 - - [04/Jan/2024:18:01:36 +0000] "GET / HTTP/1.1" 500 145 "-" The project runs fine locally, but the problem occurs when I deploy it to Render. I have configured my settings.py for production as follows (relevant parts shown): # settings.py import os from pathlib import Path import dj_database_url BASE_DIR = Path(__file__).resolve().parent.parent SECRET_KEY = os.environ.get('SECRET_KEY') DEBUG = False ALLOWED_HOSTS = ['mydomain.com', 'renderproject.onrender.com'] DATABASES = { 'default': dj_database_url.config(default=os.environ.get('DATABASE_URL')) } # Static files settings STATIC_URL = '/static/' STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles') # ...other settings... My requirements.txt includes all the necessary packages like Django, gunicorn, psycopg2-binary, whitenoise, etc. I am looking for suggestions on what could be causing this error and how to resolve it. Any insights or debugging tips would be greatly appreciated! --- [[[enter image description here](https://i.stack.imgur.com/9BAjv.png)](https://i.stack.imgur.com/y3M2C.png)](https://i.stack.imgur.com/XwOKC.png)python, django, deployment, render, http-status-code-500 I have tried deploying my Django application on Render.com, expecting it to run as smoothly as it does on my local development environment. The application functions correctly locally, with all views … -
django field local for every user
How can I create a field that is different for every user. For example if we have an instance of a Comment model and there is a field that is different for every user that tells if user has liked that comment. So when I map through the objects i can just check if a user has liked it. Something like a local field for every user.