Questions tagged [django-1.9]

Django 1.9 is a version of the Django framework, released December 2015. Please only use this tag if your question relates specifically to this version.

Django 1.9 supports Python 2.7, 3.4, and 3.5.

Here are a list of changes:

Django 1.9 was released in December 2015 and was supported until April 2017.

273 questions
11
votes
4 answers

Can PermissionRequiredMixin and LoginRequiredMixin be combined?

I have some users that are allowed to see a certain view. To allow users to login and complain with a 403 Forbidden for those users that cannot see that login, I can use the following (as explained here): @permission_required('polls.can_vote',…
MariusSiuram
  • 3,380
  • 1
  • 21
  • 40
10
votes
1 answer

Django Json field filter throws lookup error

I am using django postgres JSONfield and the model structure is as below from django.contrib.postgres.fields import JSONField class JsonAnswer(models.Model): name = models.CharField(max_length=255) data = JSONField(default={}) the data…
Mallik Sai
  • 186
  • 1
  • 4
  • 16
10
votes
2 answers

Django 1.9 with CORS dumping data: "corsheaders_corsmodel" does not exist

I'm developing a Django (1.9) Rest backend and AngularJS frontend with Cross-site referencing. While attempting to execute a ./manage.py dumpdata command, it throws the following exception: $ python manage.py dumpdata -o…
user3897818
  • 101
  • 3
10
votes
1 answer

How to pass callable in Django 1.9

Hi i am new in Python and Django and I follow the django workshop guide. I just installed Python 3.5 and Django 1.9 and get a lot of error messages ... Just now I found a lot of dokumentations but now stuck. I want to add views and and so I added…
Pompi
  • 123
  • 1
  • 7
8
votes
2 answers

django one app one model multiple databases

I am new to django webapp development and i am stuck with a problem. I have created 1 app with 1 model to insert data to the database using 1 form. I am going to use multiple databases for this. Each database will have 1 table(for now) with same…
rrawat
  • 1,071
  • 1
  • 15
  • 29
8
votes
4 answers

Django URL without trailing slash not working

This is a silly problem. I just created a project and have been trying to figure out this problem. from django.conf.urls import url from django.views.generic import TemplateView urlpatterns = [ url(r'^$',…
Magnus Teekivi
  • 473
  • 1
  • 7
  • 21
8
votes
2 answers

Removing a Django migration that depends on custom field from an old module

I have a Django 1.8 application whose initial migration relies on django-interval-field like this: import interval.fields migrations.CreateModel( name='Item', fields=[ ... ('estimated_time',…
nnyby
  • 4,748
  • 10
  • 49
  • 105
7
votes
3 answers

Querying ManyToMany in Django giving me duplicate results

I have two models class Tag(models.Model): key = models.CharField(max_length=200) class Post(models.Model): name = models.CharField(max_length=200) tags = models.ManyToManyField(Tag) I m trying to filter out posts with a list of tags.…
qwertyui90
  • 191
  • 2
  • 14
7
votes
5 answers

Converting GET request parameter to int ... if it is numeric

lets say i'm showing some data to user , i want user to be able to perform some sort of filtering on a numeric field in the database using a GET form so i have something like this code = request.GET.get('code') condition = {} if( code is not…
hretic
  • 999
  • 9
  • 36
  • 78
6
votes
3 answers

ModuleNotFoundError: No module named 'django.urls'

Whenever I try to run "python manage.py runserver" in Powershell as admin, I get an **ModuleNotFoundError: No module named 'django.urls'**. Can somebody help me please?! I'm using django 1.9 and python 3.6 IN POWERSHELL File …
Nitin Kamath
  • 75
  • 1
  • 2
  • 6
6
votes
1 answer

django.core.exceptions.ImproperlyConfigured: Enable 'django.contrib.auth.context_processors.auth'

I started a new project and am getting: django.core.exceptions.ImproperlyConfigured: Enable 'django.contrib.auth.context_processors.auth' in your TEMPLATES setting in order to use the admin application. I followed the django docs for 1.9: TEMPLATES…
codyc4321
  • 9,014
  • 22
  • 92
  • 165
6
votes
2 answers

django-registration (1048, "Column 'last_login' cannot be null")

I'm trying to use django-registration in my simple project. settings.py # DJANGO REGISTRATION ACCOUNT_ACTIVATION_DAYS = 7 AUTH_USER_EMAIL_UNIQUE = True EMAIL_HOST = 'localhost' EMAIL_PORT = 1025 EMAIL_HOST_USER = '' EMAIL_HOST_PASSWORD =…
Stan Zeez
  • 1,138
  • 2
  • 16
  • 38
5
votes
2 answers

Django CSRF verification failed. Request aborted even with @csrf_exempt

This is my view.py I am trying to get a response from a Payment Gateway but m getting an 403 Forbidden CSRF verification failed. Request aborted. after Payment I exempted CSRF Token for the view but still its showing same Error from…
Bijoy
  • 1,131
  • 1
  • 12
  • 23
5
votes
1 answer

Consider setting $PYTHONHOME to [:] error

I am constantly getting same error when i do python manage.py runserver. There was no such error when i have ubuntu 15.10. This got started when i upgraded my ubuntu to 16.04. This question might look duplicate but i have tried solution provided to…
Tushant
  • 1,534
  • 1
  • 14
  • 24
5
votes
4 answers

How to calculate distance between two PointField?

I use Postgis with Django to store geographic points. I have a model like the following: from django.contrib.gis.db import models class Event(models.Model) position = models.PointField() I have two events(ev1, ev2). Here is the position value…
Michael
  • 1,557
  • 2
  • 18
  • 38
1
2
3
18 19