django

Problem importing files in Django settings.py

I have a Django project which seemed to work pretty well with settings.py, which also imported a local_settings.py without problem. I've now added the following lines at the end of the settings file : try: from extras import * except ImportError, e: print "import extras failed :: " + `e` extras.py is a file of extra configura...

How to have jQuery refer to a newly popped up window?

In the django function showRelatedObjectLookupPopup, I'd like to bind a function to a button in the newly popped up window, but I don't know how to refer to the new window. Here is what I have tried: function showRelatedObjectLookupPopup(triggeringLink) { // other function stuff omitted var name = triggeringLink.id.replace(/^lookup_...

Querying a PostGIS database with a KML "shapefile"

I am working on a Google Maps application that doee the following (on a low zoom level): Prints a bunch of polygon overlays onto the map. These polygons are created from KML files that I created with Google Earth. Basically these polygons cover continent sized chunks of the earth. 15 of them cover the entire land of the world. On top o...

Lazy loading relationships in Django (and other MVCs/ORMs)

Interested in knowing how lazy loading is achieved in frameworks like Django. When is the decision made to perform the join? And is there a way to force eager loading in Django? Are there times when you would need to force Django to eager load? ...

Display full names in django form, not username

I have a Django app that has activities and objects that have foreign keys to the User object that is defined in django.contrib.auth.models. In doing this, I get the username property of the user, which is the login id. Since the User object stores the full name, how do I make a ChoiceField on an form display the full names of the user...

Django : I have a save() which is failing. How can I see the SQL that's generated?

I have a failing model.save() in my Django app. How can I see the SQL that was generated by it? ...

Help with Django QuerySets

I have a Model with a Foreign Key of "Parent" class Item(models.Model): parent = models.ForeignKey(Parent) This is the FK model class Parent(models.Model): name = models.CharField(blank=True, max_length=100) def __unicode__(self): return str(self.name) I am trying to run a query that gets all Items with a parent of "xyz" I get n...

Django : Error thrown by database : relation "_mytable" does not exist (for a content_type) . Lost app-name

In Django, I have a model, let's call it "MyTable" which uses a content_type Foreign Key to refer to, amongst other things, Profile. In most cases (as in my unit-tests) I have no trouble with it, but in a certain circumstance in the view I try to save a Profile object (with Profile's .save() ) and the database throws this exception : r...

Blog engine for Google App Engine

Hi! I'm looking for some blog engine on this platform. Something like Wordpress. I don't need many options and features, but I need a ready solution. Thanks in advance. ...

Django: information captured from URLs available in template files?

Given: urlpatterns = \ patterns('blog.views', (r'^blog/(?P<year>\d{4})/$', 'year_archive', {'foo': 'bar'}), ) in a urls.py file. (Should it be 'archive_year' instead of 'year_archive' ? - see below for ref.) Is it possible to capture information from the URL matching (the v...

Is there a way to list Django signals?

Is there a way to see which signals have been set in Django? ...

Django apache mod-python setup (vista)

I am trying to setup my development environment on my local vista machine (django+apache+mod-python+postgres) and for some reason I can't load the settings. Everything works on the built-in server but not under apache. Here is my httpd.conf <Location "/"> SetHandler python-program PythonHandler django.core.handlers.modpyt...

Adding attributes into Django Model's Meta class

I'm writing a mixin which will allow my Models to be easily translated into a deep dict of values (kind of like .values(), but traversing relationships). The cleanest place to do the definitions of these seems to be in the models themselves, a la: class Person(models.Model, DeepValues): name = models.CharField(blank=True, max_length...

django manage.py test auth fails

When I run the test suite of django I get errors on the auth application. I have (obviously) not written any of auth code and I have not written tests for auth. yet the auth tests fail. Here are some of the errors I get, the whole stacktrace is too big to put here: Does someone has dealt with this before? AttributeError: 'module' objec...

Django form redirect

I have a form that and after the user fills in this form, I want to redirect to a URL that looks something like this r'^user/(?P<id>\d+)/$' The <id> is the primary key in the database...how do I go about this coz I'm stuck at this point ...

Django Reporting Options

I want to create a new "Business" application using the Django framework. Any suggestions as to what I can use as a reporting framework? The application will need to generate reports on various business entities including summaries, totals, grouping, etc. Basically, is there a Crystal reports-like equivalent for Django/Python? ...

Django: Dynamic LOGIN_URL variable

Hi Currently, in my settings module I have this: LOGIN_URL = '/login' If I ever decide to change the login URL in urls.py, I'll have to change it here as well. Is there any more dynamic way of doing this? ...

How to make custom PhotoEffects in Django Photologue?

I'm creating an image gallery in Django using the Photologue application. There are a number of PhotoEffects that come with it. I'd like to extend these and make my own so that I can do more complicated effects such as adding drop shadows, glossy overlays, etc. Is is possible to create custom effects that Photologue can then use to pr...

Non-destructively handling Django user messages...

I'm displaying user messages through templates using RequestContext in Django, which gives access to user messages through {{messages}} template variable - that's convenient. I'd like user him/herself delete the messages - is there a way to do it in Django without rewriting much code? Unfortunately Django automatically deletes messages ...

djapian based search freezes

When I try to run a djapian based search it freezes the applications and I dont get any response from the server. Am deploying the site using mod_wsgi. The search runs fine when i run it in the python shell or in the django dev server. The problem seems to arise only when I deploy my site to apache. Does anyone know how I can get around ...