django-2.0

How to filter choices in Django2's autocomplete_fields?

How to filter choices in Django2's autocomplete_fields? Question: In Django 2.0, autocomplete_fields was added, which is great. Without autocomplete_fields, I can change the queryset of a ForeignKeyField using formfield_for_foreignkey. But combining the two together doesn’t work – it looks like the list of options for autocomplete is dynamic and coming from a different url, instead …

Total answers: 5

Django 2.0: sqlite IntegrityError: FOREIGN KEY constraint failed

Django 2.0: sqlite IntegrityError: FOREIGN KEY constraint failed Question: I’m working on adding Django 2.0 support to the django-pagetree library. During automated testing, using an sqlite in-memory database, I’m getting a bunch of errors like this: File “/home/nnyby/src/django-pagetree/pagetree/tests/test_models.py”, line 638, in setUp ‘children’: [], File “/home/nnyby/src/django-pagetree/pagetree/models.py”, line 586, in add_child_section_from_dict … File “/home/nnyby/src/django-pagetree/venv/lib/python3.5/site-packages/django/db/backends/base/base.py”, line 239, …

Total answers: 10

NoReverseMatch with keyword argument uidb64 with Django 2.0

NoReverseMatch with keyword argument uidb64 with Django 2.0 Question: I can’t understand why my code doesn’t work. Before it worked, but now, when I run the server and test, the code does not work. When the user is registering, I send him activation email, like this: def send_activation_email(serializer, request, user): current_site = get_current_site(request) message = …

Total answers: 4

Getting TypeError: __init__() missing 1 required positional argument: 'on_delete' when trying to add parent table after child table with entries

Getting TypeError: __init__() missing 1 required positional argument: 'on_delete' when trying to add parent table after child table with entries Question: I have two classes in my sqlite database, a parent table named Categorie and the child table called Article. I created first the child table class and addes entries. So first I had this: …

Total answers: 13

ImportError: No module named 'django.core.urlresolvers'

ImportError: No module named 'django.core.urlresolvers' Question: I am working on Django project where I need to create a form for inputs. I tried to import reverse from django.core.urlresolvers. I got an error: line 2, in from django.core.urlresolvers import reverse ImportError: No module named ‘django.core.urlresolvers’ I am using Python 3.5.2, Django 2.0 and MySQL. Asked By: …

Total answers: 12