Questions tagged [django-1.4]

Django 1.4 is a version of the Django framework, released in March 2012, with enhanced time zones support and various other improvements. Please only use this tag if your question relates specifically to this version.

Django 1.4 is a version of the Django framework, released in March 2012, with enhanced time zones support and various other improvements. Please only use this tag if your question relates specifically to this version.

See the release notes for more details.

227 questions
39
votes
3 answers

Filter on prefetch_related in Django

Is there a way of filtering prefetched objects? I need to get the latest() of the prefetched objects but prefetch_related doesn't work if you use latest because the query is changed? The example here does what I need but I was hoping there's a…
alan
  • 4,247
  • 7
  • 37
  • 49
25
votes
3 answers

South + Django 1.4 Database error

I have just installed my Django project on a new system, and installed Django 1.4. However when I try to run manage.py runserver or manage.py syncdb I get this error from South: Validating models... Unhandled exception in thread started by
saul.shanabrook
  • 3,068
  • 3
  • 31
  • 49
23
votes
4 answers

How to bind multiple reusable Django apps together?

I try my best to write reusable Django apps. Now I'm puzzled how to put them all together to get the final project. Here is an example of what I mean: I have a picture app that stores, resizes and displays images. Also I have a weblog app that…
JasonTS
  • 2,479
  • 4
  • 32
  • 48
19
votes
6 answers

'admin' is not a registered namespace in Django 1.4

I'm attempting to upgrade quite a large Django project to the newly released Django 1.4, and I'm having some issues when running python manage.py test. Lots of the internal tests which passed in Django 1.3 are now failing, with really odd messages…
Rob Golding
  • 3,502
  • 5
  • 26
  • 28
16
votes
4 answers

How to set initial values for a ModelForm when instance is also given

It seems like if a ModelForm is given an instance, it ignores any values you provide for initial and instead sets it to the value of the instance -- even if that instance is an empty model record. Is there any way to create a form with an instance…
Jordan Reiter
  • 20,467
  • 11
  • 95
  • 161
16
votes
2 answers

Copying ManyToMany fields from one model instance to another

I'm new to django, and as a learning app, I'm building an expense logging application. In my models I have three classes that look like this (I simplified them slightly for brevity): class AbstractExpense(models.Model): description =…
mac
  • 42,153
  • 26
  • 121
  • 131
15
votes
3 answers

Django template conditional variable assignment

I want to assign a variable do different values depending on if a variable exists, is this possible? My non working example might make it clearer: {% if username %} {% with menu_user=username %} {% elif recent_users %} {% with…
olofom
  • 6,233
  • 11
  • 37
  • 50
14
votes
1 answer

Django 1.4 - Redirect to Non-HTTP urls

We have a view which redirects to a Non-HTTP url scheme. Its used in an iOS app. But since we have upgraded to Django1.4 we are getting a crash when this redirect code is executed. It crashes with SuspeciousOperation at /myyrlscheme/ Unsafe…
Srikar Appalaraju
  • 71,928
  • 54
  • 216
  • 264
13
votes
2 answers

custom save method on model - django

I am overriding the save method on one of my models: def save(self, *args, **kwargs): self.set_coords() super(Post, self).save(*args, **kwargs) def __unicode__(self): return self.address # set coordinates def set_coords(self): …
AlexBrand
  • 11,971
  • 20
  • 87
  • 132
11
votes
1 answer

'WSGIRequest' object has no attribute 'Post'

I am new to django and python and I am trying to update the database boolean field from checkboxes in the html page. when I try to access the checkboxes in the views method, this error occurs: 'WSGIRequest' object has no attribute 'Post' This is my…
نوار مكيس
  • 169
  • 1
  • 3
  • 10
11
votes
3 answers

A Simple View to Display/Render a Static image in Django

I am trying to find the most efficient way of displaying an image using django's template context loader. I have a static dir within my app which contains the image 'victoryDance.gif' and an empty static root dir at the project level (with…
JoshuaBox
  • 735
  • 1
  • 4
  • 16
10
votes
2 answers

Whats is the best way to migrate folder and files structure from django1.3 to django1.4?

I have a little project created with django1.3 and I want to migrate it to django1.4 but since the files structure change a little, what is the best way to migrate?
user1290741
10
votes
6 answers

Django forms.DateInput does not apply the attributes given in attrs field

Placeholder, class not getting set when tried to apply through the django's attrs specifier for forms.DateInput The form is a ModelForm. And according to the docs Takes same arguments as TextInput, with one more optional argument: Here is the code…
ThinkingMonkey
  • 12,539
  • 13
  • 57
  • 81
10
votes
2 answers

Django1.4: How to use order_by in template?

Django1.4: How to use order_by in template? models.py from django.db import models from django.contrib.auth.models import User from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes import generic class…
chobo
  • 4,830
  • 5
  • 23
  • 36
10
votes
7 answers

Django: serving static file on debug=false

I know this question was asked many times, but none of the answers i found and tried helped me. Those are my static files settings: STATIC_ROOT = os.path.abspath(SETTINGS_PATH+'/staticfiles/') # URL prefix for static files. # Example:…
Neara
  • 3,693
  • 7
  • 29
  • 40
1
2 3
15 16