django

Using localflavor Django form fields on Google's App Engine

Is it possible to use the form fields from django.contrib.localflavor.us.forms on the Google App Engine? Can I simply use those form fields, or do I need a form field under google.appengine.ext.db.djangoforms ...

Dynamically include template elements from other apps in Django

App_1 has a view and a template for this view. It would like to "aggregate" information into this view from other sources (i.e. other apps), without having to add or change anything itself. Perhaps App_2 wants to put "hello world" into this designated area in App_1's view. What is the best way of achieving this? Signals come to mind nat...

How do I see stdout when running Django tests?

When I run tests with ./manage.py test, whatever I send to the standard output through print doesn't show. When tests fail, I see an "stdout" block per failed test, so I guess Django traps it (but doesn't show it when tests pass). ...

Creating multiple Python modules in different directories that share a portion of the package structure.

I'm working on a Django project that contains a single application. The application will be released under the GPL so I want to develop it separately from the project - a personal site using the app. I'm attempting to use a package structure based on my domain name for both the project and the app, and that's where I'm running into pro...

Comma separated lists in django templates

If fruits is the list ['apples', 'oranges', 'pears'], is there a quick way using django template tags to produce "apples, oranges, and pears"? I know it's not difficult to do this using a loop and {% if counter.last %} statements, but because I'm going to use this repeatedly I think I'm going to have to learn how to write custom tags f...

I've got a django site with a good deal of javascript but my clients have terrible connectivity - how to optimize?

We're hosting a django service for some clients using really really poor and intermittent connectivity. Satellite and GPRS connectivity in parts of Africa that haven't benefited from the recent fiber cables making landfall. I've consolidated the javascripts and used minificatied versions, tried to clean up the stylesheets, and what not...

Grouping dates in Django

My question is almost exactly the same as this post, except that I'm using Python and Django instead of PHP. The task is to take: id date 1 2009-01-01 10:15:23 2 2009-01-01 13:21:29 3 2009-01-02 01:03:13 4 2009-01-03 12:20:19 5 2009-01-03 13:01:06 And output: 2009-01-01 1 2 2009-01-02 3 2009-01-03 4 5 I ...

Should I use google-app-engine-django or app-engine-patch or neither or something else?

Do I need either to make Django easier to use on GAE? Anyone had good or bad experience of either or any equivalent? Is there much difference between these? Which is easier to use? Regards Geoff ...

Choose the filename of an uploaded file with Django

I'm uploading images (represented by a FileField) and I need to rename those files when they are uploaded. I want them to be formated like that: "%d-%d-%s.%s" % (width, height, md5hash, original_extension) I've read the documentation but I don't know if I need to write my own FileSystemStorage class or my own FileField class or ... ? ...

Get Django Form Widget 'SelectDateWidget' to display 'Blank' option.

No documentation on this one, should be simple, but not functioning for me. Here's the raw code: http://code.djangoproject.com/browser/django/trunk/django/forms/extras/widgets.py Trying to pass a value of required=False to the Widget to get blank values (line 23 in the raw code: none_value = (0, '---')) but get an unexpected argume...

Django database connections pool with psycopg2.pool

Hi folks, I'm trying to implement persistent database connection pool with django. One of the options is to use built in psycopg2.pool code which provide different types of pools (PersistentConnectionPool, ThreadedConnectionPool etc ), but there is no psycopg2 documentation on that topic. So, do anyone done any work in this direction ...

What books to start on web programming for an experienced non-web programmer?

No surprise here, possible dupes: Good Books for Learning Web Programming Required Reading for a Soon to be Web Developer and there will be more. For a personal project, I'm starting to do some web programming using Django. I've programmed since I was very young on several languages, mostly Pascal/Delphi, C/C++, SQL Pyt...

Django ORM GROUP BY

This PostgreSQL query solves my problem, but I'm not sure how to put it in Django ORM. SELECT DISTINCT ON (to_email) * FROM (SELECT * FROM invitation_invitation ORDER BY date_invited DESC) AS sub From a list of items, I want all distinct rows for "to_email" column, and where to_email is duplicate, it should select the latest ( date_in...

How to co host django app with php5 on apache2 with mod_python ?

Hi folks, I have django+python+apache2+mod_python installed hosted and working on ubuntu server/ linode VPS. php5 is installed and configured. We don't have a domain name as in example.com. Just IP address. So my apache .conf file looks like this ServerAdmin webmaster@localhost DocumentRoot /var/www <Location "/">...

Is Concatenating Django QuerySets In A Loop The Right Thing To Do?

I have a Django model called Collection that represents a collection of items (CollectionItem). Each Collection only contains items of a specific type. (CollectionItem has a foreign key to Collection). I want to get all of the CollectionItems that are in public-flagged lists of a specific type and return them sorted by a particular fi...

Django TimeField Model without seconds

Greetings, I am trying to implement a TimeField model which only consists of HH:MM (ie 16:46) format, I know it is possible to format a regular Python time object but I am lost about how to manage this with Django. Cheers ...

Django admin , save function and forms

Hi guys, i dont know how ill ask this, im new with Django, but ill try. I have a form in the private user section, well this form save the username logged, a encrypted data from another function, and some more fields. Now my problem is that in the Admin, i need to use "this form" too, but i dont know how render the form in different wa...

django binary (no source code) deployment

Hello all, is there possible only to deploy binary version of web application based on django , no source code publish? Thanks ...

Can't get current user for AJAX requests in App Engine

I'm using Django+Appengine on a page that has both a normal HTML request to get the page, and an AJAX request using jQuery. On normal requests, it loads the current user and session information just fine. However, for the AJAX requests, self.user isn't set and users.get_current_user() doesn't return anything. Both handlers are on the ...

Django: Structure Django Model to allow Arbitrary Fieldtypes

I'd like to make a user profile app in Django (I know there are some that exist, thanks) and I'm wondering how you would structure the models to allow for an arbitrary combination fields in each sub-section. As an example, the section 'education' may have a sub-section called 'Programming Experience', and the section 'personal info' may...