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
40
votes
5 answers

Django 3.1 | Admin page appearance issue

Today I have updated Django to latest version 3.1. But for some reason when the logged in to admin page, all I cans see is a weird looking admin page. admin.py Can someone help me what went wrong or what are things I need to modify to get back to…
Raghavendra
  • 521
  • 5
  • 11
22
votes
1 answer

How to integrate Faust with Django?

I am trying to integrate Faust with Django to publish the messages to Kafka. Here is the example in Faust repo: https://github.com/robinhood/faust/tree/master/examples/django I modified it a bit, and created views to push data to Kafka via…
Maverick
  • 2,738
  • 24
  • 91
  • 157
12
votes
1 answer

What became available_attrs on Django 3?

First of all, I'm new to Django, so please be nice with me :D I'm currently adapting .py files for Django 3 because the files I have are compatible for Django 2. So, some changes have been made for the new version and in a file, it's written…
Maxime Teillaud
  • 123
  • 1
  • 5
11
votes
1 answer

Django 3.1+: (fields.E180) SQLite does not support JSONFields

I have created a Django project with the new JSONField announced in Django 3.1, which supports all databases. I have successfully used this field on a linux machine, but running python manage.py migrate with the same project on Windows fails with…
Udi
  • 29,222
  • 9
  • 96
  • 129
10
votes
3 answers

Unexpected error: replace() takes 2 positional arguments but 3 were given

In settings.py I have: BASE_DIR = Path(__file__).resolve().parent.parent Then In some view: from django.http import HttpResponse from django.conf import settings def test_view(request): return HttpResponse( settings.BASE_DIR.replace("src",…
Oto Shavadze
  • 40,603
  • 55
  • 152
  • 236
6
votes
2 answers

Django 3.1 - async views - working with querysets

Since 3.1 (currently beta) Django have support for async views async def myview(request): users = User.objects.all() This example will not work - since ORM is not yet async ready so what's the current workaround ? you cannot just use…
Djangonaut
  • 5,511
  • 7
  • 40
  • 53
4
votes
2 answers

Django How to check a request is Ajax

The HttpRequest.is_ajax() method is deprecated as it relied on a jQuery-specific way of signifying AJAX calls, while current usage tends to use the JavaScript Fetch API. Depending on your use case, you can either write your own AJAX detection method…
Ayaz Ur Rashid
  • 221
  • 3
  • 9
4
votes
1 answer

django 3.1 passing raw column aliases to QuerySet.order_by() is deprecated

I'm working on a project which just moved to django 3.1. And I need to remove the usage of this "passing raw column aliases to QuerySet.order_by()" thing. However, I am not sure if my project is using it. So I need to understand how "passing raw…
Unknown
  • 41
  • 1
4
votes
1 answer

How to calculate total working hours in Django?

I created the following model: class Timesheet(models.Model): date = models.DateField(auto_now=False, auto_now_add=False, verbose_name="Data") entry = models.TimeField(auto_now=False, auto_now_add=False, verbose_name="Hora Entrada") …
overclock
  • 585
  • 3
  • 20
4
votes
2 answers

Django ".widget.attrs.update" with NO effect

I have a ModelForm with the following init method: def __init__(self, *args, **kwargs): super(FragebogenForm, self).__init__(*args, **kwargs) self.fields['birth_date'].widget.attrs.update({'type': 'date'}) This doesn't change the type…
R-obert
  • 553
  • 4
  • 13
4
votes
2 answers

How to set Django template path properly?

In most recent django documentation "Overriding from the project’s templates directory" https://docs.djangoproject.com/en/3.1/howto/overriding-templates/ it shows that you can use the following path for templates: TEMPLATES = [ { …
Andrea
  • 153
  • 1
  • 11
3
votes
2 answers

In Django's auth contrib module, how do I validate a token submitted from a reset password form?

I'm using Django 3.1 with its auth contrib module. I have an API-only application, in which I initiate a password reset using the following Django view class ResetPasswordView(SuccessMessageMixin, PasswordResetView): …
Dave
  • 15,639
  • 133
  • 442
  • 830
3
votes
0 answers

Can I use Django truncatewords filter without image fields?

I upload a photo with ckeditor on my blog and show this photo in the content area. To show the summary of a blog on the home page, I limit the content area to truncatewords, but if there is an image within the word limits I specified, this image is…
3
votes
0 answers

decode the django session value in django 3.1

Not able to decode Django session values which are being stored in django_session…
lalithkumar
  • 3,480
  • 4
  • 24
  • 40
3
votes
1 answer

How can I check which Django middleware is synchronous or asynchronous?

I am using Django 3.1. I would like to see if I can use async to handle my webhook so as to give a faster response. From Async View, it states that: Middleware can be built to support both sync and async contexts. Some of Django’s middleware is…
Benny Chan
  • 730
  • 1
  • 8
  • 24
1
2 3
8 9