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

Remove app (and associated database tables) in Django 1.7

Is it possible to use Django 1.7 migrations to completely remove/uninstall an app and all its traces (mainly, all its database tables)? If not, what is the appropriate way of doing this in Django 1.7?
Christoffer Karlsson
  • 4,539
  • 3
  • 23
  • 36
9
votes
1 answer

Upgrading transaction.commit_manually() to Django > 1.6

I have inherited some code for an app that was written for Django 1.4. We need to update the codebase to work with Django 1.7, and eventually 1.8 as the next Long Term Support release. In a few places it uses the old style…
seb
  • 91
  • 1
  • 3
9
votes
4 answers

Django: Attempt to write a read-only database

I have just created a Django project with python manage.py startapp smartrecruitment I then ran a db sync python manage.py syncdb Operations to perform: Apply all migrations: admin, contenttypes, auth, sessions Running migrations: Applying…
Jon
  • 3,174
  • 11
  • 39
  • 57
9
votes
1 answer

Django 1.7 - Accidentally Dropped One Table. How To Recover It?

I have accidentally dropped a table in Django 1.7 project. I ran makemigrations & migrate. Both commands didn't recognized that table has dropped. So they had no affect. Should I remove code for the model, make migration, add the code for the…
Chillar Anand
  • 27,936
  • 9
  • 119
  • 136
8
votes
1 answer

Using a specific flatpage in a template

I'm using django flatpages, and I'm wondering if there is a concise way of loading one specific flatpage within a template. The docs show the following patterns: {% load flatpages %} {% get_flatpages '/about/' as about_pages %} {% get_flatpages…
djq
  • 14,810
  • 45
  • 122
  • 157
8
votes
1 answer

How to use django formsets to create a survey app with questions and answers?

I have a requirement to create a survey form. Different types of users will have different set of questions to answer in the survey. models.py from django.contrib.auth.models import Group, User from django.db import models ANSWER_CHOICES = ( …
Chirdeep Tomar
  • 4,281
  • 8
  • 37
  • 66
8
votes
2 answers

How to create per-project initial_data fixtures in Django 1.7+

Before Django 1.7 I used to define a per-project fixtures directory in the settings: FIXTURE_DIRS = ('myproject/fixtures',) and use that to place my initial_data.json fixture storing the default groups essential for the whole project. This has been…
knaperek
  • 2,113
  • 24
  • 39
8
votes
3 answers

Django fixtures save with default value

I'm using Django 1.7 and I have a problem with my fixtures. I would like Django to use the default value or use the save() method to create unspecified values. Here are my current objects: # File: uuidable.py import uuid from django.db import…
achedeuzot
  • 4,164
  • 4
  • 41
  • 56
8
votes
2 answers

Using Django's StaticLiveServerCase with staging server as well

I've witten a few functional tests using the StaticLiveServerCase. This works great for local testing, but now I'd like to test my staging server as well. The author of the book I'm reading suggests the following hack: import sys [...] class…
Thijs van Dien
  • 6,516
  • 1
  • 29
  • 48
8
votes
1 answer

PyDev + Django - undefined variables from import

Specifically, any querysets are causing this: users = User.objects.all().order_by('user_group__user_group_description', 'user_name') all() is saying Undefined variable from import This is on any queryset in my views - and yet the server's running…
TyrantWave
  • 4,583
  • 2
  • 22
  • 25
7
votes
1 answer

Django 1.7 makemigrations renaming tables to None

I had to move a few models from one app to another, and I followed the instructions on this answer https://stackoverflow.com/a/26472482/188614. Basically I used the CreateModel migrations generated by python manage.py makemigrations, wrapped them…
Diego Ponciano
  • 1,453
  • 1
  • 19
  • 23
7
votes
4 answers

Models.DateField Format issues

I have a model, which has a date field date_of_birth = models.DateField(blank=True, null=True, verbose_name="DOB") I would like to format it to save dates in the format dd/MM/yyyy, but everything I have tried fails. I think the default must be…
Jon
  • 3,174
  • 11
  • 39
  • 57
7
votes
5 answers

Migration error with Django 1.7.1

I'm getting an error when performing a migration after introducing a new app (django-allauth). I'm not sure what else to try in order to fix the error. I've tried a few things but they don't seem to help unfortunately. when running manage.py…
AndrewO
  • 1,105
  • 4
  • 16
  • 33
7
votes
2 answers

Django - custom admin page not related to a model

I am using Django 1.7 with Mezzanine. I would like to have some page in admin, where the staff can call some actions (management commands etc.) with buttons and other control elements. I would also like to avoid creating new model, or manually…
matousc
  • 3,698
  • 10
  • 40
  • 65
7
votes
2 answers

Use custom directory for "templatetags"

some one know if its likely use custom directory for "templatetags" eje: "my-project/templatetags" Normal My-Project-Name My-App __init__.py templatetags __init__.py Need Some Like This My-Project-Name templatetags …
Colpaisa
  • 355
  • 1
  • 4
  • 14