Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Django queryset concatenate many rows
I need to get all my customers and all the companies where they work I've tried this: customers = Customer.objects.all() customers.values('id','name','surname','city').annotate(companies=Subquery(Company.objects.filter(customer_id=OuterRef('pk')).values('name'))) but obviously I get this error: django.db.utils.ProgrammingError: more than one row returned by a subquery used as an expression I would like receive this output: <QuerySet [{'id': 1, 'name': 'Matt', 'surname': 'Roswell', 'city': 123, 'companies': ['Acme','McDonalds','Burger king']}]> -
How can i solve this error "type object 'User' has no attribute 'object'"
from django.shortcuts import render from django.contrib.auth.models import User from django.contrib import auth def signup(request): if request.method =='POST' : if request.POST['password1'] == request.POST['password2']: user = User.object.create_user( username=request.POST['username'], password=request.POST['password1']) auth.login(request, user) return redirect('home') return render(request, 'signup.html') this is my code. when i try to sign up, my code makes this error page enter image description here where's the angel? Help me plz -
Like Button in Django
What is the preferred method of implementing like button functionality in Django: Using only Jquery and AJAX OR Django REST Framework along with a short AJAX code? -
How to calculate the sum of a filtered column value using Django Queries
I have 2 models class Horses(models.Model): race = models.IntegerField(null=True) name = models.CharField(max_length=200, null=True) owners = models.ManyToManyField(Owners) class BetOrders(models.Model): customers =models.ForeignKey(Customers, null = True, on_delete=models.SET_NULL) horses = models.ForeignKey(Horses, null = True, on_delete=models.SET_NULL) amountBet = models.FloatField(null = True) horseprice = models.IntegerField(null=True) timeOfBet = models.DateTimeField(auto_now_add = True, null = True) I am trying to calculate the sum of amountBet based on similar horse name. i have tried this query set but in vain BetOrders.objects.filter(horses__name='white river').annotate(total_sales=Sum('amountBet')) May I Know whats wrong with this Query? and what is the correct way to get the Sum of the filtered value. Note: horse name is a FK. Here is a representation of my Table +-------+------------------+ | Horse Name | Amount Bet | +-------------+------------+ | jals jiger | 50 | | white river | 80 | | white river | 70 | | jals jiger | 10 | | jals jiger | 98 | | chivas | 10 | +-------------+------------+ -
How to Convert text fields in Dropdown fields in Django?
I am trying to convert text values to dropdown in Django filters, but I am unable to do this. I have multiple locations store in my database but I want the location dropdown filter, and I want to display all locations in the dropdown, I am using Django-filters and widget_tweaks packages, but when I am getting data from the database in the filter it's giving me an input box, please let me know how I can convert this to a dropdown. Here is my filters.py file... class MyFilters(django_filters.FilterSet): class Meta: model = Property fields = ['proprty_for'] here is my views.py file.. def property_list(request): list =PropertyFilters(request.GET, queryset=Property.objects.select_related('project')) template_name='propertyt.html' context={'list':list} return render(request, template_name, context) and here is my propertyt.html file..here I am trying to display dropdown but it's giving me an input box... <form method="GET" action=""> <div class="row"> <div class="col-xl-12 col-lg-4 col-sm-6 col-12 mb-3"> <label>Select Sale or Rent</label> <div class="dropdown bootstrap-select hero__form-input form-control custom-select"> {% render_field listing.form.proprty_for class="hero__form-input form-control custom-select" tabindex="-98" %} </div> </div> </div> </div> </form> -
Unable to upload file on a modal and get the form with objects's instance in Django
I have confused how to upload file to DB by form in a modal, as it cannot load the form with instance equal to order before open the upload form by modal. views: def user_info(request): user = request.user orders = Order.objects.filter(user=request.user, ordered=True).order_by('-start_date') order_items = OrderItem.objects.filter(user=request.user) form = Upload_File(request.POST or None, request.FILES or None)<-- the form will not not be load if I don't set the form in this view context = { 'user': user, 'orders': orders, 'order_items': order_items, 'form': form } return render(request, 'userinfo.html', context) def upload_page(request, id): order = get_object_or_404(Order, id=id) form = Upload_File(request.POST or None, request.FILES or None, instance=order)<-- but I should put the form with instance here if request.method == 'POST': if form.is_valid(): form.save() order.save() messages.success(request, 'Succeed') return redirect('user_info') else: messages.warning(request, 'Failed') return redirect('user_info') else: form = Upload_File() context = { 'form': form, 'order': order } return render(request, 'payment_upload.html', context) template including modal: {% for order_item in orders %} <button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#upload-{{ order_item.id }}"> Open Modal</button> {% endfor %} modal template: <form method="post" enctype="multipart/form-data" action="{% url 'upload_page' id=order_item.id %}"> {% csrf_token %} {{ form }} <button class="form-group btn btn-success" type="submit">Confirm</button> </form> -
Django Rest Framework form in include template wont receive data
I have an empty form in a 'network' app displaying in a memberform.html template. This template is included in a index template in another 'content' app. I'm receiving a 'str' object has no attribute 'data' error during template rendering Traceback (most recent call last): File "/Users/ml/.virtualenvs/newproject/lib/python3.7/site-packages/django/core/handlers/exception.py", line 34, in inner response = get_response(request) File "/Users/ml/.virtualenvs/newproject/lib/python3.7/site-packages/django/core/handlers/base.py", line 115, in _get_response response = self.process_exception_by_middleware(e, request) File "/Users/ml/.virtualenvs/newproject/lib/python3.7/site-packages/django/core/handlers/base.py", line 113, in _get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/Users/ml/PycharmProjects/newproject/content/views.py", line 21, in index return render(request, 'index.html', context) File "/Users/ml/.virtualenvs/newproject/lib/python3.7/site-packages/django/shortcuts.py", line 36, in render content = loader.render_to_string(template_name, context, request, using=using) File "/Users/ml/.virtualenvs/newproject/lib/python3.7/site-packages/django/template/loader.py", line 62, in render_to_string return template.render(context, request) File "/Users/ml/.virtualenvs/newproject/lib/python3.7/site-packages/django/template/backends/django.py", line 61, in render return self.template.render(context) File "/Users/ml/.virtualenvs/newproject/lib/python3.7/site-packages/django/template/base.py", line 171, in render return self._render(context) File "/Users/ml/.virtualenvs/newproject/lib/python3.7/site-packages/django/template/base.py", line 163, in _render return self.nodelist.render(context) File "/Users/ml/.virtualenvs/newproject/lib/python3.7/site-packages/django/template/base.py", line 937, in render bit = node.render_annotated(context) File "/Users/ml/.virtualenvs/newproject/lib/python3.7/site-packages/django/template/base.py", line 904, in render_annotated return self.render(context) File "/Users/ml/.virtualenvs/newproject/lib/python3.7/site-packages/django/template/loader_tags.py", line 150, in render return compiled_parent._render(context) File "/Users/ml/.virtualenvs/newproject/lib/python3.7/site-packages/django/template/base.py", line 163, in _render return self.nodelist.render(context) File "/Users/ml/.virtualenvs/newproject/lib/python3.7/site-packages/django/template/base.py", line 937, in render bit = node.render_annotated(context) File "/Users/ml/.virtualenvs/newproject/lib/python3.7/site-packages/django/template/base.py", line 904, in render_annotated return self.render(context) File "/Users/ml/.virtualenvs/newproject/lib/python3.7/site-packages/django/template/loader_tags.py", line 62, in render result = block.nodelist.render(context) File "/Users/ml/.virtualenvs/newproject/lib/python3.7/site-packages/django/template/base.py", line 937, in render bit = node.render_annotated(context) File "/Users/ml/.virtualenvs/newproject/lib/python3.7/site-packages/django/template/base.py", line … -
I'm working on a blog project I want to rank all posts by views divide by likes
I'm working on a blog project I want to rank all posts by views divide by likes I made a function which I want but I don't know how to pass it in views in .order_by(). Please help. My Post model with ranking function. class Post(models.Model): """Blog Post""" title = models.CharField(max_length=255) title_tag = models.CharField(max_length=55) author = models.ForeignKey(User, on_delete=models.CASCADE) body = models.TextField() date_added= models.DateTimeField(auto_now_add=True) category = models.CharField(max_length=255) likes = models.ManyToManyField(User , related_name='liked_posts' ) pins = models.ManyToManyField(User , related_name='posts' ) views = models.IntegerField(default=0) def ranking(self): total_likes = self.total_likes() if total_likes == 0: total_likes = 1 My views for Posts. def posts(request): posts = Post.objects.order_by('-views') context = {'posts': posts} return render(request, 'blog/home.html', context) I want to add ranking instead of views in ordr_by() in my views So that My posts ranks according to views divided by likes. -
Django override save method , dublicate image on update model
when i update the model , images dublicate. from django.db import models from io import BytesIO from PIL import Image from django.core.files import File #image compression method def compress(image): im = Image.open(image) im_io = BytesIO() im.save(im_io, 'JPEG', quality=60) new_image = File(im_io, name=image.name) return new_image class PhotoGallery(models.Model): image_caption = models.CharField(max_length=50, null=True, blank=True) image = models.ImageField(upload_to='gallery') #calling image compression function before saving the data def save(self, *args, **kwargs): new_image = compress(self.image) self.image = new_image super().save(*args, **kwargs) def __str__(self): return self.image_caption -
Django: Facebook like system clone
I'm new to Django and I'm trying to make a like system. I'm able to unlike every post. The problem is, the user who's logged in is not able to like the posts posted by other users(which means its not saving likes for other users' posts in database). Even though they're able to like their own posts. I don't get any errors though. Any idea where I'm going wrong? A little help would be appreciated. Here's my form: {% for i in Post %} <form action="{% url 'like_post' i.pk %}" method="post"> {% csrf_token %} <div class="like"> <button type="submit" name="post_id" value="{{ i.id }}"> <i class="fal fa-heart"></i> Like </button> {% if i.like %} <div class="show_likes"> {{ i.like.count }} Like{{ i.like.count|pluralize }} <div class="username_liked"> {% for p in i.like.all %} <div>{{ p.username }}</div> {% endfor %} </div> </div> {% endif %} </div> </form> {% endfor %} Here's my views.py: @login_required # The view to save likes and dislikes def like_post(request, pk): Post = get_object_or_404(post, id=request.POST.get('post_id')) if Post.like.exists(): Post.like.remove(request.user) else: Post.like.add(request.user) return redirect('usersfeed') @login_required # The view to load likes and other stuff def usersfeed(request): user= User.objects.all() Pos = post.objects.order_by('-created') comment = Comment.objects.all() return render(request, 'social_media/feed.html', {'Post':Pos,'User':user,'form':PostForm(),'Profile':profile,'Form':CommentForm(),'Comment':comment}) My models.py: class post(models.Model): user = models.ForeignKey(User, … -
Class based view won't work while function based view works(Django)
When I try to create a function based view it would work, displaying my queryset. This is the code I used bellow. in views.py def restaurant_listview(request): template_name ="restaurant/restaurantlist.html" query_set = Restaurant.objects.all() #all the objects that are stored in da DB context={"list": query_set} return render(request,template_name, context) But when I try to do it as a class based view it doesn't show my Queryset. in views.py `class RestaurantListView(ListView): queryset = Restaurant.objects.all() template_name ="restaurant/restaurantlist.html"` in urls.py path('restaurants', RestaurantListView.as_view() How can i solve this problem? -
Django displaying data by date range
start_date = request.GET['start_date'] # '2020-09-01' end_date = request.GET['end_date'] # '2020-09-05' data_list = WeatherModel.objects.filter(date__range=(start_date, end_date)) -
Using django model as argument for pytest parametrization
I'm trying to test if users of different business groups are allowed to make an action in a webapp using parametrization features of pytest but I can't get access to fixtures values inside parametrize. First approach: @pytest.fixture def mike_user(): user = User(username="mike", email="mike@test.com",) user.set_password("test") user.save() return user @pytest.fixture def mike_business_group(mike_user): bg = BusinessGroup.objects.create( name="Mike Business Group", user=mike_user ) bg.save() return bg.pk @pytest.mark.django_db @pytest.mark.parametrize( "resource, user, serialized_data, success", [ ( "/business/", mike_user, { "name": "New business", "description": "Hi Stackoverflow", "group": mike_business_group, }, True, ), ], ) def test_create_model_with_related_owner( apiclient, user, resource, serialized_data, success ): apiclient.force_authenticate(user=user) response = apiclient.post(resource, data=serialized_data) assert ( response.status_code == 201 ) is success Seeing lazy_fixture package I tried the following but it only success resolving mike_user having the following dictonary value for the second resolution: {'name': 'Marina L4bs', 'description': 'Happy BioHacking', 'group': <LazyFixture "mike_business_group">} Second approach: @pytest.mark.django_db @pytest.mark.parametrize( "resource, user, serialized_data, success", [ ( "/business/", pytest.lazy_fixture("mike_user"), { "name": "Marina L4bs", "description": "Happy BioHacking", "group": pytest.lazy_fixture('mike_business_group'), }, True, ), ], ) -
Django:How to return nowhere?
(sorry for my bad english) hello mans.i have a such view in django: if request.user.is_authenticated: favelan = get_object_or_404(elan,id = id) isfav = True if favelan.favorit.filter(id = request.user.id).exists(): favelan.favorit.remove(request.user) messages.success(request,'Elan Uluzlulardan Silindi!') isfav = False return redirect("/",{'isfav':isfav}) else: favelan.favorit.add(request.user) messages.success(request,'Elan Uluzlulara Elave Olundu!') isfav = True return redirect("/",{'isfav':isfav}) return redirect('/hesablar/qeydiyyat') i want this view redirect user nowhere.how i do this?i tried: reqabspath = request.path return redirect(reqabspath,{'isfav':isfav}) but its not working.i want redirect user nowhere.please help me.thanks now. -
How to pause and stop celery task from django template
I am working on a django application that uses celery to run tasks asynchronously. Right now a user can submit a form from the webpage to start a celery task. But there is no way to pause or stop the task on the click of a button inside a django template. this is my code so far celery task @shared_task def get_website(website): website_list = return_website_list(website) return website_list In the above task I am calling a return_website_list() function that scrapes the required website and returns a list of links from the website. output.html template <div class="container"> <button class="pause_btn" type="button">Pause task</button> <button class="resume_btn" type="button">Resume task</button> <button class="stop_btn" type="button">Stop task</button> </div> I want the ability to pause the task indefinitely when the pause button is clicked and resume the task when the resume button is clicked or the ability to stop the task completely when the stop button is clicked. views.py def index(request): if request.method == 'POST': website = request.POST.get('website-name') get_website.delay(website) return redirect('output') return render(request, 'index.html') I searched online, like these link1, link2, link3. But these links did not help me achieve what I am trying to do. Thanks in advance -
ModuleNotFoundError: No module named 'articles'
I have Django code to backend. But it's not starting because of this error ModuleNotFoundError: No module named 'articles' StackOverflow people says that you don't have this folder or wrote it wrong in 2 urls.py documents. Here is the structure of my 1st project. Can't you fuys exlain me why this isn;t working? -
Changing the Link Preview image from a django site
I wanted to share the link of my article on social media but the link preview is showing my image(author's image) instead of the featured image of the post. I've already tried SEO meta tags. The image I want to show is this. I don't know what am I doing wrong. How do I change link preview thumbnail? models.py ..... ... class Post(ModelMeta, models.Model): author = models.ForeignKey('auth.User', on_delete=models.CASCADE) title = models.CharField(max_length=200) text = models.TextField() image_file = models.ImageField(upload_to='media', null=True, blank=True) image_url = models.URLField(null=True, blank=True) category = models.ForeignKey(Category, verbose_name="Category", on_delete=models.CASCADE, null=True) published_date = models.DateTimeField(blank=True, default=timezone.now ,null=True) _metadata = { 'title': 'title', 'image': 'get_meta_image', } def get_meta_image(self): if self.image_file: self.image = self.image_file return self.image.url else: self.image = self.image_url return self.image.url class Meta: verbose_name = "Post" verbose_name_plural = "Posts" ordering = ('-published_date',) def get_absolute_url(self): return reverse("post_detail",kwargs={'pk':self.pk}) def __str__(self): return self.title ..... ... views.py ..... ... class PostDetailView(DetailView): model = Post template_name = "blog/post_detail.html" def post(self,request,*args,**kwargs): self.object = self.get_object() context = self.get_context_data() if request.method == 'POST': form = SubscriberForm(request.POST) if context["form"].is_valid(): context["email"] = request.POST.get('email') form.save() messages.success(request, 'Thank you for subscribing') return redirect('/') else: form = SubscriberForm() def get_context_data(self, **kwargs): # Call the base implementation first to get a context context = super(PostDetailView, self).get_context_data(**kwargs) # Add … -
Django form won't render (modelForm)
I have an existing site, and I'm trying to render a form to it I tried looping trough the form and rendering it field by field, but no luck. I think i might screwed up something in my views, im a beginner to django HTML: {%block wform%} <form method="POST" class="form"> {% csrf_token %} {{ form.as_p }} <div class="form__group"> {%if user.is_authenticated%} <input type="submit" class="submit" value="Submit Your Data"> {%else%} <a href="{% url 'login' %}" class="submit">Submit Your Data</a> {%endif%} </div> </form> {%endblock wform%} Forms.py from django.forms import ModelForm from users.models import Profile class WeightForm(ModelForm): class Meta: model = Profile fields = ['weight','height','goal'] Views.py from django.shortcuts import render from django.contrib import messages from users import models from users.models import Profile from .forms import WeightForm # Create your views here. def home(request): return render(request, 'Landing/index.html') def formsave(request): form = WeightForm() return render(request, 'Landing/index.html', {'form': form}) -
Django: Which method or function should be overriden to apply markdown2 to generic view rendering?
I am able to apply Markdown2 to convert marked down text from the database to HTML that is rendered on a template html page. relevant code : views.py page = entry.content page_converted = markdown2.Markdown().convert(page) context = {'mdentry': page_converted, "subject":subject} return render(request, "wikiencyc/md_entry.html", context) md_entry.html {% block content %} {{ mdentry|safe }} {% endblock %} The problem is how do I apply the Markdown2 conversion to a generic DetailView where all the boilerplate python code is in the django server code. I understand that I would have to find the relevant method or function within the django server code and override it as a local method in the generic view to accomplish the Markdown2 conversion. Right now, the detailview class is just: class EntryDetailView(generic.DetailView): model = Entry slug_field = 'subject' slug_url_kwarg = 'subject' The rest of the functionality to render the object to a view is embedded in the django server code. I need access to the relevant code to override it as local method to get the Markdown2 conversion. Which method of which class would it be. Or, can the markdown2 conversion be done directly on the template somehow. Any help greatly appreciated. -
How to open the edit section without refreshing the page for each post in Django Javascript?
this is my html template: <div class="posts"> <h3> <a href ="{% url 'profile' p.user.id %}"> {{p.user}}: </a> </h3> <p>{{p.timestamp}}</p> <br> <p><i class="fas fa-heart"></i> {{ p.likes.count }}</p> <p style="text-align: center;"> {{ p.post }} </p> {% if p.user.id == user.id %} <button class="btn btn-primary edit" style="display: inline;">Edit</button><hr></div> <div id="editsec"> <textarea rows=6 cols=100 style="opacity: 0.7;">{{p.post}} </textarea> <form action=""><button class="btn btn-success">Save</button></form> </div> {% endif %} {% endfor %} Now in css I hide the editsec, so only if user clicks on edit button, it will display editsec div and hide the posts div. Here is Javascript code: document.addEventListener('DOMContentLoaded', function() { var edit = document.getElementsByClassName('edit') for (var i = 0 ; i < edit.length; i++) { edit[i].addEventListener('click', () => { document.getElementById('editsec').style.display = "block"; document.querySelector('.posts').style.display = "none"; }); } }); Now if I have two post in home page, if I click on second post's edit button, it is still displaying the first post's editsec div. I tried to make this editsec a class and did this : document.addEventListener('DOMContentLoaded', function() { var edit = document.getElementsByClassName('edit') var editsec = document.getElementsByClassname('editsec') for (var i = 0 ; i < edit.length; i++) { edit[i].addEventListener('click', () => { for (var a = 0 ; a < edit.length; a++) { editsec[a].style.display … -
Jquery: Select all check boxes when 'select all' is checked
I have a form that prints a out menu items from each category. I want to have a select all checkbox over each category such that when clicked, all checkboxes of that category are selected - this part works with my script. Issue: Sometimes some check boxes are not checked by default e.g. no data in database - in that case the select all checkbox should not be checked when page is rendered (it should only checked if all its child check boxes are checked). Current partial implementation (checked is true for select all even if some of its some menu items are not checked?!): <form method="post"> {% for main_name, items in default_menu %} <table class="report"> <br /> <tr> <th colspan='2'></th> <th colspan='2'></th> <th colspan='2'></th> </tr> <tr> <th colspan='2'>{{main_name}}</th> <th colspan='2'>Available</th> <th colspan='2'><input id="{{main_name}}" class="all" type="checkbox" checked="true" /> </th> </tr> {% for url, item_name, selected in items %} {% if selected %} <tr> <td colspan='2'>{{item_name}}</td> <td colspan='2'><input name="{{main_name}},{{item_name}}" class="{{main_name}}-item" type="checkbox" checked="true"/></td> </tr> {% else %} <tr> <td colspan='2'>{{item_name}}</td> <td colspan='2'><input name="{{main_name}},{{item_name}}" class="{{main_name}}-item" type="checkbox" /></td> </tr> {% endif %} {% endfor %} </table> {% endfor %} <input type="submit" value="Save Setting" style="margin-top:20px; margin-left:0;"> </form> <script type="text/javascript"> checked = true; $(".all").click(function() { checked … -
Can Django Rest Framework and Channels be used to create Real-Time Messaging application?
I am a college student with a team 7 other developers like me. We and to develop a real time messaging mobile app (eg: WhatsApp, Messenger) etc. We have started development in React Native for the frontend and Django Rest Framework for the backend. My question is, can it be done? - If yes, then how should we go about it ? - If no, then what can be a possible alternatives and technologies ? the main issue I am facing is to implement real time web-sockets in Django rest framework. -
How to use stored procedures with Django backend?
I have created a stored procedure in SSMS for the query SELECT * FROM TABLE and now I want to create a Django API and test it. What is the entire procedure? My script from SQL Stored Procedure: USE [test] GO /****** Object: StoredProcedure [dbo].[spGetAll] ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO -- ============================================= -- Author: <Author,,Name> -- Create date: <Create Date,,> -- Description: <Description,,> -- ============================================= CREATE PROCEDURE [dbo].[spGetAll] AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements. SET NOCOUNT ON; -- Insert statements for procedure here SELECT * from app_comment END GO -
Embedding QuickChart.io image in HTML from Django app
I'm very new to HTML and web development so forgive me is this is an easy fix. QuickChart.io provides an image after calling the API. I've created a Django application that creates a custom URL to call QuickChart in my view file but struggling to have it appear when loading the page. My HTML is the following: {% block content %} <img src=quickchart_url> <p>{{ quickchart_url }}</p> {% endblock %} The site loads as follows: I can copy and paste the URL in a browser and it displays as intended. Just trying to figure out how I can have this appear from HTML. -
Django project failed to start syntax error '<frozen importlib._bootstrap>'
i just wanted to start project in django, but it failed with this code can anyone explain me what's wrong here, i am newbie in django pls help. And if you ask a can share with code that contains in documents. I've edited standard files and created some new files like urls.py and many inserted code for starting project. but it fails everytime when i start Watching for file changes with StatReloader Performing system checks... Exception in thread django-main-thread: Traceback (most recent call last): File "C:\Users\Bakhtyar\AppData\Local\Programs\Python\Python38-32\lib\threading.py", line 932, in _bootstrap_inner self.run() File "C:\Users\Bakhtyar\AppData\Local\Programs\Python\Python38-32\lib\threading.py", line 870, in run self._target(*self._args, **self._kwargs) File "C:\Users\Bakhtyar\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\utils\autoreload.py", line 53, in wrapper fn(*args, **kwargs) File "C:\Users\Bakhtyar\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\core\management\commands\runserver.py", line 118, in inner_run self.check(display_num_errors=True) File "C:\Users\Bakhtyar\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\core\management\base.py", line 392, in check all_issues = checks.run_checks( File "C:\Users\Bakhtyar\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\core\checks\registry.py", line 70, in run_checks new_errors = check(app_configs=app_configs, databases=databases) File "C:\Users\Bakhtyar\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\core\checks\urls.py", line 13, in check_url_config return check_resolver(resolver) File "C:\Users\Bakhtyar\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\core\checks\urls.py", line 23, in check_resolver return check_method() File "C:\Users\Bakhtyar\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\urls\resolvers.py", line 408, in check for pattern in self.url_patterns: File "C:\Users\Bakhtyar\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\utils\functional.py", line 48, in __get__ res = instance.__dict__[self.name] = self.func(instance) File "C:\Users\Bakhtyar\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\urls\resolvers.py", line 589, in url_patterns patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module) File "C:\Users\Bakhtyar\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\utils\functional.py", line 48, in __get__ res = instance.__dict__[self.name] = self.func(instance) File "C:\Users\Bakhtyar\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\urls\resolvers.py", line 582, in urlconf_module return import_module(self.urlconf_name) …