Category "django-urls"

Django. How to get URL by its name?

I want to get url by name specified in urls.py. Like {% url 'some_name' %} in template, but in Python. My urls.py: urlpatterns = [ ... path('admin_secti

ImportError: cannot import name 'url' from 'django.conf.urls'

ImportError: cannot import name 'url' from 'django.conf.urls' (/home/chams/pfe_project/CarApp/venv/lib/python3.8/site-packages/django/conf/urls/_init_.py) I can

Django 404 error-page not found, how can I solve this problem?

My project is named main, and when I runserver I get this error.Anybody have any clue how to fix this error. Page not found (404) Request Method: GET Request UR

Reverse for 'Profile' with no arguments not found

I'm trying to add user Profile in my django project. i was trying to access user post into the user Profile but its throws an error like this: Reverse for 'Pro

TypeError: cannot unpack non-iterable int object in Django views function

Following is my code in URL.py, views.py and HTML page. However, it returns me the error: TypeError: cannot unpack non-iterable int object. urlpatterns = [

Django media file not found

Media file is not getting. The fields related to User model are working(eg. object.username, object.email) but field with ProfileImage is not working. urls.py

Displaying child records based on parent id from URL

I have one model Dataset and another one called DatasetReview, where DatasetReview has a foreign key connection to Dataset. I would like to display all of the D

How do you add primary keys in a Django URL?

I am making a blog and I want to go to a specific blog post by clicking on a button. I know I need to use a primary key in the URL, but what is the syntax? And

how to use google login link to my login page using django-allauth?

I have created a project which is working nicely. I have a login page, signup page and profile page (as myspace). I just want to add an additional funtionality

Django: ImportError, No module named urls

I have the following urls.py file in my project directory: from django.conf.urls import patterns, include, url from django.contrib import admin admin.autodisco

django: invalid syntax path('details/<int:id>/', views.details, name='details')

views.py file def details(request, id): post = Posts.objects.get(id=id) context = { 'post': post } return render(request, 'posts/details.html', context)