Questions tagged [django-2.1]

Django 2.1 is a version of the Django framework, released August 2018. Please only use this tag if your question relates specifically to this version.

Django 2.1 works with Python 3.5, 3.6, and 3.7. Django 2.0 is thus the last version that worked with Python 3.4.

release notes

245 questions
2
votes
3 answers

Django extends only one template

I have an app called exercise_tracker and want to extend my base.html with two templates: exercise_list.html and footer.html. For exercise_list.htmlI have set a view for footer.html not. It doesn't render the content of footer.html. Can you give me…
didierCH
  • 378
  • 2
  • 17
2
votes
7 answers

python manage.py runserver error : ModuleNotFoundError: No module named 'settings'

I am in the process on getting started with python and have run into a problem using django 2.1 and python 3.7 that many other people seem to have had as well. Below is my process for getting here: started a virtual environment started a django…
N00b_Overflow
  • 53
  • 1
  • 2
  • 9
2
votes
1 answer

When click change password is blank page but password was changed django

I create login page. My problem is with "forgotten password". User enter a mail and django send a message with link. When click on it must change password. When complet click on "Change password" we should move on next page but it is blank. But…
Martix
  • 143
  • 1
  • 6
2
votes
1 answer

'WSGIRequest' object has no attribute 'sessions' (Django 2.1.2)

I am working on a django web app and I need to use sessions and cookies. I wasn't getting this error before while using sessions and cookies but now It is happening again: AttributeError at /dashboard/ 'WSGIRequest' object has no attribute…
2
votes
1 answer

View thumbnails of uploaded images in django admin

I am trying to add thumbnails to list view in django admin. This is my admin.py for my app, i got this far: from django.contrib import admin from .models import Image from django import forms from django.db import models class…
Adam
  • 459
  • 2
  • 17
2
votes
1 answer

Unable to create custom user model with Django 2.1 and Python 3.5

I'm trying to create a custom user model (as I've done several times before) in an attempt to remove the "username" field and replace it with the "email" field. I created a brand new project and installed the latest version of all packages in a…
Soviero
  • 1,774
  • 2
  • 13
  • 23
2
votes
2 answers

Change url in Django

I am trying to load a pdf file in django which is already present in the database. I can access the pdf file using the url, "localhost:8000/documents/file.pdf" but when I perform the query and return the response containing this file, url it…
Tahseen Rahman
  • 97
  • 3
  • 13
2
votes
2 answers

Urls with Categories slug and Post slug using Class Based View

I'm developing a simple blog to learn Django. I would like to have a path for each posts like this: /category-1/title-post /category-2/title-post etc.. Below urls.py from django.urls import include, path from .views import CategoryList,…
MaxDragonheart
  • 1,117
  • 13
  • 34
2
votes
1 answer

How to pre-populate Django ModelForm fields

I have the following ModelForm: class IssueProcessForm(forms.ModelForm): def __init__(self, *args, **kwargs): super(IssueProcessForm, self).__init__(*args, **kwargs) self.fields['number'].disabled = True …
Caspian
  • 633
  • 1
  • 10
  • 29
2
votes
1 answer

filter_horizon or filter_vertical for InLine ManyToMany field at Django 2.x Admin

Here is my model relation (copied from Django 2.1 official documentation - my model is an exact copy of this but only the model names are different.): class Person(models.Model): name = models.CharField(max_length=50) class…
thiras
  • 521
  • 1
  • 6
  • 22
2
votes
1 answer

Module 'django.db.models' has no attribute 'FileBrowseField'

I would like to have on my Django 2.1.1 site django-filebrowser-no-grappelli. I've followed this indications but at the end of the procedure, when I restart my server, I've this error: header_image = models.FileBrowseField("Image", max_length=200, …
2
votes
1 answer

Django form is not saving image file

In this webapp I have a question model and a question diagram model. Whenever the user uploads an image, it is supposed to be saved in media/question_image folder. It is working fine if I upload from the admin panel, but when I upload the image from…
Bidhan Majhi
  • 1,320
  • 1
  • 12
  • 25
2
votes
1 answer

Is it possible to add 2nd slug to URL path in Django?

I'm using Django version 2.1. I want to create this type of URL Path in my Project: www.example.com/bachelor/germany/university-of-frankfurt/corporate-finance Is it possible to do it in Django?
Ulvi
  • 965
  • 12
  • 31
2
votes
4 answers

Get next and previous object from QuerySet by object

I have and object and QuerySet which contains this object. I need to get next and previous object of this QuerySet. How can I do that? I could get next this way: next = False for o in QuerySet: if next: return o if o==object: …
Milano
  • 18,048
  • 37
  • 153
  • 353
2
votes
2 answers

Django: TypeError: '<' not supported between instances (model objects)

I'm trying to migrate my Django project from Python 2.7/Django 1.11 to Python 3.7/Django 2.1. I've found one issue and I want to understand its cause. I have 3 models in my project: class DeviceModel(models.Model): name =…
kostr22
  • 576
  • 7
  • 27