Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
How to return a 404 for just django allauth signup page?
I am rather new to django and all of the work I have done so far has been with models/views/viewsets.. The site I am working on incorporates django allauth for authentication. I have successfully edited/styled the login/logout templates, but the page will be accessed by people who are given credentials created in the admin section rather than signing up on their own- so the sign up page is unnecessary. I'd like to just show a 404 page anytime someone lands on the signup page. I have already removed all the links to the signup page from the other templates. In short- how do I just redirect someone to the django default page_not_found when they hit /accounts/signup/? My attempts so far have revolved around editing the urls.py file to include something like path('account_signup', page_not_found) (after importing it at the top), or some other manipulation of that line. I'm probably missing something really easy, as I have been getting a little frustrated... and I haven't found any stack overflows where someone was desiring a 404 when a user navigated to one of the allauth account pages. -
How do I make my mobile app run queries and retrieve data from an external SQLite database?
I have a web application that currently stores data on a SQLite database stored locally on my pc and is accessed through a "python manage.py" localhost server using the Django framework. All my queries are operational, written in python, and produce the desired results, now I am working on a mobile version of my web app on android studio and would like to retrieve the same data. Upon searching stack, I came across possible solutions to what I am trying to do but they all seem to cater for PHP programmers and not Python. At the moment I am using Firebase but I don't want to restart the whole database from scratch using a new technology, and I am also not very good at using NoSQL databases. I am also aware of the built in SQL feature for android but as I'm sure you've already guessed, I would like one central database that is changed once and all data is presented on both the mobile app and web app. -
Is It possible to add permissions to specific url in Django
I am using IsAuthenticated permission by default and let's say I do not want to change the default permission. Is it possible to give permission of AllowAny to a specific URL? urlpatterns = [ path('admin/', admin.site.urls), path('api/', include('user.urls')), path('api/section/', include('section.urls')), path('docs/', include_docs_urls(title='Great Soft Uz')) # I want this url to be public ] Thanks in Advance -
How to refer childtables foreignkey to his parenttable where parenttable calls instance from the logged (company)user in Django
Creating job object out of the class Job(models.Model) for the logged company is working. When I save the form, its refers the id of the object to the specific company. Problem is : Creating object with the chiltable is working but doesn't link it to the specific instance of company. How can I refer it to the same instance as the Job class? Please help me out guys.. Model.py class Job(models.Model): objects = CompanyProfile() user = models.ForeignKey(CompanyProfile, on_delete=models.CASCADE) title = models.CharField(max_length=300) description = models.TextField() compensation = models.IntegerField() last_date = models.DateTimeField(null=True, blank=True) contact_person = models.CharField(max_length=30) contact_person_image = models.FileField(upload_to=job_contact_person_path, blank=True) created_at = models.DateTimeField(default=timezone.now, blank=True) is_active = models.BooleanField(default=True) address = models.CharField(max_length=100, null=True) zip_code = models.CharField(max_length=10, null=True) city = models.CharField(max_length=30, null=True) phone_number = models.CharField(max_length=30, null=True) contact_person_email = models.EmailField(null=True) class JobFunction(models.Model): objects = Job() job = models.ForeignKey(Job, on_delete=models.CASCADE, null=True, related_name='jobfunctions') name = models.CharField(max_length=60) class InternType(models.Model): objects = Job() job = models.ForeignKey(Job, on_delete=models.CASCADE, null=True, related_name='interntypes') name = models.CharField(max_length=30) Forms.py class JobAddForm(forms.ModelForm): class Meta: model = Job fields = ( 'title', 'description', 'compensation', 'contact_person', 'contact_person_image', 'created_at', 'is_active', 'address', 'zip_code', 'phone_number', 'city', 'contact_person_email' ) labels = { 'description': '', 'contact_person': 'Contactpersoon', 'compensation': 'compensatie', 'title': 'titel', 'is_active': 'Vacature is actief', 'address': 'Adres', 'zip_code': 'Postcode', 'phone_number': 'Telefoonnummer', 'city': 'Stad', 'contact_person_image': … -
Apache configuration to display Leaflet maps in Django
I have made a project in Django using PyCharms and OSGEO libraries. I want to deploy it but i don't know how i can configure the apache httpd.conf or a virtual host to display leaflet maps. If someone can give me some suggestion i appreciate it. -
Jquery: capture option selected returns not defined instead
I need to capture the selected user option and send that value in a post request. I'm using Django as my backend. STEPS: 1) Add Product: Opens modal with a list of options. 2) Need to capture selected option. I've this JS, but lista_id, the value I need to capture, appears as undifined. Why? I've tried to set this as a global variable. In the JS, you'll see an alert, this alerts undefined for lista_id JS: <script> $("#agregarProducto{{ product.id }}").click(function () { var lista_id; $('#listas-de-usuario').change(function() { var lista_id = $(this).find('option:selected').val(); }); alert(lista_id); $.post("{% url 'lists:add_product_to_list' %}", { c_slug: "{{ product.category.slug }}", s_slug: "{{ product.subcategory.slug }}", product_slug: "{{ product.slug }}", lista_id: lista_id, }); }); </script> I've tried to make a codepen, but it keeps saying: Uncaught TypeError: $(...).modal is not a function When trying to make the modal to show/pop up. I had made sure Jquery, Boostrap and Popper are "installed" in CodePen. https://codepen.io/ogonzales/pen/yLyQQaP -
Django Python Shell Query All Objects Issue with Decimal
I am storing auction items and my app runs successfully in the browser-meaning all the auction items I have created are displaying with the correct start and end dates. And those start and end dates are being stored as DateTimeFields, and what is being stored is a datetime object using datetime.now() which does includes the microseconds. As in: 2020-01-20 14:06:22.398123 In the python console, I run the following: from auctionitem.models import AuctionItem AuctionItems.objects.all() I get a nasty error about an invalid decimal operation: Traceback (most recent call last): File "<console>", line 1, in <module> File "C:\Users\Sir Chris Mazzochi\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\db\models\query.py", line 252, in __repr__ data = list(self[:REPR_OUTPUT_SIZE + 1]) File "C:\Users\Sir Chris Mazzochi\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\db\models\query.py", line 258, in __len__ self._fetch_all() File "C:\Users\Sir Chris Mazzochi\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\db\models\query.py", line 1261, in _fetch_all self._result_cache = list(self._iterable_class(self)) File "C:\Users\Sir Chris Mazzochi\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\db\models\query.py", line 74, in __iter__ for row in compiler.results_iter(results): File "C:\Users\Sir Chris Mazzochi\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\db\models\sql\compiler.py", line 1081, in apply_converters value = converter(value, expression, connection) File "C:\Users\Sir Chris Mazzochi\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\db\backends\sqlite3\operations.py", line 286, in converter return create_decimal(value).quantize(quantize_value, context=expression.output_field.context) decimal.InvalidOperation: [<class 'decimal.InvalidOperation'>] I'm wondering if the decimal this error is referring to is the one in that datetime object with the microseconds appended with a 'dot', '.', ...is this here where my error is? Do I … -
How to increment & decrements values in django templete based on condition
Hi I'm new in django I have counter=0 in for loop based on condition I need to increment or decrements that value {{ variable|add='1' }} I try to use this but after 1st time increment the value remain constant for all the iteration of the loop I also see that some people use custom tag & filter but I'm not able to understand that how it will work and how can I made my custom tag Is there is someone who can help me to make my custom tag of increment & decrements or help me to solve my issue my_code {% for i in posts %} {% if counter == i %} .... .... .... {{ counter |add='1' }} {% endif %} {% endfor %} -
Django - Update operation on nester serialized object (Many to Many)
I want to update a nester serializer field, below example i want to update the field teacher_date Here is my patch call with data { "user": { "pk": 2, "username": "rayees", "email": "rayees.xxxx@xxxx.co.in", "first_name": "Rayees", "last_name": "xxxxx", "user_type": "Teacher" }, "first_name": "Rayees", "last_name": "xxxx", "bio": "TEST BIO", "teacher_cost": "22.00", "subject": [ "HINDI", "ENGLISH" ], "teacher_date": [ { "day_available": "MON", "time_available": "Morning" }, { "day_available": "SUN", "time_available": "Morning" } ], "cities": [ "SANTA CLARA", "SUNNYVALE" ] } In this example everything get updated except teacher_date Model.py class Availability(models.Model): uid = models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True) MONDAY = 'MON' TUESDAY = 'TUE' WEDNESDAY = "WED" THURSDAY = "THU" FRIDAY = 'FRI' SATURDAY = "SAT" SUNDAY = "SUN" DAY = ( (MONDAY, 'Monday'), (TUESDAY, 'Tuesday'), (WEDNESDAY, 'Wednesday'), (THURSDAY, 'Thursday'), (FRIDAY, 'Friday'), (SATURDAY, 'Saturday'), (SUNDAY, 'Sunday'), ) day_available = models.CharField( max_length=3, choices=DAY, default=MONDAY) MORNING = 'Morning' NOON = 'AfterNoon' EVENING = 'Evening' TIME = ( (MORNING, 'Morning'), (NOON, 'Afternoon'), (EVENING, 'Evening'), ) time_available = models.CharField( max_length=30, choices=TIME, default=MORNING) def __str__(self): return f"{self.day_available} {self.time_available}" class Teacher(models.Model): uid = models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True) user = models.OneToOneField(User, on_delete=models.CASCADE) bio = models.TextField(null=True, blank=True) teacher_cost = models.DecimalField( max_digits=5, decimal_places=2, null=True, blank=True) languages = models.CharField( max_length=50, null=True, blank=True) subject = models.ManyToManyField('Subject') … -
Display a timestamp with timezone in Django admin
I have a model with a timezone-aware DateTimeField. Each object may use a different timezone. I'd like Django Admin to display this field with the timezone suffix (EST, etc.), not in the user's or server's local time. I don't want to globally modify my project's timezone localization settings. This should apply only to this one field. This question touches on something similar, but I am skeptical of the solution; it activates a new timezone when the object class is initialized, which does not allow changing the timezone per-row, and affects other timestamps that are not the particular field I'm interested in. -
Get Primary key id with Column filter in Django ORM
I have a table books in my Postgresql. The below image is how the table structure looks. Now, I have the book_name "249", and I want to get its corresponding primary key which is 5. Below is the query I am trying to do but Django is throwing an error. my_book_name = 249 books.model.filter(book_name=my_book_name).get('book_id') # Not Working Can someone please suggest the right ORM query for getting the corresponding book_id for book_name? Note:- I deleted PK=4 which is why it's missing in the Column. -
Dockerizing Django with Postgres, Gunicorn and Nginx
I'm new to DevOps world and I'm completely lost and confused. Well, I wanna make a Django app with Postgres database and with Gunicorn and Nginx but I wanna dockerize everything. I know that Django has venv, this virtual environment for development so I'm wondering whether I should use that on my local machine or just configure Gunicorn and Nginx and use exactly the same images and environments on development and production so that also means that there's only one .env file. Is it a good solution? Because I don't want to use venv on production. -
Django and React as an offline application. Your opinion
I need to write a gui in python for an offline application that needs to execute some code which requires user permissions. The command line tool is ready, however upon looking at possible frameworks for developing a GUI, I tried Pyqt5 and it simply bad. (I also do not want to learn how to use it properly due to time constraints). I am adept with Django and React so I was wondering on your thoughts of building an offline app which runs the npm server and Django server to serve the React app in the browser whilst executing any necessary python code on the users machine with python. Has this been done? is it safe? what are the possible issues with doing this. I'm assuming I can run a script to open a browser session on localhost and make it look like our app opened. -
Django static file serving in conflict with React Router
My website uses Django as backend and React.js as frontend. Frontend are compiled with react-scripts build so that Django backend can serve it as static files. When running the web app with 'python manage.py runserver', I am faced with the following issue: The website serve just find for the root url 'http:localhost:8000/'. However, if I want to go to a suburl 'http://localhost:8000/team/'. Backend fails to load all the static files. Log from backend looks like the following: [20/Jan/2020 20:23:43] "GET /team/static/media/%E8%82%96%E8%8A%B7%E7%8E%A5.93cb5dfd.jpg HTTP/1.1" 200 3137 [20/Jan/2020 20:23:43] "GET /team/static/media/%E6%9D%8E%E4%B8%80%E5%87%A1.e74fa446.jpg HTTP/1.1" 200 3137 [20/Jan/2020 20:23:43] "GET /team/static/media/%E9%83%87%E5%AE%87%E6%AC%A3.af12f28b.jpg HTTP/1.1" 200 3137 [20/Jan/2020 20:23:43] "GET /team/static/media/%E9%AB%98%E8%AF%97%E5%85%83.ff52ce19.jpg HTTP/1.1" 200 3137 [20/Jan/2020 20:23:43] "GET /team/static/media/%E8%83%A1%E6%B7%87%E5%AA%9B.88f0c659.jpg HTTP/1.1" 200 3137 [20/Jan/2020 20:23:43] "GET /team/static/media/%E7%8E%8B%E9%80%B8%E5%87%A1.4fe694ba.jpg HTTP/1.1" 200 3137 [20/Jan/2020 20:23:43] "GET /team/static/media/%E8%B4%BA%E9%80%B8%E6%83%9F.e77dedac.jpg HTTP/1.1" 200 3137 Django automatically append '/team/' in front of '/static/' so all the files originally located in '/static/' could not be found and rendered. This is very tricky and I can not find any solutions online. Here is my urls.py: from django.contrib import admin from django.urls import path, include, re_path from django.conf import settings from django.conf.urls.static import static from django.views.static import serve from .views import index urlpatterns = [ path('', index, name='index'), re_path(r'^.*$', index), ] where … -
how can I have a timer in our poll question? Django
we have a set of poll questions with a max of 20 questions in the poll, but we will be able to pick up max 5 random questions, and one per stage, but I don't want people to be able to cheat time by just validating client-side, but each question has a time of 1 minute once it expires the next one will be . models import datetime from django.db import models from django.utils import timezone class Question(models.Model): question_text = models.CharField(max_length=200) duration = models.IntegerField(min=0, max=60) code = models.TextField(max_length=1024*2,default='SOME STRING') def __str__(self): return self.question_text def was_published_recently(self): now = timezone.now() return now - datetime.timedelta(days=1) <= self.pub_date <= now def choices(self): if not hasattr(self, '_choices'): self._choices = self.choice_set.all() return self._choices def max_voted_choice(self): if not hasattr(self, '_max_voted_choice'): choices = self.choice_set.order_by('-votes') if not choices: self._max_voted_choice = None else: self._max_voted_choice = choices[0] return self._max_voted_choice class Choice(models.Model): question = models.ForeignKey(Question, on_delete=models.CASCADE) choice_text = models.CharField(max_length=200) votes = models.IntegerField(default=0) def __str__(self): return self.choice_text apiviews get random questios from the poll from django.shortcuts import get_object_or_404 from rest_framework.decorators import api_view from rest_framework.response import Response from rest_framework import status from .models import Question, Choice from .serializers import QuestionListPageSerializer, QuestionDetailPageSerializer, ChoiceSerializer, VoteSerializer, QuestionResultPageSerializer import random @api_view(['GET', 'POST']) def questions_view(request): if request.method == 'GET': … -
Get the count of how many models contain a child model with an integer greater than 1
class Company(models.Model): company = models.CharField(max_length=30, unique=True) create_date = models.DateTimeField(default=now, editable=False) class GroupAssessment(models.Model): company = models.ForeignKey(Company, on_delete=models.CASCADE, related_name='group_assessments') placibo_drug = models.CharField(max_length=10, blank=True) class UserAssessment(models.Model): group_assessment = models.ForeignKey(GroupAssessment, on_delete=models.CASCADE, related_name='user_assessments') risk = models.IntegerField() I'm trying to get the count of how many GroupAssessments have UserAssessmet risk that's greater than or equal to 1. I'm able to get the count of how many users contain it with the following: UserAssessment.objects.filter(group_assessment__company__company='Apple', risk__gte=1).count() but unsure how I would get the count of how many GroupAssessment contain a user with a risk greater or equal to 1. -
Do actions on database object in Django Template
Sorry for newbie question, but i'm not very familiar yet with Django. What will be the best solution for this situation? Let's say i have model class like this: class ExampleItem(models.Model) name = models.TextField() ... #etc... and a profile model which is linked to Auth.User class Profile(models.Model): user = models.OneToOneField(settings.AUTH_USER_MODEL, on_delete=models.CASCADE) example_items = models.ManyToManyField(ExampleItem, related_name="items") I have a example_item_details View, which passes ExampleItem data to template. def example_item_details(request, id): example_item = get_object_or_404(ExampleItem, id=id) return render(request, 'website/example_item_details.html', {'example_item': example_item}) in template i have a code which checks if example_item is added to manytomanyfield of profile example_items field. In my template i have this code: {% if request.user|check_if_item_is_user:example_item %} <div class="button"> Already Added </div> {% else %} <div class="button"> Add Item to your account </div> {% endif %} I want to add "example_item" to "request.user.profile.example_items" on click on "Add Item to your account" or delete "example_item" from "request.user.profile.example_items" on click on "Already Item button" and reload page. How can i do that without ? -
Customising widget for GroupedModelChoiceField to use Live Search
This is a fairly big ask. I'm using GroupedModelChoiceField in my forms.py. This is a common custom field that is the same as ModelChoiceField but it puts the into . It requires two models where one is the parent and is used to creste the . It's very useful. Full details of GroupedModelChoiceField here. This is how I create the form field: Forms.py: ledger = GroupedModelChoiceField(required=False, queryset=Ledger.objects.all(), choices_groupby = 'Category', empty_label="Please choose..") My aim is to create a Live Search select widget. I found a Bootstrap based live search and I'm currently having to render it manually in my HTML templates. It works fine but can I put it into a custom widget so that it's easier to re-use? Below is my HTML that would need to go into the custom widget. I've spent some time trying to dothis myself but the field isn't exactly simple, so it's beyond my skills. template.html <select data-width="fit" class="selectpicker form-control ml-1 mb-2 mr-sm-2" data-live-search="true" name="expense" required id="id_expense"> <option>Please choose...</option> {% for category in categories %} <optgroup label="{{category.name}}"> {% for ledger in category.ledger_set.all %} <option data-tokens="{{expense.name}}" value="{{ledger.id}}">{{ledger.name}}</option> {% endfor %} </optgroup> {% endfor %} </select> -
In Djangorestframework is there a way to provide data from multiple models in view?
I am working on a problem where i need to provide feed of user activities from different model on one url endpoint. Problem is this feed comprises of using custom function defined in individual models. OBJECTIVE 1: How do I serialize this function output and feed data properly? For now I am adding "function_1" in fields option of childmodel serializer(ModelSerializer) and similarly for function_2. OBJECTIVE 2: Create a urlendpoint for using data from function_1 and function_2 in a single view. Only "get" is sufficient for autheticated user at this endpoint. My code below Models.py file Class Child_model(models.Model): """My model definition here""" relation_to_parent = models.ForeignKey(Parent_model, on_delete=models.CASCADE) def function_1(self): """Code here which uses data from model1 to return usefull data""" Class Parent_model(models.Model): """My model definition here""" relation_to_child = models.ManyToManyField(Child_model) def function_2(self): """Code here which uses data from model2 to return usefull data""" -
How can i specific data of subscription in GraphQL
I'm using GraphQL in django and i need to Subscription of create new book but with specific author. How can i do it ?. i trying to write this code but this line doesn't work event.instance.AuthorID == Author class SubscriptionBook(graphene.ObjectType): NewBooks = graphene.Field(BookType, Author = graphene.String(required=True)) def resolve_NewBooks(root, info, Author): return root.filter( lambda event: event.operation == CREATED and isinstance(event.instance, Book) and event.instance.AuthorID == Author ).map(lambda event: event.instance) -
How to redirect from a view in one app to a view in another?
I am trying to build a job-board type of website. Right now I have user authentication (login, logout, register, password change, etc) in one app (account) and the job model and all other views/templates in another app(job). To have the user log in, I used the views found in django.contrib.auth(this is account/urls.py): from django.urls import path from django.contrib.auth import views as auth_views urlpatterns = [ path('login/', auth_views.LoginView.as_view(), name = 'login'), ] In the job app I have created a urls.py file: from django.urls import path from . import views urlpatterns = [ path('dashboard/', views.dashboard, name = 'dashboard'), ] Upon logging in, I would like the user to be redirected to this dashboard URL/view found in the job app. How can I do this? I know that if I just put the dashboard view/url into the account app all I would need to do is add this to settings.py: LOGIN_REDIRECT_URL = 'dashboard' But, how can I redirect to a view in another app? Final note: I separated this into two apps in the first place because I've read that is good practice, but am not sure if it's needed here. -
How do i pass a parameter to a class based view in django?
I have a class based view which shows a login-form. The problem is that I can't display error messages. I am trying to send an error message in a parameter in the URL to display it inside the HTML template file. But it does not work. Here is my code so far: forms.py # a class which act as a view - it displays the login-form class LoginForm(AuthenticationForm, BaseLoginView): username=forms.CharField(widget=forms.TextInput(attrs={'class':'form-control'})) password=forms.CharField(widget=forms.PasswordInput(attrs={'class':'form-control'})) def get_context_data(self, **kwargs): context = super(LoginForm, self).get_context_data(**kwargs) context['error'] = '' return context urls.py urlpatterns = [ path('login/', views_auth.LoginView.as_view(form_class=LoginForm, redirect_authenticated_user=True), name='login'), # login-page ] views.py # login functionality for the user def custom_user_login(request): if request.method == 'GET': error_message = '' return redirect('home') elif request.method == 'POST': username = request.POST.get('username') password = request.POST.get('password') error_message = '' # if the username & password is correct user = authenticate(request, username=username, password=password) if user is not None: # Redirecting to the required login according to user type (admin / regular-user) if user.is_superuser or user.is_staff: login(request, user) return redirect('admin_section/') else: login(request, user) return redirect('/') # display error message else: base_url = reverse('login') # /login/ query_string = urlencode({'error': 'The username & password combination are incorrect - please try again!'}) # error=The username & password combination are … -
Django - changing ID field
So I understand it's not good practice to use the keyword - ID. So, I tried changing the id below to cid. However, when I do this I get: testing() got an unexpected keyword argument 'id'. If I change it back from cid to ID. Everything works just fine. What am I doing wrong? def testing(request, cid): """Testing sheet for controls""" if request.method == "GET": testing_sheet = IsoControls.objects.get(pk=cid) form = forms.ControlTesting(instance=testing_sheet) return render(request, 'controls_app/testing_sheet.html', {'form':form}) else: testing_sheet = IsoControls.objects.get(pk=cid) form = forms.ControlTesting(request.POST, instance=testing_sheet) if form.is_valid(): form.save() return render(request, 'controls_app/testing_sheet.html', {'form':form}) -
Trigger a message notification with an Ajax request in Django
I have a basic template with a form that, once submitted, sends an ajax request to a Django view. The form works, my view receives the data, but i'm not able to make my view trigger a success message once a request is received. Here is what i tried: def myview(request): messages.success(request, 'Loading..') #This works.. if request.method == 'POST': if request.POST.get('type', False) == 'ajaxreq': print('Received!') #This works.. messages.success(request, 'Received!') #This doesn't work return HttpResponseRedirect(request.path_info) return render(request, "main/mytemplate.html", context={}) The first messages-success() will successfully show. The problem is that the second one messages.success(request, 'Received!') doesn't work, although i'm sure that the request is received. The problem is not that my view does not receive the Ajax request with the form data, i already made sure of that, also the print() statement works, that means that nothing is wrong with the Ajax request. -
Django - django-cookie-consent not working
https://github.com/haricot/django-cookie-consent https://django-cookie-consent.readthedocs.io/en/latest/index.html I found a fork of the django-cookie-consent github project for managing cookies on your website and I got it to work most of the time but it is not 100% perfect. Here is how I got it to run (either install via pip from that fork link or): Do not use pip3 install django-cookie-consent from the default PyPi. Download the zip file from github and copy the cookie_consent folder to your site packages folder. For example for me it was - /home/user/.local/share/virtualenvs/project_name/lib/python3.7/site-packages/cookie_consent. Then pip3 install django-appconf. Then follow the documentation instructions. Links: http://127.0.0.1:8000/cookies/ http://127.0.0.1:8000/cookies/accept/ http://127.0.0.1:8000/cookies/accept/variable_name/ http://127.0.0.1:8000/cookies/decline/ http://127.0.0.1:8000/cookies/decline/variable_name/ I found some code for the consent banner https://github.com/haricot/django-cookie-consent/tree/master/tests/core/templates but was having problems with it. I copied the test_page.html template code to my own project's base.html but this entire script tag did not work for me -> . I got django.template.exceptions.TemplateSyntaxError: 'cc_receipts' did not receive value(s) for the argument(s): 'request'. Copying the rest of the code from that file and not including that one script tag did cause the banner to show up on my project's base.html file. Accepting a cookie from clicking accept on the banner code found from the tests directory just redirects me to a blank /cookies/accept/social/ page. …