django

How can I get the number of records that reference a particular foreign key in Django?

I'm working on a blog application in Django. Naturally, I have models set up such that there are Posts and Comments, and a particular Post may have many Comments; thus, Post is a ForeignKey in the Comments model. Given a Post object, is there an easy way (ideally, through a method call) to find out how many Comments belong to the Post? ...

Django Queryset across Models?

I have several Models and want to return a queryset of all the Models belonging to a User, I'm wondering if its possible to return one Queryset from multiple Models? ...

Dump Django site to static HTML?

I've determined that my local web hosting company cannot support Django. They run Python 2.2. No support for mod_python, FastCGI, or SCGI. No support for mod_rewrite. Any one of these prevent me from deploying my site as a Django app at that hosting service. I realize that my site is basically static. I'm wondering if I can use...

Django FormWizard with dynamic forms

I want to implement a simple 2 part FormWizard. Form 1 will by dynamically generated something like this: class BuyAppleForm(forms.Form): creditcard = forms.ChoiceField(widget = forms.RadioSelect) type = forms.ChoiceField(widget = forms.RadioSelect) def __init__(self,*args, **kwargs): user = kwargs['user'] del k...

How to gracefully restart django running fcgi behind nginx?

I'm running a django instance behind nginx connected using fcgi (by using the manage.py runfcgi command). Since the code is loaded into memory I can't reload new code without killing and restarting the django fcgi processes, thus interrupting the live website. The restarting itself is very fast. But by killing the fcgi processes first so...

django is very slow on my machine

I have a fresh install of django 1.0 and a simple page served from it takes 5 secs to load. On my colleague's computer it takes almost no time. I start the server using python manage.py testserver I can see each GET request (PNGs and style sheets) take about half a second. Another weird thing, which I think is related, is that the...

How to best integrate Flex and Django?

I'm building a site with a Flex frontend and Django backend. The problem I'm facing is that it's tedious to write a CRUD frontend for every model. I've checked out django-rest-interface but it is not obvious on how to do anything other than read/GET (i.e. create/POST, update/PUT, delete/DELETE) and couldn't find any related examples. ...

MVC and django fundamentals

Pretty new to this scene and trying to find some documentation to adopt best practices. We're building a fairly large content site which will consist of various media catalogs and I'm trying to find some comparable data / architectural models so that we can get a better idea of the approach we should use using a framework we've never ma...

Threaded code on mod_python

I have written a Django app that makes use of Python threading to create a web spider, the spider operates as a series of threads to check links. When I run this app using the django test server (built in), the app runs fine and the threads seem to start and stop on time. However, running the app on Apache it seems the threads aren't k...

How to create a form object from 2 different model objects in Django?

I have 2 objects, both from different Model classes, and want to show a form containing some fields from each one. How can I do this? ...

Can you change a field label in the Django Admin application?

As the title suggests. I want to be able to change the label of a single field in the admin application. I'm aware of the Form.field attribute, but how do I get my Model or ModelAdmin to pass along that information? ...

Flex HTTPservice and POST, Sending Files ?

Hello, I use a basic Post to send data to a Django server. The data consists of a base64 encoded 640*380 PNG image dynamically created by the flex component. <mx:HTTPService id="formSend" showBusyCursor="true" useProxy="false" url="http://127.0.0.1/form/" method="POST" result="formSentConfirmation(event)" fault="formSendi...

How to setup Django on XMPP on Windows XP

Greetings! I'd like to investigate Django but I'm running Windows XP. I've installed XMPP and I currently have Python 2.6 installed (is it true that 2.5 is the only version that will work with XMPP?). What else do I need to get up and running? Any tips, recommended IDEs, etc? ...

How to localize Content of a Django application

Hey, i am currently working on a django app for my studies, and came to the point of l18n. Localizing the site itself was very easy, but now i have to allow users, to translate the dynamic content of the application. Users can save "products" in the database and give them names and descriptions, but since the whole site should be localiz...

Setting up a foreign key to an abstract base class with Django

I've factored out common attributes from two classes into an abstract base class, however I have another model that needs to reference either one of those classes. It's not possible to reference an ABC as it doesn't actually have a database table. The following example should illustrate my problem: class Answer(models.Model): ovram...

What is the best way to serialize a ModelForm object in Django?

I am using Django and the Google Web Toolkit (GWT) for my current project. I would like to pass a ModelForm instance to GWT via an Http response so that I can "chop" it up and render it as I please. My goal is to keep the form in sync with changes to my models.py file, yet increase control I have over the look of the form. However, the d...

Is there anyone who has managed to compile mod_wsgi for apache on Mac OS X Leopard?

I'm working on a Django project that requires debugging on a multithreaded server. I've found mod_wsgi 2.0+ to be the easiest to work with, because of easy workarounds for python module reloading. Problem is can't get it to compile on Leopard. Is there anyone who has managed to do it so far, either for the builtin Apache or MAMP. I'd be ...

in SQL, or Django ORM, what's the conventional way to have an ordered one-to-many?

Say I wanted to have a project, and one-to-many with to-do items, and wanted to re-order the to-do items arbitrarily? In the past, I've added a numbered order field, and when someone wants to change the order, had to update all the items with their new order numbers. This is probably the worst approach, since it's not atomic & require...

Django Authentication from .NET using HttpWebRequest and HttpWebResponse via HTTP POST

I am creating an application in .NET that will serve as a second UI for my already-deployed Django app. For some operations users need to authenticate themselves (as Django users). I used a super-simple way to do this (without encrypting credentials for simplicity):- Step 1. I created a django view that accepted the username and passwor...

Are there any plans to officially support Django with IIS?

I say properly because everyone I have spoken to in the past said running Django on IIS was a hack. I had it working somewhat but it never did quite right and did feel like a hack. I like python but had to give it up because I could never make Django work with IIS and Django was my excuse to use Python in production web apps. But it w...