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
5
votes
1 answer

foreign key as initial value not passed to the ModelForm in django

I need to pass the value (based on category_id) for a ForeignKey to the ModelForm but it's not working. My field remains "--------" and proper value is not set from the drop-down field. Value for the Category must BE SELECTED and other values must…
5
votes
2 answers

Django 1.9 - Not displaying user uploaded images

I am trying to display images that have been uploaded by the user, but no matter what I try I am getting the broken link icon. I have searched and searched through the documentation, on SO and elsewhere for a couple of days now to no avail. I am new…
eswens13
  • 163
  • 1
  • 9
5
votes
3 answers

Django-Haystack: 'NoneType' object has no attribute '_default_manager'

I am trying to add a haystack search to my base.html to include it globally on my site. It errors though when i submit a search I am getting: Django-Haystack: 'NoneType' object has no attribute '_default_manager' I have added it to INSTALLED_APPS…
Mantis
  • 1,357
  • 3
  • 27
  • 49
5
votes
2 answers

Unhandled pending operations for models when trying to perform migration

When I perform a migration on one of my projects app I get the following error: ValueError: Unhandled pending operations for models: common.shipmentaddress (referred to by fields: catalog.Fulfillment.address) Django 1.9, python 2.7.10 I was…
segalle
  • 436
  • 4
  • 15
5
votes
1 answer

Django App not showing in admin after installing django 1.9

After installing django 1.9 I'm having problems trying to show my apps in the Admin interface, this is my code: app name: people #models.py: from django.db import models class Person(models.Model): name =…
Eric Acevedo
  • 1,182
  • 1
  • 11
  • 26
5
votes
1 answer

Django 1.8 to 1.9 upgrade: django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet

I have a project currently working on Django 1.8. Since 1.9 just released, I thought I would update via pip install django==1.9. However, when running python manage.py test -v 3, I get this error: Traceback (most recent call last): File…
Sardathrion - against SE abuse
  • 17,269
  • 27
  • 101
  • 156
4
votes
1 answer

Django default at database

So as I recently came to understand, the default that we specify in a Django field is merely for filling up pre-existing rows, and doesn't function as a "real" default value at the database level. This can be verified by looking up column_default…
Sidharth Samant
  • 714
  • 8
  • 28
4
votes
1 answer

Using F() with annotations including another query expression in Django

This is my (simplified) use case: from django.db import models class MyType(models.Model): whatever = models.CharField() class A(models.Model): type = models.ForeignKey(MyType) class B(models.Model): my_type =…
Jorge Arévalo
  • 2,858
  • 5
  • 36
  • 44
4
votes
0 answers

Django queryset LEFT OUTER JOIN against another queryset as subquery

I have two Django models, X and Y, I have a query set of X objects and I want to join it against a queryset of Y objects. I can't use raw SQL here as the API of the code I'm working with expects a queryset to be returned. I can do the following def…
J. Doe
  • 555
  • 1
  • 6
  • 15
4
votes
2 answers

Django1.9: 'function' object has no attribute '_meta'

Django Gives an error message forms.py: from django import forms from django.contrib.auth import authenticate, get_user_model, login, logout from django.contrib.auth.forms import UserCreationForm User = get_user_model class…
Arekkusuva
  • 43
  • 1
  • 5
4
votes
1 answer

Django logging not working in views

I have logging set-up in my Django 1.9 project. I am getting the logs in django_request.log automatically as expected but not in mylog.log when I use logging in views.py. Where am I wrong? views.py import logging logr =…
Rk..
  • 753
  • 1
  • 10
  • 27
3
votes
0 answers

Override django include template tag to read the html from database

I'm trying to write my own custom Django include template tag, to read the text to render from database, instead of reading a HTML file from disk. Something like this: {% dbinclude 'template_id_from_database' with foo='bar' %} A query would be…
Jorge Arévalo
  • 2,858
  • 5
  • 36
  • 44
3
votes
1 answer

use django's reverse function in req.path

I was stumbling on invitation feature to understand how it works. I found the blog post on http://www.pythondiary.com/tutorials/create-invite-only-website.html. There the author says (It checks the path as this will cause an infinite loop if not…
pythonBeginner
  • 781
  • 2
  • 12
  • 27
3
votes
1 answer

How to Change CharField Choice List Behaviour

As you can see below, I have model with CharField. The user can choose one of the value inside ROLE_CHOICE. Question: How can I make some values unavailable but you can still see them in the selection. Currently, I have tried the following code…
Nurzhan Nogerbek
  • 4,806
  • 16
  • 87
  • 193
3
votes
1 answer

make django not insert certain fields

I have a Django model against a postgresql database table where I want Django to not insert field_3 during object creation as its a timestamp field that DB is supposed to fill in. class AbcModel: model_id = models.AutoField(primary_key=True) …
comiventor
  • 3,922
  • 5
  • 50
  • 77
1 2
3
18 19