django

pinax / django installation on virtual env, run on mod_wsgi

Hi, I tried to install Pinax development version by using pip and virtual environment. It was running on 127.0.0.1:8000 very well. However, when I deployed it on Apache 2 using mod_wsgi, it began to raise exception with the following error : SystemError: new style getargs format but argument is not a tuple Any suggestions? I appreci...

Storing and escaping Django tags and filters in Django models

I am outputting content from my models to my templates, however some model fields call data stored in other models. This happens only in a few fields. I am wondering whether using an if tag to evaluate this would be more efficient compared to storing the django tags inside the models. Answers to this question say that storing django ta...

Django: How to define a dynamic initial value on a ForeignKey Model Field

How can one define a dynamic initial value on a foreign key field? With the code: from django.db import models from django.conf import settings from django.contrib.sites.models import Site class Example(models.Model): site = models.ForeignKey(Site, initial=settings.SITE_ID) I've the following error: site = models.ForeignKey(Sit...

Django: create an internal twitter like wall

I'm building a multi user system and I'm creating an somewhat experimental idea for the users to interact. The site is for professional actors so they can post up their profile and so casting directors can find them. All that is going fine. What I now want to do it create a wall/twitter group area where people can post short message...

Django trans tag within a default filter

Hi, does anyone know how this could properly be written in Django? {{ mu.expiry_date|default:"{% trans 'Free User' %}"}} Obviously, the above does not work since it contains a tag within a tag's filter. ...

Good way to Django-based website, installing prerequisites if needed

Consider a website build using python and django. In many cases it uses 3rd party modules beside standard python library - such as pytz, South, timezones or debug toolbar. What is standard or just convenient way to deploy such application to production hosting with all the prerequisites (timezones, etc) installed automatically? I'm new...

Can't import PyObjC CoreData module when using mod_wsgi with Apache

Just ported a webapp from TurboGears to Django and going through the process of getting a proper server running (i.e. not runserver). Tried going the recommended Apache + mod_wsgi route that the Django docs talk about, but for some reason the thread stalls out with no error message or anything as soon as you try to import CoreData anywh...

Haystack + Whoosh IndexError: Index was created on an architecture with different data sizes

When rebuilding my indices via ./manage.py rebuild_index I get this error: Traceback (most recent call last): File "manage.py", line 11, in <module> execute_manager(settings) File "/Library/Python/2.6/site-packages/django/core/management/__init__.py", line 438, in execute_manager utility.execute() File "/Library/Python/2.6...

How to use new Django 1.2 readonly_fields in ModelForm

I'm trying to use the new readonly_fields in a ModelForm. class TrainingAddForm(forms.ModelForm): class Meta: model = TrainingTasks readonly_fields = ('trainee_signed','trainee_signed_date') But this does not work. Am I missing something or is this not possible? ...

google-app-engine-django loading fixtures

I'm having troubles loading fixtures on GAE with google-app-engine-django. I receive an error that says "DeserializationError: Invalid model identifier: 'fcl.User'" ./manage.py loaddata users I'm trying to load a fixture that has the following data: - model: fcl.User fields: firstname: test lastname:...

Locating django app resources

Hello all, tl:dr How would a hosted django app correctly transform resource paths to match any hosted location (/ or /test or /testtest)? Full Description Let me try to explain what I am trying to do. I am trying to write a somewhat re-usable django app which I intend to use from within multiple projects. This app is called systems...

django-admin.py launches IDE

I just went to create a new django project and I typed django-admin.py startproject my_project into the command prompt and it opened the django-admin.py file in my ide (komodo edit). This happens every time I run this command in any form, even if I just try django-admin.py. Any ideas what's going on and how I fix it? I'm on Win Xp wit...

How does Django's ORM manage to fetch Foreign objects when they are accessed

Been trying to figure this out for a couple of hours now and have gotten nowhere. class other(models.Model): user = models.ForeignKey(User) others = other.objects.all() o = others[0] At this point the ORM has not asked for the o.user object, but if I do ANYTHING that touches that object, it loads it from the database. type(o.us...

Django and Akamai EdgeCache

Has anyone used Akamai's EdgeCache in front of a Django-based application? Is there anything specific needed in terms of configuration/middleware on the Django side to ensure Akamai is fully utilized? ...

django dynamic translate on AppEngine

Hi, I need dynamic translation in django on AppEngine. I found nice django modul for dynamic translations: django-rosetta, but it open files (django.po...) and it is not allowed on AppEngine. Exist some other translate modul where is compatibile (or with small fix) with AppEngine? Thanks. Martin ...

how to not spend a lot memory in django model manipulation

Hello guys ! I have the following model: model rank(Models.model): username = models.CharField(max_length=200, default=0) points = models.IntegerField(default=0) rank = models.IntegerFiel(default=0) what i want is, based on 'points' recalc this model, setting the result in 'rank' field. i=0 user_list = db.Rank.objects...

Sys.path modification or more complex issue?

Hi, I have problems with importing correctly a module on appengine. My app generally uses django with app-engine-patch, but this part is task queues using only the webapp framework. I need to import django settings for the app to work properly. My script starts with: import os import sys sys.path.append('common/') # Force Django to r...

Get class name of django model

Hi there, I have a django model: class Book(models.Model): [..] and I want to have the model name as string: 'Book'. When I try to get it this way: Book.__class__.__name__ it returns 'ModelBase'. Any idea? ...

How to add custom fields like firstname and lastname to django registration form?

I have to add two custom fields (first name, last name) into my registration form, but I don't know how. I went through this question but values (first name, last name) are not getting stored after registration. Also some one tell me how to add check box to registration form using "RegistrationFormTermsOfService". Thanks, manu ...

How *not* to run Django code on syncdb

Hello, I have some server startup code that is lying in the "models.py" of one of my Django apps. I need to run that code on server startup time. The problem is, that code issues a SQL query, which prevents me from running syncdb with psycopg2 (it breaks the transaction, and tables are not created.) Putting the code in a middleware an...