Questions tagged [django-3.1]

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

Django 3.1 works with Python 3.6, 3.7, 3.8, and 3.9.

Here are some of the salient features of Django 3.1:

Django 3.1 was released in August 2020 and was supported until August 2022.

126 questions
1
vote
1 answer

Django postgres connection, SET timezone for psycopg2

In django settings.py I have TIME_ZONE = 'Asia/Tbilisi' I have same timezone for postgres also and separately, both works correctly. Though, in Django, when I run raw queries like: from django.db import connection ... cursor =…
Oto Shavadze
  • 40,603
  • 55
  • 152
  • 236
1
vote
1 answer

Register, Login, Logout with django class based views

I am trying to make an authentication system with django class based views What I have tried so far: This is my views.py file: from django.shortcuts import render from django.views import generic from .forms import UserRegistrationForm from…
1
vote
0 answers

Is it possible to store a django template tag value, like lorem, in a variable?

I came across a scenario where I wanted to display a fake name on a django 3.1 template. So I used the following code: Name: {% lorem 2 w random %} Then I realized I had another location on my display that would contain the same name. Of course…
Douglas T
  • 181
  • 2
  • 7
1
vote
2 answers

Having trouble passing variables from my database to my website using Django 3

I am still a newbie to django and have recently begun on a project with numerous models. the problem is whenever i want to pass a variable from my database to my website templates when i run the site i do not see my variables, they just appear…
1
vote
1 answer

User ModelForm not getting saved in database (Django)

I have a ModelForm that creates an instance of a custom user (AbstractUser model). Whenever I try to submit the form, nothing happens except a reload of the page (because of the action), and nothing is getting saved in the database. The code is as…
Shufi123
  • 233
  • 3
  • 11
1
vote
1 answer

Get file URL from raw django SQL query

I have two models class Post(models.Model): ... class PostImage(models.Model): post = models.ForeignKey(Post) ... In a ListView I need to query a post and one image for it, so I end up writing a raw query. What I hit now is that the url…
Zarrie
  • 325
  • 2
  • 16
1
vote
2 answers

My first django app - how to import templates?

I am creating my first django app in django 3.1.1. There are video tutorials for old django versions and they don't always work... I want to create HTML pages for both home and about sections. I have already written some HTML files, but the def…
Swantewit
  • 966
  • 1
  • 7
  • 19
1
vote
2 answers

Django-jenkins --enable-coverage returns 'Coverage' object has no attribute 'data'

I am using django-jenkins v0.110.0 and coverage v5.2.1 , with Django v3.1. As mentioned in the subject, when I ran: python manage.py jenkins --enable-coverage I get this error: AttributeError: 'Coverage' object has no attribute 'data' Below is…
jaysonpryde
  • 2,733
  • 11
  • 44
  • 61
1
vote
1 answer

GET /static/vendor/select2/dist/css/select2.css HTTP/1.1" 404 1832

I am trying to create a dropdown of countires which can be searchable based on this doc, however almost disappointed to find any solution by googling. I am using django-cities-light package and django-autocomplete-light, and all I need to do is…
J2015
  • 320
  • 4
  • 24
1
vote
0 answers

Django FormView manually set session data lost after redirect

I am using FormView to get some input from the user. I then try to set some of that data into the session to be used after the form validates and the user is redirected. The data is however lost. The view: class SomeFormView(FormView): …
T-101
  • 209
  • 2
  • 13
1
vote
2 answers

TemplateSyntaxError: Variable 'user.profile.photo' is an invalid source

I have problem with accessing by the link. I am using easy-thumbnail framework, and I created simple view for user list to list all existing users. Error message: django.template.exceptions.TemplateSyntaxError: Variable 'user.profile.photo' is an…
existentia
  • 308
  • 2
  • 12
1
vote
0 answers

Django form not saving data

This is a normal form filling code where I created form and passing request.post into it. The post request data is captured properly but is not getting saved after been passed into forms. The django version 3.1 is the base lang. ===view=== def…
JThayil
  • 21
  • 3
1
vote
2 answers

Fail to display the context passed to templates while using Django3.1

I want to use Django to make a notice board on my website, so I made a model like this: class notice(models.Model): # the title of the notice text = models.CharField(max_length = 50) date_added = models.DateTimeField(auto_now_add =…
1
vote
0 answers

Send a file to an external api from "InMemoryUploadedFile" in Django

In the Django Framework I would like to post a file, received as an InMemoryUploadedFile, to a different server as soon as it is received. I Have tried the solution in Django - post InMemoryUploadedFile to external REST api but the solution did not…
Chirag Kamat
  • 89
  • 1
  • 10
0
votes
0 answers

Why upgrading django version to 3.2 makes the project run "ValueError: Empty module name"?

when I upgrade django version from 3.1 to 3.2 and run my django project, I faced this error: Exception in thread django-main-thread: Traceback (most recent call last): File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner …
1 2 3
8 9