Questions tagged [django-1.7]

Django 1.7 is the version of the Django framework, released September 2014. Please only use this tag if your question relates specifically to this version.

Django 1.7 depends on Python 2.7 and supports Python 3.4, support for Python 2.6 has been dropped.

Tag questions that address any of these new features:

  • Schema migrations
  • App-loading refactor
  • New method on Field subclasses
  • Calling custom QuerySet methods from the Manager
  • Using a custom manager when traversing reverse relations
  • New Prefetch object for advanced prefetch_related operations
  • Admin shortcuts support time zones
  • Using database cursors as context managers

If the question is not specific targeting features from this release please add . For questions about the new Schema migrations tool, please add .

See the Django 1.7 release notes for more information

394 questions
35
votes
4 answers

Revert Django 1.7 RemoveField migration

If I have a non-nullable model field, remove it, and create a migration, that migration becomes non-reversible: Consider the following model: class Foo(models.Model): bar = models.TextField() test = models.TextField() # This field is to go…
Ilya Semenov
  • 7,874
  • 3
  • 30
  • 30
25
votes
3 answers

What's the difference between authenticate and login?

Documentation: https://docs.djangoproject.com/en/1.7/topics/auth/default/#django.contrib.auth.login When you’re manually logging a user in, you must call authenticate() before you call login(). authenticate() sets an attribute on the User noting…
User
  • 23,729
  • 38
  • 124
  • 207
24
votes
5 answers

Django Heroku Error "Your models have changes that are not yet reflected in a migration"

I recently added a model to my app (UserProfile) and when I pushed the changes to Heroku, I think I accidentally ran heroku run python manage.py makemigrations. Now when I try to run heroku run python manage.py migrate I get the error…
Ben
  • 20,038
  • 30
  • 112
  • 189
22
votes
1 answer

How to combine select_related() and value()? (2016)

I am asking this question again (it was asked back in 2009), We know there is a values() method of QuerySet, when there is a foreignkey (author, for example), it result like: [{ 'author_id':3, ... }, ...] I want a result like: [{…
Miguel Rosales
  • 769
  • 4
  • 13
  • 29
22
votes
2 answers

Add non-null and unique field with already populated model

I have one model in my app running in a server with a few entries. I need to add a SlugField, unique and not-null for this model. The SlugField will be populated based on trading_name. I've changed my model in order to add this new field and…
MatheusJardimB
  • 3,599
  • 7
  • 46
  • 70
21
votes
3 answers

Suddenly when running tests I get "TypeError: 'NoneType' object is not iterable

This is phenomenally strange for me, things were working PERFECTLY fine until this morning. When I attempt to run my unit test using the following (I have Python3 soft linked to python) clear; python manage.py test list tests/ I now get the…
SteveMustafa
  • 621
  • 2
  • 8
  • 19
21
votes
2 answers

__init__() got an unexpected keyword argument 'mimetype'

I am using Django 1.7.4 and django_ajax_selects for AutoComplete. The lookup is failing and i get this error: __init__() got an unexpected keyword argument 'mimetype' The complete stack trace is as below. What could i do to resolve this error? Is…
Guddu
  • 1,588
  • 4
  • 25
  • 53
21
votes
1 answer

How to unapply the very first migration in django 1.7

It looks like rolling back to any migration is possible using: ./manage.py migrate However, this requires an actual migration to be applied, and I need to rollback the very first migration! Specifically, I want to…
moomima
  • 1,200
  • 9
  • 12
20
votes
7 answers

Google & Oauthlib - Scope has changed

I am using OAuthlib for conducting OAuth flow of Google. It was working well for 4 to 5 months. Suddenly I started getting below error: File…
19
votes
3 answers

Django: Generic views based 'as_view()' method

I was working on an application wherein I created a generic ListView. Now, while defining that view in my urls.py, I read from the documentation that I need to use the as_view() method as follows: from django.conf.urls import patterns, include,…
Manas Chaturvedi
  • 5,210
  • 18
  • 52
  • 104
19
votes
2 answers

Creating Partial Indexes with Django 1.7

The documentation for Django 1.7 mentions RunSQL classes can be used to create partial indexes on your tables. I have a table where I want the combination of title, blog & category to be unique. However if category is not provided, the combination…
user4150760
  • 2,739
  • 5
  • 18
  • 25
18
votes
4 answers

Django 1.7 upgrade error: AppRegistryNotReady: Models aren't loaded yet

I am trying to upgrade a project from Django 1.6 to 1.7. So far, I have created a new virtualenv with all the same installs and upgraded the Django version to the new release. I need to upgrade from South, but had errors doing so, so I thought I'll…
Pete Drennan
  • 522
  • 1
  • 6
  • 15
17
votes
4 answers

How to downgrade from Django 1.7 to Django 1.6

I started a new project a few months back using Django 1.7. The company has decided to settle on using Django 1.6 for all projects. Is there a nice way to downgrade from Django 1.7 to 1.6? Are migrations the only thing I have to worry about? Are the…
user9903
15
votes
4 answers

Django: passing JSON from view to template

In views.py, I have time series data stored in a dictionary as follows: time_series = {"timestamp1": occurrences, "timestamp2": occurrences} where each timestamp is in unix time and occurrences is an integer. Is there a way to pass the time series…
jkarimi
  • 1,247
  • 2
  • 15
  • 27
15
votes
4 answers

Error Using django-tables2 - Expected table or queryset, not 'str'

I am trying to create some tables for my application using django-tables2 and running into some difficulties. I am using Python 2.7, and Django 1.7. I am following the tutorial, and I ran into problems. I reach the point where I need to create a…
Ravi Mehta
  • 485
  • 1
  • 6
  • 15
1
2
3
26 27