Questions tagged [django-2.2]

Django 2.2 is a version of the Django framework, released April 2019. It is a Long Term Support (LTS) release, and will be supported until at least April 2022. Please only use this tag if your question relates specifically to this version.

Django 2.2 works with Python 3.5, 3.6, 3.7, 3.8, and 3.9.

release notes

261 questions
2
votes
2 answers

slugify() got an unexpected keyword argument 'allow_unicode'

When I want to create new object from product I got this error: slugify() got an unexpected keyword argument 'allow_unicode' This is my models: class BaseModel(models.Model): created_date = models.DateTimeField(auto_now_add=True) …
rahnama7m
  • 865
  • 10
  • 38
2
votes
1 answer

ValueError attempted relative import beyond top-level package, despite PyCharm autofilling suggestions

I am attempting to import a model from a sibling package and am getting ValueError: attempted relative import beyond top-level package Strangely, I am auto-filling based on PyCharm suggestions, so the IDE is registering the module, but my build is…
2
votes
1 answer

"BLOB/TEXT column used in key specification without a key length" error in Django

I have this model in my Django project: class Institution(models.Model): name = models.CharField(unique=True, max_length=100, blank=True) description = models.TextField(max_length=500, null=True, blank=True) def __str__(self): …
rahnama7m
  • 865
  • 10
  • 38
2
votes
1 answer

How to process data from one model field to another

I have models of Exercise, Training and Workout. Training contains some exercises (Exercise) Workout contains trainings (Training). Snippet of my models.py: class Exercise(models.Model): user = models.ForeignKey(User, related_name='exercises', …
jbb
  • 79
  • 5
2
votes
1 answer

Multiple instance in one Django form for editing profile model objects

I used the profile method to be able to customize the user model. I also use this site to create a registration form in which both the user and the profile can be created at the same time. Now I want to write edite_user view. In this question I…
rahnama7m
  • 865
  • 10
  • 38
2
votes
0 answers

Customize update_last_login in Django

This is django update_last_login: #django.contrib.auth def update_last_login(sender, user, **kwargs): """ A signal receiver which updates the last_login date for the user logging in. """ user.last_login =…
rahnama7m
  • 865
  • 10
  • 38
2
votes
1 answer

Upload Image in the wrong directory in django ImageField

When I upload a photo, the photo is loaded successfully, but the photo is placed in the wrong directory. Instead of placing the image on the path to 'media/posts-pics/' - as I have outlined in my Post model - it is placed on the 'media' path. These…
rahnama7m
  • 865
  • 10
  • 38
1
vote
0 answers

(postgres) query on a table in cloned schema in postgres is taking more time than the original schema

I have cloned a schema in Postgres along with the data. The process I used for cloning the schema is mentioned below. The issue is that the same query on the same table is taking more time to execute on the cloned schema than on the original schema.…
1
vote
1 answer

Django Change all other Boolean fields except one

I have a model which has a boolean field: class Library(SocialLinksModelMixin): """ Represents book shelves and places where people have / leave books. """ user = models.ForeignKey(...) is_main =…
Hvitis
  • 502
  • 5
  • 14
1
vote
0 answers

Prevent Double Click in JS for in browser game using Django 2.2

I have an issue where it requires the button to be clicked twice in order to initiate the functions. Except that the first click initiates gameOver() and a second click initiates a gameOver() again. But it takes two clicks to initiate showGame() and…
Carlitos
  • 11
  • 3
1
vote
0 answers

Replace celery tasks in django with python async functions

I'm working with a django (django=2.2 & python3.6.9) project that has very few celery tasks. The celery background tasks currently in the project deal with sending emails, sending dashboard notifications etc. Below I mention examples of how the…
1
vote
1 answer

Where is ID saved in django ModelAdmin autocomplete_fields?

I am rewriting some administration interface to django 2.2, currently using django autocomplete_fields admin feature. Simply said I have ModelAdmin object OrderAdmin, which has nested TabularInline ProductAdmin: variable-length table of products…
wtdmn
  • 73
  • 1
  • 7
1
vote
4 answers

Django ModuleNotFoundError: No module named 'crispy_bootstrap5'

I am trying to import crispy_bootstrap5. I have activated my virtual environment after that I have update my requirements.txt in which it is installing crispy_bootstrap5 but getting error ModuleNotFoundError: No module named 'crispy_bootstrap5' I…
patel887
  • 167
  • 1
  • 11
1
vote
1 answer

Django POST multipart/form-data unexpectedly parsing field as array

I am testing an endpoint in the following manner: from rest_framework.test import APIClient from django.urls import reverse import json client = APIClient() response = client.post(list_url, {'name': 'Zagyg Co'}) I find that the model object is…
1
vote
2 answers

allauth urls are not accessible - 404 error

Can someone please help to solve my issue. Thanks in advance when i try to access 'accounts/' in django,then causing 404 error. I'm using allauth. URL Trying to access : http://127.0.0.1:8000/accounts/ URL's below are showing errors: Page not found…