Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
What are the most important features in django?
I know this is off topic but i think a lot of people learning a lot of code and most companies require something more specific always. For example most of the websites out there have the same features. Ex Login,Register,API services etc. But in general, what are the most important Django features-skills a developer need to have? -
How to query the total number of "interest= Pending" object for any of my post added together?
In my project, anyone can submit any interest to any post, limited to 1 interest per post. Right now, i am trying to query the TOTAL number of interests (that is not accepted yet, meaning the status is still pending) that has been sent to any of my post, like all of them added up together, and I want that to be displayed in my account page. Is that possible to query it from the template based on the current code i have, and how can i do it? I have been trying the past hour but it hasn't be successful :( All help is appreciated thank you! models.py class Account(AbstractBaseUser): email = models.EmailField(verbose_name="email", max_length=60, unique=True) username = models.CharField(max_length=30, unique=True) class BlogPost(models.Model): title = models.CharField(max_length=50, null=False, blank=False, unique=True) author = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE) body = models.TextField(max_length=5000, null=False, blank=False) class Interest(models.Model): user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE) blog_post = models.ForeignKey(BlogPost, on_delete=models.CASCADE) my_interest = models.TextField(max_length=5000, null=False, blank=False) class InterestInvite(models.Model): ACCEPT = "ACCEPT" DECLINE = "DECLINE" PENDING = "PENDING" STATUS_CHOICES = [ (ACCEPT, "accept"), (DECLINE, "decline"), (PENDING, "pending"), ] interest = models.OneToOneField(Interest, on_delete=models.CASCADE, related_name="interest_invite") status = models.CharField(max_length=25, choices=STATUS_CHOICES, default=PENDING) views.py def account_view(request, *args, **kwargs): context = {} user_id = kwargs.get("user_id") account = Account.objects.get(pk=user_id) context['account'] = account … -
How can I filter a intersection of manytomany field in django?
i want to filter query , and one of field is manytomany . how to filter intersection in manytomany fields my model is: class Event(models.Model): category = models.ManyToManyField(Category, blank=True) title = models.CharField(max_length=400) views: search_subcategory = Q() if subcategory != 'null': total_filter.append('subcategory') subcategory = subcategory.split(",") for i in range(0, len(subcategory)): subcategory[i] = int(subcategory[i]) for x in subcategory: search_subcategory &= Q(subcategory=x) search_title = Q() if title != '': total_filter.append('title') search_title = Q(title__icontains=title) filter_query = Event.objects.filter(search_category & search_title).distinct() -
why 502 error in google app engine flexible environment django?
I want to deploy Django + CloudSQL (Postgresql) + app engine flexible environment in google cloud. My app.yaml setting runtime: python #gunicorn env : flex entrypoint : gunicorn -b 127.0.0.1 -p 8000 config.wsgi --timeout 120 #instance_class : F4 beta_settings: cloud_sql_instances: icandoit-2021start:asia-northeast3:test-pybo=tcp:5434 runtime_config: python_version: 3 gcloud app logs tail result 2021-02-03 11:02:17 default[20210203t195827] [2021-02-03 11:02:17 +0000] [1] [INFO] Starting gunicorn 19.7.1 2021-02-03 11:02:17 default[20210203t195827] [2021-02-03 11:02:17 +0000] [1] [INFO] Listening at: http://127.0.0.1:8000 (1) 2021-02-03 11:02:17 default[20210203t195827] [2021-02-03 11:02:17 +0000] [1] [INFO] Using worker: sync 2021-02-03 11:02:17 default[20210203t195827] [2021-02-03 11:02:17 +0000] [8] [INFO] Booting worker with pid: 8 2021-02-03 11:09:18 default[20210203t170353] [2021-02-03 11:09:18 +0000] [1] [INFO] Handling signal: term 2021-02-03 11:09:18 default[20210203t170353] [2021-02-03 11:09:18 +0000] [8] [INFO] Worker exiting (pid: 8) 2021-02-03 11:09:19 default[20210203t170353] [2021-02-03 11:09:19 +0000] [1] [INFO] Shutting down: Master 2021-02-03 11:09:19 default[20210203t170353] [2021-02-03 11:09:19 +0000] [1] [INFO] Handling signal: term 2021-02-03 11:09:19 default[20210203t170353] [2021-02-03 11:09:19 +0000] [8] [INFO] Worker exiting (pid: 8) 2021-02-03 11:09:20 default[20210203t170353] [2021-02-03 11:09:20 +0000] [1] [INFO] Shutting down: Master 2021-02-03 11:14:25 default[20210203t195827] "GET /" 502 django and gunicon works normally. Why Do I Have 502 Errors? -
Elastic Apm python agent connection problem
I have a very basic django apm agent setup: ELASTIC_APM = { # Set required service name. Allowed characters: # a-z, A-Z, 0-9, -, _, and space 'SERVICE_NAME': 'bourse', # Set custom APM Server URL (default: http://localhost:8200) 'SERVER_URL': '127.0.0.1:8200', 'LOG_LEVEL': "debug", 'LOG_FILE': "/home/hamed/Desktop/log.txt",} my apm server is up and running on localhost:8200. But it seems my apm agent can't make a connection to the apm server.Here is a part of my log file that I think cause the problem: Skipping instrumentation of urllib3. Module botocore.vendored.requests.packages.urllib3.connectionpool not found HTTP error while fetching remote config: HTTPConnectionPool(host='config', port=80): Max retries exceeded with url: /v1/agents (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fe2625ed610>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')) this is my apm agent log file. ps: On my apm server I'm not receiving any request from my agent. I checked the apm server log files. Please help me. I'm stuck. -
NoReverseMatch at /products/update/6/ Reverse for 'product_update' with arguments '('',)' not found
I want to go to the product update method through the URL with the product ID by clicking on the product list but this error is coming. I don't understand what I did wrong here. The following codes are given. Product list: {% for product in products %} <tr> <td> <img width="55px" height="55px" src="{{ product.photo.url }}" /> </td> <td><input class="groupCheck" type="checkbox" value="{{product.id}}" id="{{product.id}}"/></td> <td> <a class="btn product-update" href="{% url 'accpack:product_update' pk=product.id %}">{{product.product_code}}</a> </td> <td>{{product}}</td> <td> <a class="far fa-plus-square fa-1x js-create-product_attribute" data-url="{% url 'accpack:products_attributes_create' pk=product.id %}" data-toggle="modal" data-target="#modal-product_attribute"></a> &nbsp <a class="far fa-edit fa-1x js-create-product_attribute" data-url="{% url 'accpack:products_attributes_update' pk=product.id %}" data-toggle="modal" data-target="#modal-product_attribute"></a> </td> <td>{{product.cost_price}}</td> <td>{{product.sale_price}}</td> <td>{{product.quantity_per_unit}}</td> <td>{{product.brand}}</td> </tr> {% endfor %} url: # Product url url('products/$', views.product_index, name="products"), url('products/create/$', views.product_create, name="product_create"), url('products/update/(?P<pk>\d+)/$', views.product_update, name="product_update"), view: def product_update(request, pk): product = get_object_or_404(Product, pk=pk) if request.method == 'POST': form = ProductForm(request.POST, instance=product) else: form = ProductForm(instance=product) return save_product_form(request, form, 'products/partial_product_update.html') partial_product_update.html: <form id="Form" method="post" action="{% url 'accpack:product_update' pk %}" class="col s12" enctype="multipart/form-data"> {% csrf_token %} <br> {% crispy form form.helper %} <br> </form> Traceback: Traceback (most recent call last): File "C:\Users\Dell\anaconda3\envs\webapp\lib\site-packages\django\core\handlers\exception.py", line 47, in inner response = get_response(request) File "C:\Users\Dell\anaconda3\envs\webapp\lib\site-packages\django\core\handlers\base.py", line 179, in _get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "D:\MEGA\djangoprojects\myprojects\accpack\views\products.py", line 52, in … -
Conditional Counter in Django template for loops
I want my for loop to end after the if-condition is satisfied thrice while rendering my "products" details in my eCommerce website. category.html {% for item in subcategory %} {% with counter="0" %} <div> <h5 class="my-0" style="font-weight: 700;">{{ item.title }}</h3> </div> <div class="row"> {% for i in products %} {% if i.category.id == item.id %} {{ counter|add:"1" }} {% if counter == "3" %} {{ break}} {% endif %} <div class="col-3 p-0 px-1 my-3"> <a href="{% url 'product_detail' i.id i.slug %}"> <img class="w-100" id="catbox" src="{{ i.image.url }}" alt=""> </a> </div> {% endif %} {% endfor %} <div class="col-3 p-0 my-3 text-center" style="border-radius: 10px;background: url({% static 'images/temp.jpeg' %}); background-size: cover;"> <div class="h-100 w-100 m-0 p-0" style="background: rgba(0, 0, 0, 0.61);border-radius: 10px;"> <div style="position: relative;top: 50%;transform: translateY(-50%);"> <a href="{% url 'category_product' item.id item.slug %}" class="text-white " href="#"><strong>SEE ALL</strong></a> </div> </div> </div> </div> {% endwith %} {% endfor %} I want the second for loop, i.e., {% for i in products %} to break once the if condition, i.e., {% if i.category.id == item.id %} inside it is satisfied thrice. But the counter I set to 0 is incremented to 1 repeatedly instead of being incremented recurrently with the for loop. Since there … -
Make Django db optional, but still functional if needed
So in my django project i have my databse set up like this : DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql', 'NAME': env("DEFAULTDB_NAME"), 'USER': env("DEFAULTDB_USER"), 'PASSWORD': env("DEFAULTDB_PASS"), 'HOST': env("DEFAULTDB_HOST") }, "remote": { 'ENGINE': 'django.db.backends.postgresql', 'NAME': env("REMOTEDB_NAME"), 'USER': env("REMOTEDB_USER"), 'PASSWORD': env("REMOTEDB_PASS"), 'HOST': env("REMOTEDB_HOST") } } What i want is for the remote database to be optional, so if i run my server it works even if the connection to remote databse fails. I have tried the solution mentioned here, But with this if the connection is lost when i start the server i can't use my remote database until i restart my server -
Access all content from a post in Django
I apologize in advance if the question is poorly written. tried my best to explain my problem as good as i could :). Thanks for helping! I have currently made a django web server. i am trying to access all the content from all my different posts and display them by eachother within "ul" and "li" HTML tags. I am currently only able to display the Main Posts title, and not the rest of the content. The result i am currently getting is this. My Book List: * The Hunger Games and the result i am wanting to get is this. My Book List: * Title: The hunger games * Author: Suzanne Collins * Publisher: Scholastic Press * Published: 2008-09-14 I've tried multiple solutions to try and make it work. But i cant find any solution on youtube or any related social media website, so i resorted to here. models.py file from django.db import models # Create your models here. class Books(models.Model): title = models.CharField(max_length=50) author = models.CharField(max_length=50) publisher = models.CharField(max_length=50) pulished = models.DateField() def __str__(self): return self.title Views.py file from django.shortcuts import render from .models import Books # Create your views here. def book_list(request): books = Books.objects.all() context = … -
django: taking user input from html, processing it and showing output in the same page
I am quite new in Django and stuck at specific point. I want to take user input from html that goes into database, process it with specific python script and return result to the same html page. I want Users to enter score in "exam_score" line, then process that input with specific python script and then to output result to "uni_name_1_result". For now, python script that just prints 'Hello world' is enough, just want to understand the mythology of how it can be done. Would appreciate any help. models.py from django.db import models from django.core.validators import MaxValueValidator, MinValueValidator # Create your models here. class User(models.Model): first_name = models.CharField(max_length=128) last_name = models.CharField(max_length=128) email = models.EmailField(max_length=254,unique=True) exam_score = models.FloatField(null=True, validators=[MinValueValidator(0.0),MaxValueValidator(700)]) uni_name_1 = models.CharField(max_length=254) uni_name_1_result = models.CharField(max_length=254) forms.py from django import forms from django.core import validators from ielts_app.models import User class NewUserForm(forms.ModelForm): # validations can be set here class Meta(): model = User fields = '__all__' views.py from django.shortcuts import render # from ielts_app import forms from ielts_app.forms import NewUserForm # from django.http import HttpResponseRedirect def index(request): return render(request,'ielts_app/index.html') def users(request): form = NewUserForm() if request.method == 'POST': form = NewUserForm(request.POST) if form.is_valid(): variable:form.cleaned_data form.save(commit=True) # to save forum data (user data), commit=True … -
DRF: access serializer fields outside meta
So, i need to get the "like" status on posts, and need my serialzier to return attr "liked" bool. I am trying to get the current post being serialized, pass it into a query which will either return true or false. -
Saving data from different forms to different table using one view Django
I have five different Models and each model have different fields.I have created five form for the respective models.Please refer the below code.I am getting used_for from url and I am using used_for for identifying which form has been triggered to save the data.Its working for me I just wanted to know is this a good way to this or is there any another way.I dont want to create fie different views to save the data views.py def contract_details(request,used_for): if request.method == "POST": if used_for == "contractmanager": form = ContractForm(request.POST) elif used_for == "contractlineitem": form = ContractLineItemForm(request.POST) elif used_for == "billingtype": form = BillingTypeForm(request.POST) else: messages.info(request,"Invalid Form") return redirect("useradmin:revenue_manager") if form.is_valid(): form.save() messages.success(request,"Contract Saved Successfully.") return redirect("useradmin:revenue_manager") urls.py urlpatterns = [ path("add",views.add_admin,name = "add_admin"), path("view",views.view_admin,name = "view_admin"), path("timezone/", views.add_timezone, name = "timezone"), path("timezone/delete/<int:id>/", views.delete_timezone, name = "deletetime"), path("language/", views.add_language, name = "language"), path("language/delete/<int:id>/", views.delete_language, name = "deletelanguage"), path("organization/", views.add_organization, name = "organization"), path("organization/delete/<int:id>/", views.delete_organization, name = "deleteorganization"), path("revenue-manager/", views.revenue_manager, name = "revenue_manager"), path("revenue-manager/bulk-add/<str:data>", views.data_upload, name = "bulk_add"), path("revenue-manager/export-data/", views.export, name = "export_data"), path("add-contract/<str:used_for>/", views.contract_manager, name = "add_contract"), ] -
DJANGO: Group by two fields and aggregate a method's return value
How to group records by two fields, and then take the sum of a method's return value? I have the following model: class Invoice(models.Model): client = models.ForeignKey(Client, on_delete=models.DO_NOTHING) date = models.DateField() quantity = models.IntegerField() price = models.DecimalField(max_digits=18, default=2) def total_amount(self): return self.quantity * self.price I want to group records of Invoice by year of date, and client, and take the sum of total_amount for each year for each client. The output should look something like this: top_companies = {"2021": {"Company 1": 22000.0, "Company 2": 20000.0}, "2020": {"Company 2": 40000.0, "Company 1": 10000.0}} -
save() takes 1 positional argument but 2 were given
I am trying to register as a seller ( is_seller=True). But I am getting this issue of save() function cant take two positional arguments. I tried passing *args and **kwargs as well, but it is still not working. My models: class CustomUser(AbstractUser): # username = models.CharField(max_length=255,) first_name = models.CharField(max_length=255, verbose_name="First name") last_name = models.CharField(max_length=255, verbose_name="Last name") email = models.EmailField(unique=True) is_seller = models.BooleanField(default=False) is_customer = models.BooleanField(default=False) USERNAME_FIELD = "email" REQUIRED_FIELDS = ["first_name", "last_name"] objects = CustomUserManager() def __str__(self): return self.email My serializers: class SellerRegisterSerializer(serializers.ModelSerializer): seller = serializers.PrimaryKeyRelatedField(read_only=True,) phone_num = serializers.CharField(required=False) class Meta: model = User fields = ['seller','email', 'phone_num', 'first_name', 'last_name', 'password'] def get_cleaned_data(self): data = super(SellerRegisterSerializer, self).get_cleaned_data() extra_data = { 'phone_num': self.validated_data.get('phone_num', ''), } data.update(extra_data) return data def save(self, request,*args, **kwargs): user = super(SellerRegisterSerializer, self).save(request) user.is_seller = True user.save() seller = Seller(seller=user, phone_num=self.cleaned_data.get('phone_num')) seller.save(*args, **kwargs) return user My view: class SellerRegisterView(RegisterView): serializer_class = SellerRegisterSerializer My urls: path("api/seller/register/",SellerRegisterView.as_view(), name='api-registerseller'), -
how to apply serial number in model.py in python django
we have a table that contains row and column we need one more column that will show serial number of row. It mean when user will update the table the serial number will update automatically. -
django reduce number of database queries on bulk-update
so I have functions like this in my reusable manager class. @query_debugger def update_object_positions(self, data: list, overwrite_objects): """ Updates object positions for the given array of overwrite objects. Removes unchanged data from the current list of objects and puts it back in after sorting the list. Expects a list of serialized object-data, consisting of the id and the changed-position of the respective objects. """ if overwrite_objects.count() < 2: # we don't update positional values for objects if none or # only one of the same is found, because it doesn't make # any sense to do the same. Objects only change their positions to be # shifted among each other. model_name_plural = self.model._meta.verbose_name_plural.title() raise exceptions.ValidationError(detail=f'less than two {model_name_plural} found') collected_data = {obj['id']: obj['position'] for obj in data} changed_objects = overwrite_objects.filter(id__in=collected_data.keys()) for obj in changed_objects: obj.position = collected_data[obj.id] rotated = self.perform_rotate(changed_objects, overwrite_objects) self.overwrite_object_positions(rotated) @query_debugger def overwrite_object_positions(self, data: list): """ Overwrites object-positions, enclosed within a transaction. Rolls-back if any error arises. We need a transaction here because all of our positional objects have a deferring unique constraint over their positions. """ cleaned = [obj for obj in data if not hasattr(obj, 'is_default') or not obj.is_default] self.model.objects.bulk_update(cleaned, ['position']) for instance in cleaned: # … -
can a django login api be created without using django auth model
Can a django login rest api be created completely from scratch, build with custom model and not inbuilt. I've been trying but cannot understand how to create it. -
Django Rest Framework: Send full foreign key objects in GET response but accept only foreign ids in POST payload, without two serializers?
Say I've two models: class Singer((models.Model): name = models.CharField(max_length=200) class Song(models.Model): title = models.CharField(max_length=200) singer = models.ForeignKey(Singer) And two serializers like: class SingerSerializer(serializers.ModelSerializer): class Meta: model = Singer fields = '__all__' class SongSerializer(serializers.ModelSerializer): singer = SingerSerializer() class Meta: model = Singer fields = '__all__' I've defined the serializers as above because I need the full foreign key object in the GET response for songs: { "singer": { "id": 1, "name": "foo" }, "id": 1, "title": "foo la la" } Is there a way to allow POST/PATCH payloads to only send in the id of the foreign object and not the entire object, without writing a different serializer? I'd like the PATCH payload to be so: { "singer": 1, "id": 1, "title": "foo la la" } -
TypeError: cannot serialize '_io.BufferedRandom' object While trying to upload file in Django
I am trying to upload some files in Django but sometimes when the file size increases it gives the following error: TypeError: cannot serialize '_io.BufferedRandom' object In the current case I am trying to upload a file(size ~3Mb) but it's still showing the error. I tried to check in the network that if the file has been uploaded or not but it shows: I am unable to understand what changes I need to make in order to resolve this -
Loading an object inside an object in a Django template
So I have an object that has a foreign key of another object. Whenever I load that object into a template and access said object, I get an error. <td><a href="{% url 'agente' 'Mark' %}" target="_blank">{{ ticket.get_agente }}</a></td> int() argument must be a string, a bytes-like object or a number, not 'Agente' I even tried adding a get_id after getting the object but displays the same error. Seems like the fact that it's an object inside an object confuses Django. -
Zappa is not invoking the right Virtual env correctly while deploy
I am trying to deploy a Django app with Zappa using. I have created virtualenv using pyenv. Following commands confirms the correct virtualenv ▶ pyenv which zappa /Users/****/.pyenv/versions/zappa/bin/zappa ▶ pyenv which python /Users/****/.pyenv/versions/zappa/bin/python But when I am trying to deploy the application using zappa deploy dev following error is thrown ▶ zappa deploy dev (pip 18.1 (/Users/****/.pyenv/versions/3.6.9/envs/zappa/lib/python3.6/site-packages), Requirement.parse('pip>=20.1'), {'pip-tools'}) Calling deploy for stage dev.. Oh no! An error occurred! :( ============== Traceback (most recent call last): File "/Users/****/.pyenv/versions/3.6.9/envs/zappa/lib/python3.6/site-packages/zappa/cli.py", line 2778, in handle sys.exit(cli.handle()) File "/Users/****/.pyenv/versions/3.6.9/envs/zappa/lib/python3.6/site-packages/zappa/cli.py", line 512, in handle self.dispatch_command(self.command, stage) File "/Users/****/.pyenv/versions/3.6.9/envs/zappa/lib/python3.6/site-packages/zappa/cli.py", line 549, in dispatch_command self.deploy(self.vargs['zip']) File "/Users/****/.pyenv/versions/3.6.9/envs/zappa/lib/python3.6/site-packages/zappa/cli.py", line 723, in deploy self.create_package() File "/Users/****/.pyenv/versions/3.6.9/envs/zappa/lib/python3.6/site-packages/zappa/cli.py", line 2264, in create_package disable_progress=self.disable_progress File "/Users/****/.pyenv/versions/3.6.9/envs/zappa/lib/python3.6/site-packages/zappa/core.py", line 627, in create_lambda_zip copytree(site_packages, temp_package_path, metadata=False, symlinks=False, ignore=shutil.ignore_patterns(*excludes)) File "/Users/****/.pyenv/versions/3.6.9/envs/zappa/lib/python3.6/site-packages/zappa/utilities.py", line 54, in copytree lst = os.listdir(src) FileNotFoundError: [Errno 2] No such file or directory: '/Users/****/mydir/zappa/env/lib/python3.6/site-packages' ============== You can see the line at which error is thrown is different where virtualenv is installed. I don't know why Zappa deploy is looking for the site-packages here. -
How to add a filter in django for every request?
I want to add a security filter so that every request to my django app will go through the filter first and then let the request go through if the token from the header is valid. How can I accomplish that in django? Thanks. -
Is VS code better than pycharm when starting out with Django?
I am trying to understand the best platform for a free code editor -
GET 'today' data in Django-Filter/DRF
I'm trying to get the today or yesterday data from the current day using django-filter/DRF. class SampleFilter(filters.FilterSet): start_date = DateTimeFilter(field_name='timestamp', lookup_expr='gte') end_date = DateTimeFilter(field_name='timestamp', lookup_expr='lte') class Meta: model = Sample fields = [] on my django-rest api url. when I get the data start_date=${start}&end_date=${end} for the dates of today, it returns zero data even it have in the database. "GET /api/v1/rainfall/?start_date=2021-02-02&end_date=2021-02-02 HTTP/1.1" 200 2" it is 200 success but it returns nothing. What's wrong in my code? please help. thanks! -
how to redirect “print” command and the output of the script to Django3 template?
Views.py def configure(request): all_devices = Devices.objects.all() if request.method == "POST": for i in all_devices: platform = "cisco_ios" ssh_connection = ConnectHandler( device_type=platform, ip=i.IpAdd, username=i.username, password=i.password, ) output = ssh_connection.send_command("show ip arp\n") print(output) return render(request, "configure.html", {"output": all_devices}) ======================================================================== output from the console / terminal: February 03, 2021 - 07:57:28 Django version 3.1.5, using settings 'project.settings' Starting development server at http://127.0.0.1:8000/ Quit the server with CONTROL-C. Protocol Address Age (min) Hardware Addr Type Interface Internet 192.168.15.177 3 000c.298a.429a ARPA FastEthernet0/0 Internet 192.168.15.184 - ca01.129a.0000 ARPA FastEthernet0/0 Protocol Address Age (min) Hardware Addr Type Interface Internet 192.168.15.177 3 000c.298a.429a ARPA FastEthernet0/0 Internet 192.168.15.185 - ca02.1227.0000 ARPA FastEthernet0/0 Protocol Address Age (min) Hardware Addr Type Interface Internet 192.168.15.1 0 0050.56c0.0008 ARPA Ethernet0/0 Internet 192.168.15.2 3 0050.56ef.adc2 ARPA Ethernet0/0 Internet 192.168.15.164 100 000c.298c.2625 ARPA Ethernet0/0 Internet 192.168.15.177 3 000c.298a.429a ARPA Ethernet0/0 Internet 192.168.15.186 - aabb.cc00.3000 ARPA Ethernet0/0 [03/Feb/2021 07:57:32] "POST /configure/ HTTP/1.1" 200 1454 configure.html == Templates {% extends "base.html" %} {% load static %} {% block content %} {% csrf_token%} {{form}} {{output}} {% endblock content %} {% block result %} {% endblock result %} I'm getting: <QuerySet [<Devices: Reflect>, <Devices: Reflect2>, <Devices: Reflect-SW>]> Thank You.