Questions tagged [django-1.10]

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

Django 1.10 requires Python 2.7, 3.4, or 3.5.

Here are a list of changes:

Django 1.10 was released in August 2016 and was supported until December 2017.

191 questions
123
votes
6 answers

Django URLs TypeError: view must be a callable or a list/tuple in the case of include()

After upgrading to Django 1.10, I get the error: TypeError: view must be a callable or a list/tuple in the case of include(). My urls.py is as follows: from django.conf.urls import include, url urlpatterns = [ url(r'^$', 'myapp.views.home'), …
Alasdair
  • 298,606
  • 55
  • 578
  • 516
15
votes
2 answers

Annotate QuerySet with first value of ordered related model

I have a QuerySet of some objects. For each one, I wish to annotate with the minimum value of a related model (joined on a few conditions, ordered by date). I can express my desired results neatly in SQL, but am curious how to translate to Django's…
David Cain
  • 16,484
  • 14
  • 65
  • 75
14
votes
10 answers

The current URL, app/, didn't match any of these

I'm a newbie in Django and just started looking at it before a day by installing Django 1.10 on my local. I've followed all the instructions of this link https://docs.djangoproject.com/en/dev/intro/tutorial01/. However I'm continuously getting this…
Dhaval
  • 901
  • 3
  • 8
  • 26
12
votes
11 answers

DRF auth_token: "non_field_errors": [ "Unable to log in with provided credentials."

Both JWT packages written for Django gave me issues with poor documentation, so I try DRF-auth_token package. This is a good example I followed, Django Rest Framework Token Authentication. You should in theory be able to go…
codyc4321
  • 9,014
  • 22
  • 92
  • 165
12
votes
4 answers

"PermissionError: [Errno 13] Permission denied: '/usr/lib/python3.5/site-packages'" installing Django

I cannot install basic Django packages on Ubuntu. I just deleted virtualenv and remade it. pip3install = pip3 install -r requirements.txt [mything] cchilders@cchilders-desktop:~/projects/mything (master) $ cat requirements.txt…
codyc4321
  • 9,014
  • 22
  • 92
  • 165
7
votes
2 answers

Testing custom Django middleware without using Django itself

I have coded my custom Django middleware in the 1.10 style, similar to this: class MyMiddleware(object): def __init__(self, get_response): self.get_response = get_response # some initialization stuff here def __call__(self,…
Photon Light
  • 757
  • 14
  • 26
6
votes
3 answers

How can I include a conditional order_by in django?

I need to sort two parts of a queryset differently based on a boolean field. - Rows that have bool_val == True should come first, and be sorted by date_a, ascending. - Rows that have bool_val == False should come second, and be sorted by date_b,…
Charlotte Mays
  • 325
  • 4
  • 11
6
votes
3 answers

Do not internationalize/translate URLs

Problem I'm currently trying to upgrade to Django 1.10.3 from Django 1.9.8. Currently my tests are failing however, because for some reason Django is trying to translate/internationalize my URLs when I reverse() them. I've not changed anything when…
Bono
  • 4,757
  • 6
  • 48
  • 77
5
votes
2 answers

How can I add additional data to Django messages?

I'm trying to integrate this snippet into our Django project: It's just custom HTML and CSS for messages. The html looks like this:
Milano
  • 18,048
  • 37
  • 153
  • 353
5
votes
1 answer

Import Polygon Data from geojson files into PostGIS using GeoDjango

Am using GeoDjango with PostGIS as Backend. I have few geojson files with features as following example. GeoDjango has provided information to import shape files and other formats but geojson formats. How do I import these geojson files into DB? …
Ankit Singh
  • 61
  • 1
  • 4
5
votes
2 answers

Django Error: Your URL pattern is invalid. Ensure that urlpatterns is a list of url() instances

After upgrading to Django 1.10, I get the following error when I run python manage.py runserver: ?: (urls.E004) Your URL pattern ('^$', 'myapp.views.home') is invalid. Ensure that urlpatterns is a list of url() instances. HINT: Try using url()…
Alasdair
  • 298,606
  • 55
  • 578
  • 516
4
votes
2 answers

ForeignKey to 'self' in sub-application throws error on makemigrations in Django project

I'm currently working on an large Django project (version 1.10.7) and am running into an error with a model field in a sub-application. Here's what the basic structure looks like: project/ app_one/ __init__.py apps.py …
4
votes
0 answers

Django admin - list_editable - foreign key attribute?

Is it possible to make editable ForeignKey attribute in change list? Every user has it's UserProfile object (OneToOneField). I want admin to be able to modify UserProfile expiry date from User change list. I can display the expiry in change…
Milano
  • 18,048
  • 37
  • 153
  • 353
4
votes
2 answers

How create Multiple Select Box in Django?

I am tring to create Multiple Select Box field from Django Select 2 library as in the picture below? I used next code but it return simple select multiple widget. I think I forgot something to add. Where is my mistake? Can someone show me how create…
Nurzhan Nogerbek
  • 4,806
  • 16
  • 87
  • 193
4
votes
1 answer

Opening a new browser tab invalidates Django's CSRF token, preventing form submission

Opening a Django 1.10 application in a second browser tab refreshes the CSRF token. This breaks all forms in the first tab -- i.e., previously opened forms can no longer be submitted because the old CSRF token is now invalid. How do I avoid this…
tino
  • 4,780
  • 5
  • 24
  • 30
1
2 3
12 13