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
3
votes
0 answers

Adding a parent to django-mptt in Admin page throws an error

I had a model, which I changed to be MPTTModel, which looks like this class ServiceRequest(EntityBase, MPTTModel): parent = TreeForeignKey('self', null=True, blank=True, related_name='children', db_index=True) field1 =…
GriMel
  • 2,272
  • 5
  • 22
  • 40
3
votes
0 answers

Cannot create form field for 'country' yet, because its related model 'address.Country' has not been loaded yet (when upgrading Django 1.8 to 1.9)

I'm developing a subscription site which includes a 'signup' app. I'm also using a django-oscar shop for one-off purchases and using its UserAddress classes across the whole site. However, as my address and username/email forms are on the same page…
birophilo
  • 912
  • 10
  • 20
3
votes
1 answer

Reset long Django migrations

As a project grows, migrations (both makemigrations and migrate) take longer and longer delaying quite a lot every deployment. Django let's you to squash them so you don't have a long list of migration files but still, the migrations take the same…
dnaranjo
  • 3,647
  • 3
  • 27
  • 41
3
votes
4 answers

How do I check if a User is using a mobile device in Django 1.9?

I'm using Django 1.9 with Python 2.7 and I'm trying to get my app to recognize if the user is browsing with a mobile device. I've tried django_mobile but it seems outdated for django 1.9 because there aren't even template_loaders to install the app,…
Ulmer
  • 1,530
  • 2
  • 17
  • 24
3
votes
2 answers

How to redo makemigrations after getting an error?

So first I ran makemigrations and then I ran migrate and got the error ValueError: The database backend does not accept 0 as a value for AutoField. So I went ahead, modified my models.py to fix that error. Now, when I run makemigrations to start…
User
  • 23,729
  • 38
  • 124
  • 207
3
votes
1 answer

Django 1.9 Custom Logging Handler Class: "Unable to configure handler 'mail_admins': Apps aren't loaded yet."

I'm in the process of upgrading an existing Django application from 1.8 to 1.9 (1.9.4, specifically). I use a custom logging handler to send admin error emails through a third-party email provider (SendGrid). When executing the runserver command,…
Marc
  • 176
  • 2
  • 8
3
votes
3 answers

Import Error : No module named django_orm

While importing CredentialsField from oauth2client.django_orm, I am getting: Import Error: No module named django_orm I've already installed the prerequisites: django-orm and python-oauth2.
dhiraj kumar
  • 109
  • 2
  • 6
3
votes
1 answer

Django 1.9 "Common Password Validator" - Strange Behaviour

I'm attempting to replace the built in common-passwords.txt.gz file, which supposedly contains the top 1,000 common passwords, with my own identical version which contains the top 10,000 common passwords for my country, but I've encountered some…
TimJ
  • 399
  • 4
  • 18
3
votes
4 answers

Django 1.9 tutorial __str__ () not working

I am trying Django 1.9 tutorial with Win 10 os and Python 3.5 and Django version is 1.9. I have successfully created and stored values in "Question" and "Choice". After this when i have changed polls/model.py with __str__() as per tutorial django…
Maitray Suthar
  • 263
  • 2
  • 13
3
votes
1 answer

Django - ValueError: ModelState.fields cannot refer to a model class - "tags.to" does. Use a string reference instead

I have this migration: # encoding: utf8 from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('main', '0013_post_tags'), ] operations = [ …
Q-bart
  • 1,503
  • 4
  • 22
  • 41
3
votes
1 answer

Django Rest Framework: How can I patch a serializer for unit testing, when it's used in the serializer_class attribute?

I have a serializer with an create() function. When I do a POST request, then I want to get this function called and create a new object. When I do it in the browser, it works and it also calls the function. But inside the test, it says that the…
3
votes
1 answer

Use signals in Django 1.9

In Django 1.8, I was able to do the following with my signals, and all was well: __init__.py: from .signals import * signals.py: @receiver(pre_save, sender=Comment) def process_hashtags(sender, instance, **kwargs): html = [] for word in…
jape
  • 2,861
  • 2
  • 26
  • 58
3
votes
1 answer

Django 1.9: Should I avoid importing models during `django.setup()`?

Porting my app to django 1.9, I got the scary django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet Basically my stacktrace is: manage.py execute_from_command_line(sys.argv) django/core/management:352, in…
damio
  • 6,041
  • 3
  • 39
  • 58
2
votes
0 answers

Django LiveServerTestCase - Unable to force_login in multiple tests

Versions Django version: 1.9 Python: 3.5 Django Rest Framework: 3.5.4 Error Observed: Error Traceback (most recent call last): File "/Users/ds/git/some_repo/integration/test_multiple_login.py", line 32, in test_two …
Deep
  • 1,151
  • 11
  • 18
2
votes
1 answer

Django-Postgres WHERE query using varchar_pattern_ops index instead of pkey index

I have a Django-Postgres setup with this table - class User(models.Model): id = models.CharField(max_length=255, primary_key=True) Running the migration creates two indexes on the field (which is what Django automatically does as I checked…