Questions tagged [django-2.0]

Django 2.0 is a version of the Django framework, released December 2017. Please only use this tag if your question relates specifically to this version.

Django 2.0 requires Python 3.4, 3.5, or 3.6. It is the first version of Django to support only Python 3.

Here are some of the salient features of Django 2.0:

Django 2.0 was released in December 2017 and was supported until April 2019.

423 questions
0
votes
0 answers

build_absolute_uri inside model in Django

I'm using Django 2.0 In my application's models.py file I have defined get_absolute_url() to get the absolute URL of the instance. This model class is used as URL shortener and stores a short_key. This will produce url…
Anuj TBE
  • 9,198
  • 27
  • 136
  • 285
0
votes
1 answer

How to put limitation on url patterns in Django 2

Django 1.11 uses regular expression to check for appropriate url. eg url(r'^(?P[0-9]{4})/$', views.abc), Here I could check that my year is 4 digits. The new way introduced is like path('/', views.abc), Is there a default way to…
0
votes
1 answer

reach object detail in template using Listview class django 2

I'm following a tutorial and I'm tying to show each object property (that is saved in db) in my template html file like this: {% for obj in objects_list %}

{{ obj.name }} => {{ obj.location }} timecreated==> {{ obj.timestamp }} time…

moh
  • 433
  • 10
  • 33
0
votes
1 answer

django 2.0 path aren't added

i use path instead of url in django 2.0 but there is a problem Following is my code oauth2_endpoint_views = ([ path('authorize/', oauth2_views.AuthorizationView.as_view(), name='authorize'), path('token/', oauth2_views.TokenView.as_view(),…
fuzes
  • 1,777
  • 4
  • 20
  • 40
-1
votes
1 answer

Error 415 when api rest call to update a django model

I'm using djangorestframework, django 2.1.4, and python 3.6+ I have a simple model that I'm trying to add via a script that uses requests. Even though I'm passing in the data via a json format, it is giving me a 415 error. What do I need to do to…
-1
votes
1 answer

hello_world() missing 1 required positional argument: 'request'

Please assist figuring out solution to this error. courses/ views.py from django.http import HttpResponse from django.shortcuts import render from .models import Course def course_list(request): courses = Course.objects.all() return…
Vishesh
  • 11
  • 2
-1
votes
2 answers

how to redirect a form error to the form page with validaton errors

i had created a form with user details and written a class view to update users details in my django aapp, everything is working but, instead of form widgets i hand coded form in page through that form i am updating the details. I didn't understand…
nithin singh Gm
  • 129
  • 1
  • 2
  • 10
-1
votes
1 answer

Django login only for registered user and on logout back to login page

I have created a login view in my project urls.py, urlpatterns = [ path('login/', views.LoginView.as_view(template_name='login.html'), name='login'), ] login.html

Login

-1
votes
2 answers

Unable to display Images from Django Imagefield

I am able to load images to the specific path using Imagefield but not able to display those images in my html templates. enter image description here my settings.py : STATIC_ROOT = "/app/static/" STATIC_URL = '/static/' STATICFILES_DIRS = ( …
-1
votes
2 answers

python routing regex

I am struggling with urls.py. Error: [pylint] E0602:Undefined variable 'patterns' In code: from django.conf.urls import * from django.contrib import admin urlpatterns = patterns('', # Examples: # url(r'^$', 'mysite.views.home',…
PyDeveloper
  • 309
  • 6
  • 24
-1
votes
1 answer

django2: url based on pk not working

I want to have a form (webpage) for the model ImpCalendar so I can edit it's data. The url should have the calendar_id (primary key), which i set in the urls.py The model (ImpCalendar) has a ForeignKey to Establishments. I do not use that foreignkey…
DigFor
  • 13
  • 1
  • 5
-1
votes
3 answers

NameError-- name 'logs' is not defined. Django-Python

from django.conf.urls import include, url from django.contrib import admin urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^logs/', include(logs.urls)), ] I have written this code in main/urls.py file code in logs/urls.py is…
Bhulawat Ajay
  • 287
  • 2
  • 3
  • 16
-1
votes
1 answer

how to get the data from view to templates?

i'm trying to get the data from my views.py to the html page. if the views.py code is this def VerifiedBySuperuser(request): if request.method == 'POST': vbs = MaanyaIT_EXAM48_ManageQuestionBank() vbs.QuestionID =…
pawas kr. singh
  • 416
  • 1
  • 4
  • 12
-1
votes
1 answer

django 2 Authentification

Problem of urls in django Authentification this is my app urls.py from django.urls import path, re_path from . import views app_name = 'music' urlpatterns = [ path('register/', views.register, name='register'), path('login_user/',…
-1
votes
1 answer

django_tables2 gives Tag {% querystring %} error although it is included in settings.py

I have this very simple django_tables2 setup that gives this error and I don't understand why (http://django-tables2.readthedocs.io/en/latest/pages/table-data.html#list-of-dicts): Error: Tag {% querystring %} requires…
Claudiu Creanga
  • 8,031
  • 10
  • 71
  • 110
1 2 3
28
29