django

Inline multiple one-to-one fields in Django admin

I cannot get the admin module to inline two same field models in one-to-one relations. To illustrate it, I've made the following example, a model Person uses two addresses: class Client(models.Model): # Official address official_addr = models.OneToOneField(Address, related_name='official') # Temporary address temp_addr =...

Django formwizard - IS there a way to get more than one Form on a single page

I have a number of forms, say 5, I want to display them as page 1[ 1,2,3], page 2 [4], page3[5], as in one page having multiple forms. Is thsi possible with formwizard? ...

Trouble Upgrading Python / Django on CentOS

As you can see by reading my other thread today here, I'm having some troubles upgrading Python. At the moment I have Python 2.4 with Django installed on a CentOS machine. However I've recently deployed an application that requires 2.5 which has resulted in me installing that and getting into a whole load of mess. My original assumption...

Correct place to put extra startup code in django?

I would like to run some environment checks when my django process starts and die noisily in the case of an error. I'm thinking things like the database has an incorrect encoding or the machine has a python version we don't support. I'd rather our team be faced with a fatal error that they have to fix, rather than be able to ignore it. ...

How to make multilingual login in django?

Hello, I need to create multilingual website. But there is a problem with the login address. Do you know, how I can have /login/ for EN and /prihlasit/ for CS, etc... ? I can specify just one login url in my settings.py ...

recursive function for a django model instance

i want to make message view show all other messages that led up to that message. the original message will not have a response_to value and should terminate the recursion. is there a better way to do this? (i'm looking at memory over speed, because a thread shouldn't typically be more than 10 - 20 messages long). def get_thread(msg,msg_...

User-Defined Thumnails for Django Project?

I'm putting together a Web site that makes heavy use of images. Those images need to be thumbnailed at various sizes to fit different templates. I'm aware of solutions like sorl-thumbnail, which seems perfect in every way except one: I need to be able to override automatic resizing and cropping if the computer's choice is a bad one. Fo...

Django Admin "Edit Selection" Action?

I'd like to write a django-admin action (for use when the user selects zero or more rows) that will allow them to edit the selected items as a group. I only need to edit one of the items in the model (the "room") at a time, but I don't want to have to go through all 480 of my objects and manually edit them one-by-one. Is there a way to ...

Can I put Hudson Plots on the project page?

I've got Hudson up and running, building Django and Python projects I'm working on. I've found and am using the [Plot plugin][2] to graph Pylint scores, by extracting them with Awk to create a pylint.properties file. So far everything is working great, but I'd like to have the Pylint score appear on the project page. Right now you have...

Where are django-lean reports stored?

I'm new to django-lean. Does anyone know where are the reports generated by calling manage.py update_experiment_reports are stored? ...

Getting GeoDjango + Spatialite running on Windows

I continue to have problems setting up a GeoDjango installation that uses Spatialite as a backend on a Windows machine. I used the GeoDjango installer and downloaded the precompiled libraries from http://www.gaia-gis.it/spatialite/binaries.html, and dumped them into my geodjango/bin directory. I upgraded my pysqlite2 installation to th...

Pinax & Apache: deliver Attachments only to authenticated users

I want that Apache and Pinax only deliver Attachments to authenticated users. I found this post, but i can't make it work. My Apache-conf-file: WSGIPythonPath /usr/local/bin/python <VirtualHost *:80> ServerName www.domain.com ServerAlias domain.com WSGIDaemonProcess k-production python-path=/path/to/app/pinax-...

Django Html email adds extra characters to the email body

I'm using Django to send an e-mail which has a text part, and an HTML part. Here's the code: subject = request.session.get('email_subject', None) from_email = request.session.get('user_email', None) to = request.session.get('user_email', None) bcc = [email.strip() for email in request.session.get('email_recipients', Non...

django template url function not matching in app

I have a django project set up with an app called pub. I'm trying to set it up so that I can include urls.py from each app (there will be more as I go) in the top-level urls.py. I've also got a template that uses the 'url' function to resolve a url on a view, defined in the openidgae module. The problem is that after the httprequest i...

import twice when run test

i have this code in my tests.py: from models import * and in the models.py I have a signal handler and register it with post_save.connect( post_save_note, sender=Note ) and when i run test with ./manage.py test main I found the signal handler was registered twice and executed twice, and I found it's because the models was imported ...

django embedding user id into URL template best practice

I'm building a navigation menu in my django app, and one of the options is "My Account". There are different roles I have for users, but in order for them all to view their profile, I use a generic URL such as http://mysite/user//profile. What's a Django best practice for building this url using templates? Is it simply something like: ...

Pass several values in a manager

I was wondering if there a way I can pass two or more variables in a custom manager...there are five variables that come from different views but in the model, I've declared a manager to handle filtering based on one of these variables...I want to have all the variables being considered in the filter query. Is there a way to do this? c...

How to find that the content is truncated?

I'm trying to build a blog app and the problem is when I use tag 'truncatewords_html' in my template to truncate posts longer than specified words, I need to link to complete post by some title like 'read more...' after truncation. So I should know that the post was truncated or not. P.S.: Is this a pythonic way to solve the problem? ...

Django: Large file uploads - custom processing with mod_wsgi

I'm doing file uploads using Django's File Upload mechanism with a custom handler (by subclassing django.core.files.uploadhandler.FileUploadHandler) which does some additional processing in the receive_data_chunk(self, raw_data, start) function. I was curious when the handler is actually called (i.e. after the file has been completely ...

django aggregate aggregated fields?

I have a model called Item, with m2m relation to User ("owner"). For each item, i need to count users who own it. That's easy enough with annotate() But then i need to calculate ratio between owners of specific gender and total owner count for each item. For example if, 2 males own the item out of 5 users, the ration is 0.4. What's th...