Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Django Order By Oldest or Newest with Drop-Down Menu
I am creating a blog project in Django and I have the following Post model: class Post(models.Model): title = models.CharField(max_length=100) content = models.TextField() date_posted = models.DateTimeField(default=timezone.now) author = models.ForeignKey(User, on_delete=models.CASCADE) def __str__(self): return self.title def get_absolute_url(self): return reverse('post-detail', kwargs={'pk': self.pk}) I have a page in which I display all the posts. Currently, posts are listed from newest to oldest. This is the view: class PostListView(ListView): model = Post context_object_name = 'posts' ordering = ['-date_posted'] I would like to allow the human user to order (i.e. sort) the posts by either ascending or descending date_posted. To provide this functionality, at the top of the page in which I list the posts, I would like to provide the user with a drop-down menu with two options: "Newest" and "Oldest". Selecting one of these choices should change the ordering in which the posts are displayed. How do I do this? -
Flask Vs. Django
So I'm working on a project that will put all my skills to the test. Im making my own web app that functions like a social media with direct messaging, posting pictures and videos, accounts, etc. I know HTML,CSS, and a little JS and I know python pretty well at this point. It will all be hosted from a server I have, and will be a website comparable to Facebook or instagram. From my understanding Flask is only backend and will be able to communicate with my databases with Peewee. Django from my understanding seems like a full stack python replacement to HTML and CSS with backend as well. Am I right and which one will be best to use for such a project when I already have something to make the front end with. Please any help is appreciated. -
Django: Logic to execute certain part of a method associated with a URL in views.py, when URL hits 10 times
I am new to Django. My Project (for example) - project/ # project dir (the one which django-admin.py created) myapp/ # my app __init__.py models.py views.py urls.py ... project/ # settings for the project __init__.py settings.py wsgi.py ... My app exposes an URL (lets say), http://127.0.0.1:8000/myapp/ When ever I call the above mentioned URL, this method is invoked in myapp/views.py - def index(request): req_data = some_method_which_does_processing() return render(request, 'myapp/index.html', {'req_data': req_data}) What I want achieve is the following, I don't want "some_method_which_does_processing()" this method to be executed every time when user hits this URL "http://127.0.0.1:8000/myapp/". I want to add a logic wherein this method is called when user hits the above mentioned URL 10 times. I want to know if Django exposes something to cover this specific scenario -
Django (find & replace all) - Choices are: 'Config'. django.core....ImproperlyConfigured: 'adolim.apps' does not contain a class 'AdolimConfig'
I messed something up: I performed find & replace all in PyCharm for the name of my app: From 'adolim' to 'adulim - by mistake I clicked and changed the configuration files too. Now when I want to run anything I'm getting: django.core.exceptions.ImproperlyConfigured: 'adolim.apps' does not contain a class 'adolimConfig'. Choices are: 'Config'. (can't run shell/dbshell eaither) I tried to follow few potential solutions, like this great one about how to update the name app, but anything I do lead me to that Error. also to change settings to: adulim.apps.adulimConfig Any suggestions? (not sure what to attach, added my settings) Thanks. setting.py INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'home.apps.HomeConfig', 'adolim.apps.adolimConfig', ... ] -
Accessing an object in a class of a different django model
From this code from django.db import models class Reporter(models.Model): first_name = models.CharField(max_length=30) last_name = models.CharField(max_length=30) email = models.EmailField() def __str__(self): return "%s %s" % (self.first_name, self.last_name) class Article(models.Model): headline = models.CharField(max_length=100) pub_date = models.DateField() reporter_name = models.ForeignKey(Reporter, on_delete=models.CASCADE) def __str__(self): return self.headline class Meta: ordering = ['headline'] Instead of using ForeignKey to get the entire class Reporter into reporter_name I want to get just the first_name into reporter_name using ForeignKey, Im asking because the I want to use the class in a different model of another app. -
django makemigration throw error on sub app
I created an app inside my application "inventory_management" by django-admin startapp testing The project directory is shown below where emporium_apparel is my main project and testing is my sub app when I run python manage.py makemigrations it gives Traceback (most recent call last): File "manage.py", line 21, in <module> main() File "manage.py", line 17, in main execute_from_command_line(sys.argv) File "C:\Users\mhashirhassan22\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\core\management\__init__.py", line 401, in execute_from_command_line utility.execute() File "C:\Users\mhashirhassan22\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\core\management\__init__.py", line 377, in execute django.setup() File "C:\Users\mhashirhassan22\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\__init__.py", line 24, in setup apps.populate(settings.INSTALLED_APPS) File "C:\Users\mhashirhassan22\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\apps\registry.py", line 91, in populate app_config = AppConfig.create(entry) File "C:\Users\mhashirhassan22\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\apps\config.py", line 90, in create module = import_module(entry) File "C:\Users\mhashirhassan22\AppData\Local\Programs\Python\Python38-32\lib\importlib\__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1014, in _gcd_import File "<frozen importlib._bootstrap>", line 991, in _find_and_load File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked ModuleNotFoundError: No module named 'testing' -
self.assertQuerysetEqual( response.context['latest_question_list'], ['<Question: Past question.>'] )
I encountered this line in the following tutorial self.assertQuerysetEqual( response.context['latest_question_list'], ['<Question: Past question.>'] ) https://docs.djangoproject.com/en/3.0/intro/tutorial05/ ['<Question: Past question.>'] Where is this snippet from? I understand that response.context['latest_question_list'] returns a list of objects. Why is it being compared to ['<Question: Past question.>']? -
Django Rest framework URL filtering on a custom field
I am new to Django Rest Framework and struggling for a while now. { "count": 1865, "next": "http://localhost:8000/start_scan/api/scanHistory/?page=2", "previous": null, "results": [ { "id": 1, "subdomain": "hello.example.com", "open_ports": "", "http_status": 0, "content_length": 0, "page_title": "", "http_url": "", "ip_address": "", "screenshot_path": null, "http_header_path": null, "technology_stack": null, "scan_history": 65 }, { "id": 2, "subdomain": "new.example.com", "open_ports": "", "http_status": 0, "content_length": 0, "page_title": "", "http_url": "", "ip_address": "", "screenshot_path": null, "http_header_path": null, "technology_stack": null, "scan_history": 65 }]} In this API endpoint http://localhost:8000/start_scan/api/scanHistory/1 or http://localhost:8000/start_scan/api/scanHistory/2, I can see the individual results. I understand currently when I visit http://localhost:8000/start_scan/api/scanHistory/2 I am able to see the items with ID 1. However, I would like to fetch all the results that have scan_history as 65 something like this http://localhost:8000/start_scan/api/scanHistory/65 I tried using slug, I think it is not the right thing to use because slug only returned 1 object. The scan_history may have multiple objects. How is it possible to change this to filter scan_history rather than id by default? My serializer.py class ScanHistorySerializer(serializers.ModelSerializer): class Meta: model = ScannedHost fields = '__all__' My views.py class ScanHistoryViewSet(viewsets.ModelViewSet): queryset = ScannedHost.objects.all() serializer_class = ScanHistorySerializer Urls.py router = routers.DefaultRouter() router.register(r'scanHistory', ScanHistoryViewSet) urlpatterns = [ url('^', include(router.urls)) ] urlpatterns += router.urls -
Testing Django settings behavior with unittest and Python
Would someone please help me test the import behavior of Django settings? I'm having trouble reproducing the same behavior that from my_project.app import settings creates on init. My tests look like, import importlib import logging import os import sys from unittest import mock from django.test import TestCase from my_project.app.config import settings all_settings = [ 'my_project.app.config.shared_settings', 'my_project.app.config.local_settings', ..., ] def remove_old_settings(): importlib.invalidate_caches() for setting in all_settings: try: del sys.modules[setting] except KeyError: pass class DjangoSettingsTestCase(TestCase): def setUpClass(): logging.disable(logging.CRITICAL) remove_old_settings() importlib.reload(settings) def tearDownClass(): remove_old_settings() importlib.reload(settings) logging.disable(logging.NOTSET) def get_settings_with_env(self, env): environ_keys = [ 'DJANGO_ENV', 'django_deployment', 'DATABASES', 'CACHES', 'ALLOWED_HOSTS', 'DEBUG', 'STATIC_URL', 'CORS_ORIGIN_ALLOW_ALL', ] with mock.patch.dict('os.environ', env, clear=True): globals()['settings'] = importlib.reload(settings) values = { key: getattr(settings, key) for key in environ_keys } return values def test_settings_django_env_localhost(self): mocked_settings = self.get_settings_with_env({}) self.assertEqual(mocked_settings['django_deployment'], 'localhost') mocked_settings = self.get_settings_with_env({'DJANGO_ENV': 'localhost'}) self.assertDjangoEnv(mocked_settings['django_deployment'], 'localhost') self.assertDictEqual( mocked_settings['DATABASES'], { 'default': { ... } } ) self.assertEqual(mocked_settings['CORS_ORIGIN_ALLOW_ALL'], True) self.assertDictEqual( mocked_settings['CACHES'], {'default': {'BACKEND': 'django.core.cache.backends.dummy.DummyCache'}} ) self.assertListEqual(mocked_settings['ALLOWED_HOSTS'], ['*']) self.assertEqual(mocked_settings['DEBUG'], True) self.assertEqual(mocked_settings['STATIC_URL'], '/static/') (and many more tests) These tests usually pass but sometimes they don't. I've tried so many ways to import these files, but I'm at my wits end with different failures. As you can see from the crazy stuff I'm trying (deleting from sys.modules and globals) I'm … -
Dotenv Doesn't Handle Multiple Hosts in ALLOWED_HOSTS
In my production setting.py file I have: DEBUG = os.getenv('DEBUG') #ALLOWED_HOSTS = os.getenv("ALLOWED_HOSTS") ALLOWED_HOSTS = ['example.com', 'www.example.com'] In my .env file in production, I have DEBUG=False ALLOWED_HOSTS=['www.example.com', 'example.com'] If I switch the commented out line in settings, I get an error saying url may not be in the allowed hosts. I have a number of other definitions in the .env file that work fine although I'm not sure about debug. I've tried all sorts of combinations on the ALLOWED_HOSTS and get the same error. In development I have: ALLOWED_HOSTS='localhost' That setting works fine. Any idea what I'm doing wrong? -
SIM800L HTTP POST Request- 601 Error code
I am trying to send a simple HTTP post request from my SIM800L module (version 2), using the built in at commands. The post request should send sensor data to my server running on Django. I have managed to set everything up but I receive a 601 error (possible network connection issues) upon the AT+HTTPACTION=1 command (post request session start). Here are my steps from the beginning. Initializing... AT OK AT+CSQ +CSQ: 30,0 OK AT+CREG? +CREG: 0,5 OK AT+CMEE=2 OK AT+COPS? +COPS: 0,0,"T-Mobile" OK AT+CGDCONT? +CGDCONT: 1,"IP","hologram.io","0.0.0.0",0,0 +CGAT+SAPBR=3,1,"CONTYPE","GPRS" OK AT+SAPBR=3,1,"APN","hologram" OK AT+SAPBR=1,1 OK AT+SAPBR=2,1 +SAPBR: 1,1,"network_provider_IP" OK AT+HTTPINIT OK AT+HTTPPARA="CID",1 OK AT+HTTPPARA="URL","http://public_IP:8000/first_app/" OK AT+HTTPDATA=14,10000 DOWNLOAD OK AT+HTTPACTION=1 OK +HTTPACTION: 1,601,0 AT+HTTPREAD OK AT+CGDCONT? +CGDCONT: 1,"IP","hologram.io","0.0.0.0",0,0 AT+CGATT? +CGATT: 1 OK AT+CGACT=1,1 +CME ERROR: unknown I have found the following sites to be of great help but only up to a certain point: LINK 1 https://m2msupport.net/m2msupport/at-command-for-http-functions-for-remote-server-data-access/ LINK 2 https://m2msupport.net/m2msupport/data-call-at-commands-to-set-up-gprsedgeumtslte-data-call/ The first one describes the steps needed for http requests. It mentioned that 601 error might be a result of incorrect PDP (packet data protocol) settings. The second link describes how to remedy that problem. BUT, when I come to activate the PDP context I get an other error: AT+CGACT=1,1 +CMEE: Unknown Error … -
Response from DRF has no statusText when using CloudFlare
I came across a very weird situation when using django rest framework and cloudflare. When using cloudflare dns service I get no statusText in the responses from my server. For example, if I would normally do a get request to /books I would get: {data: {…}, status: 200, statusText: "OK", headers: {…}, config:{}...} After moving to cloudflare now I get this: {data: {…}, status: 200, statusText: "", headers: {…}, config:{}...} Does anyone know why this happens? Thanks -
render multiple context dictionaries to same template in Django
I am working on making a Dashboard using the Django framework. It has multiple charts and other widgets which fetch data from the database for which I need to create multiple views. How do I render data from multiple views as a context dictionary to the same template? I am able to get data from one function, but it doesn't work for the rest. What could be the workaround for this? -
Guidelines for using Wagtail Pages or Django models?
For example, I want to build an ecommerce website using wagtail, one component is order. I think order should not wagtail Page, but simple Django model, see code below. from django.db import models from wagtail.admin.edit_handlers import ( FieldPanel, StreamFieldPanel, MultiFieldPanel, InlinePanel, ) from wagtail.core.fields import RichTextField from wagtail.core.models import Page # Since product details are shown to users, so need to have a Page for it. class XyzProductPage(Page): template = "product/product_page.html" name = models.CharField(max_length=100) desc = RichTextField(blank=False, null=True) content_panels = Page.content_panels + [ FieldPanel("name"), FieldPanel("desc"), ] class XyzOrderedProduct(models.Model): product = models.ForeignKey( "XyzProductPage", on_delete=models.CASCADE, related_name="+" ) order = models.ForeignKey( "XyzOrder", on_delete=models.CASCADE, related_name="ordered_products" ) # Orders are not shown to users, only for internal use, so use Django model class XyzOrder(models.Model): panels = [ # and per each order, I want to display all ordered products on wagtail admin UI, # so I try to use this MultiFieldPanel, but doesn't seem to work, why? MultiFieldPanel( [InlinePanel("ordered_products", label="Ordered Product",)], heading="Ordered Product(s)", ), ] I also defined ModelAdmin for the above Django models, so I can see them on wagtail admin UI. The questions I have are When to use wagtail Page model, when to use Django model? In the above example, orders are … -
getting valueerror even after handling the error in django while creating the todo for a todo project
views.py @login_required(login_url='/login/') def blogcreate(request): if request.method =="GET": return render(request,'blogcreate.html',{'form': BlogForm()}) else: try: form = BlogForm(request.POST) if form.is_valid(): obj = form.save(commit=False) obj.user = request.user obj.save() return redirect('blogsview') except ValueError: return render(request,'blogcreate.html',{'form': BlogForm(), 'error': 'Word Limit Exceeded!'}) url path('blogcreate/',views.blogcreate, name='blogcreate'), -
mysql error in time zone , Database returned an invalid datetime value
i tried to TruncDay in django to turn date into day format , i use mysql version 8.0 this my settings.py TIME_ZONE = 'UTC' USE_I18N = True USE_L10N = True USE_TZ = True date = models.DateTimeField(auto_now_add=True) MyModel.objects.annotate(day=TruncDay('date'))#others and i tried to run mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root mysql; but it raise this error while i run this command in mysql shell ERROR: 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root mysql' at line 1 and also my django project raise this error also Database returned an invalid datetime value. Are time zone definitions for your database installed? -
Data mask and other HTML features are not applying on input field with Django Forms
I am using Django forms to apply some basic html feature such as data mask and input pattern. Below is the code on the forms.py for one of the input fields. 'contact_person' : forms.TextInput( attrs={'class':'form-control capitalize','pattern':'[a-zA-Z]*'}), or data mask 'primary_phone_no' : forms.TextInput( attrs={'class':'form-control','data-mask':"000 000 000"}), Once I make the changes and see the changes on the browser, inspect element and locate that field, I can clearly see the changes had been applied on the HTML but when I put the input I see no changes has taken place. Means nor of the feature such as datamask or pattern is happening. Its a very strange thing I am facing. Did someone came across this and is there something am I missing? Thank you -
Creating Groups and Modifying View Access Django
I am building a web app using Django 3.0.7 and Python 3.8 that will use some business intelligence tool, like Tableau or Power BI, as a reporting source. There is absolutely no issue with the code I am using, however I need to be able to reduce visibility to certain pages, based on a created group. For example: If I have three pages/dashboards: 127.0.0.1:8000/director/report1, 127.0.0.1:8000/manager/report2, 127.0.0.1:8000/employee/report3 and I have three users: Director, Manager, Employee How can I create the site in such a way that when a user registers to the site, their profile is created and subsequently assigned a group THEN restrict access to certain pages based on the user group (this would be easier than assigning permission to every user). For example: The user Director would belong to a group called, directors, and would have access to 127.0.0.1:8000/director/report1, 127.0.0.1:8000/manager/report2, 127.0.0.1:8000/employee/report3. The user Manager would belong to a group called, managers, and have access to 127.0.0.1:8000/manager/report2, 127.0.0.1:8000/employee/report3. The user Employee would belong to a group called, employees, and have access to 127.0.0.1:8000/employee/report3. I found some information related to permissions here: https://docs.djangoproject.com/en/2.1/_modules/django/contrib/auth/decorators/ but I cannot find information related to creating groups AND assigning permissions. -
Django filter a form field based on previous field
I need to filter a form data based on another field selection in Django. I have 3 models Task Type Task Type class TaskType(models.Model): task_type = models.CharField(max_length=30) def __str__(self): return '%s' % (self.task_type) class Meta(): db_table = 'Task Type' Tasks class TaskMaster(models.Model): task_name = models.CharField(max_length=100) est_days = models.IntegerField() task_type = models.ForeignKey(TaskType, on_delete=models.CASCADE,related_name='TaskMaster_task_type', db_column='task_type') def __str__(self): return '%s' % (self.task_name) class Meta(): db_table = 'Task Master' Daily entry class DailyEntry(models.Model): date = models.DateField() task_type = models.ForeignKey(TaskType, on_delete=models.CASCADE, related_name='DailyEntry_created_by', db_column='task_type') task_name = models.ForeignKey(TaskMaster, on_delete=models.CASCADE, related_name='DailyEntry_created_by', db_column='task') class Meta(): db_table = 'Daily Entry' I have created a forms.py file for Daily Entry form class DailyEntryForm(forms.ModelForm): class Meta: model = DailyEntry fields = ['date', 'task_type', 'task_name'] labels = { 'date': 'Date', 'task_type': 'Task Type', 'task_name': 'Task' } Now how can I filter Task field based on the selections in Task Type as per user selection? enter image description here -
Django admin return 404 when upload image on server deploy
I am trying to upload an image or update a model image field by the django admin, and at the time of post, this restores me a 404. I also tried that it does not matter if I load the field with a selected image or not, always returns 404 if the model has an image field in my local this is not happening and when I upload it from any other view created outside the admin it works perfectly. If anyone has an idea of what is happening, I leave you part of my configuration and other data host server: namecheap (sharedserver) Settings MIDDLEWARE = [ 'whitenoise.middleware.WhiteNoiseMiddleware', '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', ] STATIC_DIR = os.path.join(BASE_DIR, 'static') STATIC_ROOT = os.path.join(BASE_DIR, 'static-server') STATIC_URL = '/static/' STATICFILES_DIRS = [ os.path.join(BASE_DIR, 'static'), ] STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage' # Media folder for database media MEDIA_URL = '/media/' MEDIA_ROOT = os.path.join(BASE_DIR, 'media/') Model class Product(models.Model): name = models.CharField(max_length=50) descrip = models.CharField(max_length=50) brand = models.ManyToManyField('Brand', null=True, blank=True) provider = models.ManyToManyField('Provider', null=True, blank=True) packing = models.CharField(max_length=10, null=True, blank=True) units = models.CharField(max_length=50, null=True, blank=True) category = models.ForeignKey('Category', on_delete=models.SET_NULL,null=True, blank=True) produc_pic = models.ImageField(default = '',null=True, blank=True) produc_pic_url = models.CharField(max_length=500,null=True, blank=True) line = models.ForeignKey('Line', on_delete=models.SET_NULL,null=True, blank=True) def __str__(self): … -
display product variation templates
hello I'm trying to build an ecommerce site with products which have variations. I already have the model for the product variations but I'm having trouble displaying it in my product detail template. The idea is to change all the data according to its corresponding variation and then to recognize the currently displayed data in order to add to cart. I am not sure if this is the correct approach but I was using bootstrap 4.1.1 nav tabs for the variation which is color and change the data with the corresponding tab-content. However, the data to be changed is all over the template and not inside one single div as you can see. I have tried to use multiple tab-content and activate them with data-target attribute but it doesnt seem to be working, it just recognizes the first tab-content it finds. For instance, right now it only activates the {{itemvar}}photo tab-pane but if I erased that id from data-target then the {{itemvar}}color would start working. How can I iterate through all the colors of my products and display the corresponding data of the selected color such as image, value, stock, etc? Can anyone help me? I apologize if this is … -
django jsonField filtering to get list of values from a specified key
I am storing millions of jsonFields as a field in my django model with the following structure: for object #1: { "key_1": value1 } for object #2: { "key_1": value2 } and so on... How can I get an array of the values for key 1 simply through filtering? [value1, value2...] -
i want two models each having manytomany field referening to other
I want males to have manytomany field to females and same with females and the problem arises here that u can only reference models created before the model u are referencing them in ` class Male(models.Model): name = models.CharField(null=True,blank=True, max_length=300) age = models.IntegerField(null=True,blank=True) d_O_b = models.DateField(null=True,blank=True) description = models.CharField(null=True,blank=True, max_length=300) #swipes = models.ManyToManyField(Females) def __str__(self): return self.name class Female(models.Model): name = models.CharField(null=True,blank=True, max_length=300) age = models.IntegerField(null=True,blank=True) d_O_b = models.DateField(null=True,blank=True) description = models.CharField(null=True,blank=True, max_length=300) swipes = models.ManyToManyField(Male) def __str__(self): return self.name class Male(models.Model): _inherit = 'Male' swipes = models.ManyToManyField(Female) ` -
Django: An error occurred (InvalidArgument) when calling the PutObject operation: None
I was trying to upload profile image to AWS S3. IAM role is having AWSS3FullAccess Policy attached and using boto3 client. Don't know why it is throwing this error. I have written CORS Permissions to my bucket and allowing * hosts. Can Anyone facing the same issue..? -
How to Access Current User from Django to React?
I am developing a system where a user logs in and they can use the features of our service. We have used Django Authentication to make the User and Login backend. This is the custom User model in my models.py - class UserDef(AbstractUser): def __str__(self): return self.first_name + self.last_name employeeId = models.IntegerField(unique=True) email_address = models.EmailField() first_name = models.CharField(max_length=256) last_name = models.CharField(max_length=256) USER_TYPES = [('1',"Admin"), ('2',"Director"), ('3',"Sr. Manager"), ('4',"Manager") , ('5',"Sr. Engineer"), ('6',"Assistant Regional Manager"), ('7',"Assistant to the Regional Manager")] user_type = models.CharField(max_length=2048, choices=USER_TYPES) created_at = models.DateTimeField(auto_now_add=True) This in itself works really well and I was able to access all data as needed. I am writing my front-end in React though. Which means there's a certain disconnect between the templates html file and the actual React.js code. Which means I can't simply send the employeeId or some other attribute as context. Does anyone know how I can extract that User information from the Django DB (which we have connected to an RDS-MySQL server) and display it in my React app.