Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
How to make a compare system in django?
I'm making an E-commerce store, So far I have done almost everything, Just a few tweaks left. The problem in which I am stuck on is how to make a comparing system which can compare two same category products. If anyone knows how to write that into clean code. Please write your answer down. Examples I have item 1 and I want it to compare it with item two. I will select the item two. And then both will be added and will be evaluated and then the users will be recommended that this one is more good for you by grading it. Example : 78% Item1 and 22% item2, -
Django - user uploaded images not appearing in media/images folder
When I complete the profile of a test user, it adds the name of the uploaded file to the DB, and I am able to access the user's profile image file name with {{ user.profile.profile_pic }}, however the image does not appear in my_project/media/images. Thanks for any advice. Here are the relevant files, I can add more if needed: settings.py (last two lines) MEDIA_ROOT = os.path.join(BASE_DIR, 'media') MEDIA_URL = '/media/' accounts/models.py from django.db import models from django.db import models from django.contrib.auth.models import ( AbstractBaseUser, BaseUserManager ) from django.db.models.signals import post_save from django.dispatch import receiver # Create your models here. class UserManager(BaseUserManager): def create_user(self, email, password=None, is_staff=False, is_superuser=False, is_active=True, is_confirmed=False): if not email: raise ValueError("Users must have an email address.") if not password: raise ValueError("Users mush have a password.") user_obj = self.model(email = self.normalize_email(email)) user_obj.set_password(password) #also to change password user_obj.staff = is_staff user_obj.admin = is_superuser user_obj.active = is_active user_obj.confirmed = is_confirmed user_obj.save(using=self._db) return user_obj def create_staffuser(self, email, password=None): user = self.create_user(email, password=password, is_staff=True) return user def create_superuser(self, email, password=None): user = self.create_user(email, password=password, is_staff=True, is_superuser=True) return user class User(AbstractBaseUser): email = models.EmailField(max_length=255,unique=True) USERNAME_FIELD = 'email' active = models.BooleanField(default=False) staff = models.BooleanField(default=False) admin = models.BooleanField(default=False) confirmed = models.BooleanField(default=False) USERNAME_FIELD = 'email' REQUIRED_FIELDS … -
celery cant find static files in django app during development
My django web app loads static files no problem in DEBUG mode with the magic of django.contrib.staticfiles. However, my celery service can't find the files! This makes sense, because Django docs say that django.contrib.staticfiles works automagically when runserver command is used, but celery doesn't use the runserver command, so how do I get celery to access those files in development? -
i am new to Django Framework and i am facing issues while storing Files
I am developing a form and i want to store all information to database, but i could save only the textbox data and couldn't save file field data. i am using a template designed fully in html, css and bootstrap and i am using django to connect the database. Html file code <div class="input-container"> <input class="input-field" type="text" id="u" placeholder="PortFolio URL " name="upurl" autocomplete="off" maxlength="300" > </div> <div class="row files" id="files1"> <span class="btn btn-default btn-file"> Upload you files <input type="file" id="fl" name="port" multiple /> </span> <br /> <ul class="fileList" id="fl"></ul> </div> This is my view.py def register(request): if request.method == "POST" and request.FILES['port']: fa = request.POST.get("usrnm1") la = request.POST.get("usrnm2") ph = request.POST.get("phone") gn= request.POST.get("radio") db = request.POST.get("dob") md = request.POST.get("emails") af= request.POST.get("aff") dp= request.POST.get("dept") fbk = request.POST.get("fb") twt =request.POST.get("tw") gtb= request.POST.get("gt") skr = request.POST.get("sks") lvl = request.POST.get("lvvv") exp = request.POST.get("expp") purl= request.POST.get("upurl") rmrk = request.POST.get("rmks") pfiles = request.FILES['port'] user1 = user(FIRST_NAME= fa, LAST_NAME = la, PHONE = ph,GENDER = gn, DATE_OF_BIRTH = db,MAIL_ID = md,AFILATION = af, DEPARTMENT = dp, FACEBOOK_ID = fbk, TWITTER_ID = twt, GITHUB_ID = gtb,SKILLS=skr,LEVEL =lvl,EXPERIENCE = exp,PORTFOLIO_FILES=pfiles, REMARKS =rmrk) user1.save() send_mail('System cretaed mail', 'Thank you for registering hackathon event, we will get back to you shortly','yourhackathon@mail.com',[md], … -
How to decode the wrong encoded "b'\\xc3\\xb1'" from Django CharField
I need to decode the values of Django CharField. The values were encoded with 'text'.encode('utf-8') before store them into the database. In the Django views, I get "b'text'" str objects from models and I can decode the text correctly. -
How to prevent user to access website by IP address
I have a django website, which can be accessed by, such as www.mysite.com. Site ip is: 33.33.33.33. If type 33.33.33.33, website also work. Is it possible to make: 33.33.33.33 not working? I only want: www.mysite.com to work. The reason is that same IP is hosting few website with different domain names. 33.33.33.33 works for only 1, which does not make any sense. -
Complete sample project for plotting graphs in bokeh
i am a fresher in django just received a project to create graphs with bokeh can . Can anyone please guide to how to complete it . i have a basic idea for django also gone through https://www.youtube.com/watch?v=YlOVR_1q4Ak . but want to know the simplest way to start with -
How to fix 'You must 'source' this script: PS> . ./Scripts/activate' error in PowerShell when activating virtual environment
Im making a Django project on my computer and Im running into an issue with powershell not allowing me to activate the virtual enviorment. Ive tried changing the 'activate' to activate.ps1' and 'activate.bat' neither of which worked. No matter where I am in the directories I get this issue. I also tried it from the cmd which did work but I'd prefer to work in the powershell. This is the error code in the activate file: ''' if (@($null,"Internal") -notcontains $myinvocation.commandorigin) { Write-Host -Foreground red "You must 'source' this script: PS> .$($myinvocation.invocationname)" exit 33 } ''' The input was: PS D:\library\Dev\python\DjangoVenv> ./Scripts/activate The output was: You must 'source' this script: PS> . ./Scripts/activate -
Is an extension in chrome trying to hack my site?
I have these suspicious logs showing up in the django console I have tried to disable https everywhere and a handful of extensions, this seems to be a problem only on chrome. [31/Jul/2019 19:37:11] "GET /?_=1562608ea67ac HTTP/1.1" 302 0 Not Found: /robots.txt [31/Jul/2019 19:37:11] "GET /robots.txt?_=1562608ea67ac HTTP/1.1" 404 2872 Not Found: /App.php [31/Jul/2019 19:37:12] "POST /App.php?_=1562608ea67ac HTTP/1.1" 404 2864 Not Found: /webdav/ [31/Jul/2019 19:37:13] "GET /webdav/ HTTP/1.1" 404 2850 Not Found: /java.php [31/Jul/2019 19:37:16] "GET /java.php HTTP/1.1" 404 2850 Not Found: /test.php [31/Jul/2019 19:37:20] "GET /test.php HTTP/1.1" 404 2850 Not Found: /db_cts.php [31/Jul/2019 19:37:21] "GET /db_cts.php HTTP/1.1" 404 2856 Not Found: /db_pma.php [31/Jul/2019 19:37:21] "GET /db_pma.php HTTP/1.1" 404 2856 Not Found: /logon.php [31/Jul/2019 19:37:22] "GET /logon.php HTTP/1.1" 404 2853 Not Found: /help-e.php [31/Jul/2019 19:37:22] "GET /help-e.php HTTP/1.1" 404 2856 Not Found: /license.php [31/Jul/2019 19:37:23] "GET /license.php HTTP/1.1" 404 2859 Not Found: /log.php [31/Jul/2019 19:37:24] "GET /log.php HTTP/1.1" 404 2847 Not Found: /hell.php [31/Jul/2019 19:37:25] "GET /hell.php HTTP/1.1" 404 2850 Not Found: /pmd_online.php [31/Jul/2019 19:37:25] "GET /pmd_online.php HTTP/1.1" 404 2868 Not Found: /x.php [31/Jul/2019 19:37:26] "GET /x.php HTTP/1.1" 404 2841 Not Found: /shell.php [31/Jul/2019 19:37:28] "GET /shell.php HTTP/1.1" 404 2853 Not Found: /htdocs.php [31/Jul/2019 19:37:29] "GET /htdocs.php HTTP/1.1" 404 2856 Not … -
Django admin get value from field and add to custom label in forms.Model django-colorful
I'm using the django-colorful package to add a color picker for my admin site but I want to put the hex value of the color that the user pick in a custom label but I can't make It work. How can you get the value for a widget and put it in a label?. Model class Colors(models.Model): color = RGBColorField(null=True,blank=True) Admin class ColorsAdminForm(forms.ModelForm): color_label = forms.CharField() def __init__(self, *args, **kwargs): super(ColorsAdminForm, self).__init__(*args, **kwargs) self.fields['color'].label = 'Actual Color' self.fields['color'].disabled = True self.fields['color_label'].initial = self.fields['color'].value #Can't make this work -
How to validate multiple fields with Django Admin Forms
I have two Django 2.2 models: class Collection(Model): collection_id = models.AutoField(primary_key=True) name = models.CharField('title', max_length=200) description = models.TextField('description') document = models.ManyToManyField(Document, through='CollectionDocument', related_name='collections') page_rows = models.IntegerField(default=1) page_columns = models.IntegerField(default=1) created = models.DateTimeField(auto_now_add=True, editable=False, verbose_name="date created") updated = models.DateTimeField(auto_now=True, editable=False, verbose_name="last update") class CollectionDocument(Model): collection_id = models.ForeignKey(Collection, on_delete=models.CASCADE, ) document = models.ForeignKey(Document, on_delete=models.CASCADE, ) page = models.IntegerField(default=1) # the page for this document page_row = models.IntegerField(default=1,) page_column = models.IntegerField(default=1,) and I am using the Django Admin to add data to the models. The CollectionDocument is an inline in the CollectionAdmin page as shown below. The problem I am trying to solve is how to validate the data from this screen. I have validators that work to make sure that the page_row and page_col are not larger than the number of rows and columns defined in the collection. The one validation that is troubling me is how to validate the three values - page, page_row, and page_column together? The validation logic for a collection is that none of the page_rows or page_columns are skipped for a given page and collection, and that there are no duplicates of page_row or page_col for a given collection and page. For example,the Collection in the screenshot … -
Django render range() between 2 number values as float instead of int in template
I'm trying to populate select option in HTML with range between 2019 and 2021 in my views.py: return render(request, 'pages/list_working_sessions.html', { 'working_session_list': working_session_list, 'state': 'list-working-sessions', "months": range(1, 13), "years": range(2019, 2021) }) in my list_working_sessions.html: <td style="border-top:none"> <select name="year" class="form-control" id="year" required> {% for i in years %} {% if i == request.GET.year|add:"0" %} <option value="{{i}}" selected="selected">{{i}}</option> {% else %} <option value="{{i}}">{{i}}</option> {% endif %} {% endfor %} </select> </td> the option only show 2.019 and 2.020 instead of 2019 and 2020. but range(1,13) show properly int value Why is this happening and how to fix this ? Thank you -
Django redirecting to incorrect URL
I am working on the login/logout functionality of a basic Django website. (CS50's Pinocchio's Pizza). The logout path is being injected into the URL & I am unsure as to why. My navbar links to the home page, yet when I click on it it redirects me to the logout page. Any other link I click, that link's path is added to the URL but attached to the logout path. For example, clicking on the login button of my site, whose path is login_default, the url becomes: http://127.0.0.1:8000/logoutlogin_default Trying to click the link in the navbar that should link to the index page gets me: http://127.0.0.1:8000/logout The folder "orders" is an app which "pizza" is made aware of. All html pages are inside orders/templates/orders. This is orders/urls.py from django.urls import path from . import views urlpatterns = [ path("", views.index, name = "index"), path("register_default", views.register_default, name = "register_default"), path("register_setup", views.register_setup, name = "register"), path("login_default", views.login_default, name = "login_default"), path("login_setup", views.login_setup, name = "login"), path("logout", views.logout_view, name="logout"), ] In pizza/urls.py, the Orders app's URLs have been made known: from django.contrib import admin from django.urls import include, path urlpatterns = [ path("", include("orders.urls")), path("register_default", include("orders.urls")), path("register_setup", include("orders.urls")), path("login_default", include("orders.urls")), path("login_setup", include("orders.urls")), path("logout", … -
How to add a comment liking system in Django
I'm attempting to allow a user to like comments of a particular post. However when I attempt to solve this, the expected result doesn't occur. urls.py: path('likecomment/<int:pk>/', post_views.likecomment, name='likecomment'), views.py: def likecomment(request, pk): if request.method == 'POST': comment = get_object_or_404(Comment, pk=pk) comment.likes += 1 comment.save() return redirect('home') comments.html: {% for com in comments %} <br> <br> <br> <b>{{ com.user.username }}</b> &nbsp {{ com.body }} <br> <p class="text-muted">{{ com.pub_date_pretty }} &nbsp &nbsp &nbsp &nbsp &nbsp {{ com.likes }} Likes</p> <a href="javascript: {document.getElementById('likecomment').submit()}"> Like </a> <form id="likecomment" method="post" action="{% url 'likecomment' com.id %}"> {% csrf_token%} <input type="hidden"> </form> <br> {% endfor %} The like occurs sometimes, however not for the right comment. The functionality isn't working correctly. -
Django IntegrityError on profile creation
Why am I getting the Integrity Error despite the fact that I'm checking that the username is unique here: (I also tried try/expect IntegretyError instead of e.count()) # -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models from django.contrib.auth.models import User from django.db.models.signals import post_save from django.dispatch import receiver from slugify import slugify class Profile(models.Model): user = models.OneToOneField(User, on_delete=models.CASCADE, related_name="profile") username = models.CharField(max_length=30, blank=True, unique=True) #should be true on signup name = models.CharField(max_length=30, blank=True) bio = models.TextField(max_length=500, blank=True) location = models.CharField(max_length=30, blank=True) email = models.EmailField() #should be true on signup avatar_url = models.URLField(default="https://image.flaticon.com/icons/png/512/64/64572.png") def __str__(self): return self.user.username @receiver(post_save, sender=User) def create_user_profile(sender, instance, created, **kwargs): # if created: Profile.objects.create(user=instance) @receiver(post_save, sender=User) def save_user_profile(sender, instance, **kwargs): instance.profile.save(commit=False) from allauth.account.signals import user_logged_in, password_set, user_signed_up from django.db.models.signals import post_save from django.dispatch import receiver, Signal @receiver(user_logged_in) def populate_profile(sociallogin, user, **kwargs): # picture_url = "" if sociallogin.account.provider == 'github': user_data = user.socialaccount_set.filter(provider='github')[0].extra_data print(user_data) username = user_data['login'] avatar_url = user_data['avatar_url'] email = user_data['email'] name = user_data['name'] bio = user_data['bio'] location = user_data['location'] if sociallogin.account.provider == 'twitter': user_data = user.socialaccount_set.filter(provider='twitter')[0].extra_data print(user_data) username = user_data['screen_name'] avatar_url = user_data['profile_image_url'].replace("_normal", "") email = user_data['email'] name = user_data['name'] bio = user_data['description'] location = user_data['location'] e = Profile.objects.filter(username=username) if e.count() … -
django: conf.settings missing variables
It's recommended to import the settings module as such: from django.conf import settings My settings module structure is: ├── settings │ ├── base.py │ ├── dev.py │ └── prod.py I have a variable, amb, defined in base.py, which both dev.py and prod.py import from: from .base import * So how come when I do this in a test file: import django sys.path.append("/path/to/project/") os.environ.setdefault("DJANGO_SETTINGS_MODULE", "root_folder.settings.dev") # even when the above line is omitted django.setup() from django.conf import settings print(settings.amb) # or settings.AMB I get this error? AttributeError: 'Settings' object has no attribute 'amb' -
Heroku H13 error code! Can someone explain this?
I want to post file to heroku, the file that been uploaded is around 40mb,and when uploading is almost finished error happens: 2019-07-31T23:02:47.346551+00:00 heroku[router]: at=error code=H13 desc="Connection closed without response" method=POST path="/ML/create/" host=myapp.com request_id=2251b038-b0f6-4ecc-b722-13227f1bc2ba fwd="36.72.216.138" dyno=web.1 connect=0ms service=60006ms status=503 bytes=0 protocol=http -
Tried Replacing an image in my directory with different image, now nothing on my website is working
So basically I had a website made with Django that was working very well, loading css successfully from a bootstrap website template. I attempted to replace a image file in the project directory, a header background, with a different picture. The picture I created was the same format and dimensions exactly, but not the same file size if that matters. And of course I renamed it to the file I wanted to replace so that, what I assumed, Django would just start loading the new image since it was named the same as the old one. So that didn’t work. Nothing updated on any of my webpages, but the CSS and the old images were still loading fine. I tried a few solutions to fix the problem, and one of these made the problem much much worse. 1. I cleared my browser cache. 2. I ran the command: python manage.py collectstatic --noinput --clear - which seemed to fail but could have done something bad. 3. I put all of the original images back to where they should be. I could really use some help. Thanks ahead of time. -
Removing Secret Key from Heroku Git Repo
I have taken a project live with the help of Heroku. I set secret keys properly, using environment variables etc, not committing local settings containing any secret keys etc. Then, reviewing which actual files had been pushed to the git repo within Heroku, I found an 'old_settings'-file which in a pure oversight had been missed. That file contained the secret-key. I cleaned out the file and pushed the changes to the repo (git push heroku master). Then I deleted all past commits following the last answer: removing commit history in git Should this be fine? Reading Mipadis answer so it seems: Pushing secret keys to heroku, safe? Should this be a problem, or would this be considered problem solved? Appreciate any feedback, and should my English be confusing at all I'd be happy to clarify. -
Dealing with concurrency and other networking problems when building out a multiplayer game
I am building a game where 2 users move around on a canvas, with each having a trail, and if a user bumps into the other user's trail (or a wall) the user who bumped into the trail loses and the other user wins. The users move up/down/left/right by solving math problems. This will be an online multiplayer game. I'm finally getting to the point where I am building out the game (had been working mainly on the lobby, then quit, then started building the game again). But I am having issues with concurrency. For example, from both clients, I execute a function called generate_first_4_problems() which generates the first 4 problems for each client. This usually works but sometimes does not work. I have a function that populates the problem list for each user. It goes like: if user1.problem_list is already populated, populate user2.problem_list. These problems are generated on the backend and sent to the client (the problems are generated by the aforementioned generate_first_4_problems() -- it is runs twice). I forgot to mention, the reason why I think these are concurrency problems is: when I use the app in 2 different tabs (one regular, one incognito) or on my laptop … -
Getting Started with Square and Django
I'm trying to get a simple Square credit card form to work on our Django website. I'm new to using Square, but have used similar API's such as Stripe in the past. To start, I followed along with their Square Payment Form walkthrough. I added their SqPaymentForm library and our own javascript file where I initialized a new SqPaymentForm. The front-end appears to be working and is generating a unique card nonce every time I enter fake credentials. Next, I submitted the form to our back-end (including the card nonce, in a hidden nonce field). On the back-end, I've installed the Square Connect Python SDK. I copied their "Charge the card nonce" example as closely as possible, substituting our sandbox access token and location ID: import uuid import squareconnect from squareconnect.rest import ApiException from squareconnect.apis.transactions_api import TransactionsApi # create an instance of the Transactions API class api_instance = TransactionsApi() # setup authorization api_instance.api_client.configuration.access_token = 'sandbox-access-token' location_id = 'sandbox-location-id' nonce = request.POST.get('nonce', 'empty') if (nonce == 'empty'): print("Throw error") # print(nonce) try: # Charge idempotency_key = str(uuid.uuid1()) amount = {'amount': 100, 'currency': 'USD'} body = {'idempotency_key': idempotency_key, 'card_nonce': nonce, 'amount_money': amount} api_response = api_instance.charge(location_id, body) print (api_response.transaction) except ApiException as e: … -
How to remove user cart after order saved?django
I am trying to to build ecommerce website in which user is aforeignkey to cart and cart is unique for one order,but what happens is cart is connected to all orders when trying to remove from cart it removes items from all orders also adding to cart adds to all orders from this user what happen?i tried many solutions th separate cart and existing orders but all failed , any one can help and any suggestions for best relationships building? class Order(models.Model): user = models.ForeignKey(User,null=True, blank=True, on_delete=models.CASCADE) shipping_address = models.ForeignKey(Address, on_delete='CASCADE',related_name="shipping_address",null=True, blank=True) order_id = models.CharField(max_length=120, blank=True) cart = models.ForeignKey(Cart,on_delete=models.CASCADE) status = models.CharField(max_length=120, default="created", choices=ORDER_STATUS_CHOISES) shipping_total = models.DecimalField(default=5.00, max_digits=100, decimal_places=2) total = models.DecimalField(default=0.00, max_digits=100, decimal_places=2) active = models.BooleanField(default=True) date_posted = models.DateTimeField(default=timezone.now) class Cart(models.Model): user = models.ForeignKey(User, null=True, blank=True, on_delete=models.CASCADE) products = models.ManyToManyField(Product, blank=True) total = models.DecimalField(default=0.00, max_digits=100, decimal_places=2) subtotal = models.DecimalField(default=0.00, max_digits=100, decimal_places=2) updated = models.DateTimeField(auto_now=True) timestamp = models.DateTimeField(auto_now_add=True) active = models.BooleanField(default=True) def checkout_home(request): cart_obj, cart_created = Cart.objects.get_or_create(user=request.user, active=True) order_obj = None if cart_created or cart_obj.products.count() == 0: return redirect("carts:home") login_form = LoginForm() address_form = AddressForm() shipping_address_id = request.session.get("shipping_address_id", None) # cart_obj=request.session['cart_id'] address_qs = None if request.user.is_authenticated: address_qs = Address.objects.filter(user=request.user) order_obj, order_obj_created = Order.objects.get_or_create(user=request.user, status='Created',cart=cart_obj) if shipping_address_id: order_obj.shipping_address = Address.objects.get(id=shipping_address_id) del … -
How to initialize class properties in inherited models
I have a very simple model: class Base (models.Model): class Meta: abstract = True class Foo(Base): model = None Field = models.CharField(max_length = 255) Field2 = models.IntegerField() def __init__(self, context = None, *args, **kwargs): self.Field = "Test string" self.model = context self.WorkingField = "Another test string" self.price = 1000 self.Field2 = 500 super().__init__(*args, **kwargs) Then I opened shell and tried to do some tests. I would like to initialize my class by calling constructor t = Foo(Bar) I expect that t.Field returns me a string value "Test string". Also I expect that t.Field2 returns me 500 result. Unexpectedly this property values are empty - the response in shell is an empty string ''. I suppose this problem has something to do with these property declarations Field = models.CharField(max_length = 255) I already tried: initialize a string property without declaration in class class Foo(Base): def __init__(self, context = None, *args, **kwargs): self.Field = "Test string" Everything works OK. But I have to create a database field for this property, so I want to declare it in model I try various combinations of super().init(). With params, without params. I tried to declare init method in the Base class of my model. Nothing … -
TypeError at /en/ string indices must be integers
I am getting started with Saleor and followed the installation for Windows. After running the server I am getting an error during template rendering that involves the menu.html and the shop.py files. @register.simple_tag def get_menu_item_name(menu_item, lang_code): translated = menu_item["translations"].get(lang_code) if translated: return translated["name"] return menu_item["name"] TypeError at /en/ string indices must be integers 11 {% get_menu_item_name lang_code=LANGUAGE_CODE menu_item=item %} 32 translated = menu_item['translations'].get(lang_code) File "C:\Users\kevin\Desktop\my_project\saleor\saleor\core\templatetags\shop.py", line 32, in get_menu_item_name translated = menu_item["translations"].get(lang_code) TypeError: string indices must be integers -
Django view function execution jumps to different function
I'm adding new applications to an existing Django project, and encountered something I am unable to debug. The callback error is "AttributeError: 'QuerySet' object has no attribute 'META'", but I'm not sure that's what's going on. I've written 4 of these apps for different API objects today, and had no issues. When I add print() debug messages to the functions, what I find is that the execution seems to be jumping out of my lead_lists view function and into my lists view function before it errors. This is my list.views.py def list(request): print("we're in lists view") lists = List.objects.all() print("lists saved for context") context = {'lists': lists} print("context created") return render(request, 'list.html', context) # fails here def load_lists(request): api_lists = services.get_lists() print("api lists loaded") db_list_ids = list(List.objects.values_list('list_id', flat=True)) # jumps out of function here print("db lists loaded") # this never prints print(f"db_list_ids: {db_list_ids}") for api_list in api_lists: if api_list['id'] not in db_list_ids: api_list = services.transform_list(api_list) form = ListModelForm(api_list) if form.is_valid(): form.save else: return HttpResponse(form.errors) print("exited load loop") lists = List.objects.all() print("load lists objects saved") context = {'lists': lists} print("load lists context saved") return render(request, 'load_lists.html', context) The expected result is, when I navigate to /list/load it runs the load_lists view …