django

Implementing a site prefix across all apps.

I'm in the middle of developing an app on Google's App Engine, and one of the features is auth via Facebook Connect. I've got everything set up and working up to a certain level, but in order to test it against my dev machine, I've created a reverse proxy on one of my public facing servers that proxies through to the dev machine. It all...

URL regex in django with limited set of words

Given the following django URL conf. entry: url(r'^(?P<obj_ctype_name>\w+)/(?P<obj_id>\d+)/$', views.obj_view, name='obj_view') How would I rewrite the parameter (?P<obj_ctype_name>\w+) to enforce that it may only be one of "foo" "bar" or "baz" and still keep it as a named parameter? ...

google-app-engine-django loaddata doesn't seem to work, not datastore on filesystem

I'm working on a Django AppEngine application using the AppEngine Django helper (google-app-engine-django), and I'm trying to create some initial data to load into my datastore. Here's my directory structure: . ./__init__.pyc ./index.yaml ./api ./api/__init__.py ./api/models.py ./api/views.py ./api/urls.py ./appengine_django ./manage.p...

Django, Truncated incorrect DOUBLE value:

Hi guys, i have this error: Truncated incorrect DOUBLE value: 'asinox' this error come from my SEO url: http://127.0.0.1:8000/user/asinox/2010/dec/30/1/este-pantalon-lo-compre-en-plaza-lama-una-aperidad/ "asinox" is the username (usuario), and routing the URL in this way: (r'^(?P<usuario>[-\w]+)/(?P<year>\d{4})/(?P<month>\w{3})/(?...

How to get something to appear on every page in Django?

I'm curious as to the best-practise way to handle having something appear on every page, or on a number of pages without having to assign the data manually to every page like so: # views.py def page0(request): return render_to_response( "core/index.html", { "locality": getCityForm(request.user), ...

Is there a good WikiField for django models?

Is there a simple way I can add a "WikiField" to a model I have in my application? I think the most important requirements are: A text field that can be added to any model. simple wiki markup or editor widget that enables text formatting and easy insertion of links and images. saves revision history with author information, and easily...

Debugging Django project problem.

Hi all, I asked this question before, but had no replies, maybe I wasn't so clear. I'm trying to debug a django project using MySQL database. If I run the admin or trying to use the shell to communicate to the data base every thing is well and I can do every thing. I installed MySQLdb for Python 2.6. I installed PyDev on my Apatana stu...

Implement auto_current_user_add when using Django's User table

I have an AppEngine app that I'm migrating to run in Django, using app-engine-patch to get all the goodness of Django - particularly the Admin interface. One of my models looks like (partially) this: class Request(db.Model): requestor = db.UserProperty(auto_current_user_add=True) When I display a form based on this model I don't di...

how to conver query list into csv using django

how to convert query list into csv using django thaks before ...

filter from an object and more object that related in django?

This Is my models.py class Customer(models.Model): def __unicode__(self): return self.name name = models.CharField(max_length=200) type = models.ForeignKey(Customer_Type) active = models.BooleanField(default=True) class Sale(models.Model): def __unicode__(self): return "Sale %s (%i)" % (self.type, se...

Wrong encoding of text, in Django?

"query" = джазовыми For some reason...when I display it via: {{ query|safe }} I get this: %u0434%u0436%u0430%u0437%u043E%u0432%u044B%u043C%u0438 ...

Why does it print funny characters? unicode problem?

The user entered the word éclair into the search box. Showing results 1 - 10 of about 140 for �air. Why does it show the weird question mark? I'm using Django to display it: Showing results 1 - 10 of about 140 for {{query|safe}} ...

How do i use Django and UTF-8 content-type for template?

When I do: return render_to_response() in Django. How do I set the content-type to UTF-8? So that everything displayed is UTF-8? ...

Doing an atomic update of the first instance in a QuerySet

I'm working on a system which has to handle a number of race-conditions when serving jobs to a number of worker-machines. The clients would query the system for jobs with status='0' (ToDo), then, in an atomic way, update the 'oldest' row with status='1' (Locked) and retrieve the id for that row (for updating the job with worker informat...

decoupling django apps - best practice to layout a project

I'm working on a project that has several apps, and want to include a news app for news stories. However, I'd like to link news stories to objects in my custom app, but use an open source news app to run the news. At the moment I've simply hacked the chosen news app to add in a ForeignKey relationship with my model. i.e. a widgets app...

How to print context content in the template?

How can I print or iterate over all the variables available in the context from the template code? I know about {% debug %} but it contains too much information. I'd just like to print variable names available in the current context. Is there a way to do this without writing custom tag? ...

is there a way to append the etag at the end of the static resources in django.

Hi: In rails, if I import a css file or javascript file, the url will be like this <script type="text/javascript" src="some.js?<ETag here>"></script> if I upgrade the some.js the etag will be changed, so my browser can cache the static resource smartly and update the cache when necessary. Is there a way to do it in django? ...

Does Django need an IDE?

My company is evaluating the possibility of developing a specialized IDE for Django. So we would like to ask Django users: Do you feel the need for a specialized IDE for Django? Would you be willing to pay for it, or would you only consider free a open-source product? What Django-specific features are you missing currently in your ...

Decoupling django apps 2 - how to get object information from a slug in the URL

I am trying to de-couple two apps: Locations - app containing details about some location (town, country, place etc) Directory - app containing details of places of interest (shop, railway station, pub, etc) - all categorised. Both locations.Location and directory.Item contain lat/lng coords and I can find items within a certain dist...

How to do I clear a one to one relationship in a Django model?

I am using a one to one relationship between two models and I need to be able to clear that relationship. However, I cannot find a way to clear(clear(), remove(), etc...) it to remove that relationship, and the Django admin will not perform that operation. Does anyone have experience with this problem? I think I may have to skip the o...