django

propagating ?next= in django-registration

I have a view that has the @login_required decorator and upon pulling up the page, if you are not logged in it does send you to the login form with the proper ?next=/url/you/tried/to/see My problem is how to I pass along that ?next value to the subsequent forms and activation email so that when the user completes the activation process ...

Django: How to force translation into a given language inside a template ?

In a Django template, I need to transanlate some strings to a specific language (different from current one). I would need something like this: {% tans_to "de" "my string to translate" %} or {% blocktrans_to "de" %}my bloc to translate {% endblocktrans_to %} to force translation to German. I know I can call the following code in a v...

Django + WSGI: Force object initialization?

I have a form class that looks something like this: class RegisterForm(Form): username = Field(model_field='username', filters=validators.minlength(3)) You'll notice that username is a class variable. I believe this means that Field will be constructed once the first time the RegisterForm is used (after apache is restarted). It wi...

Django Multi-Table inheritance and model creation

I have some code that follows the example for multi-table inheritance as given on the documentation page: http://docs.djangoproject.com/en/dev/topics/db/models/#multi-table-inheritance. What I am trying to do is create a restaurant around a place. I've already created a place, and I want to make a restaurant at it like so: >>> p = Plac...

ModSecurity: Output filter: Failed to read bucket (rc 104): Connection reset by peer

Hi, I'm doing a POST request to a rest service made with django and piston uploading a file, but when I do the request i get this (strange?) error: [Sun Jul 04 16:12:38 2010] [error] [client 79.39.191.166] ModSecurity: Output filter: Failed to read bucket (rc 104): Connection reset by peer [hostname "url"] [uri "/api/odl/"] [unique_id "...

Why does Django use a BaseForm?

I think I finally figured out they need to use this DeclarativeFieldsMetaclass (to turn the class fields into instance variables and maintain their order with an ordered/sorted dict). However, I'm still not quite sure why they opted to use a BaseForm rather than implementing everything directly within the Form class? They left a comment...

Is it possible, and/or advisable to develop Django web applications on OS X (10.6.4 and 10.5.8) using Python 2.6.5 64-bit? Why?

I'm trying to decide on which architecture to choose for developing Django 1.0.x through Django 1.2.1. I've managed to get MySQL, MySQLdb, PIL, and Python 2.65 installed on Snow Leopard using x86 64-bit builds, but I'm curious as to whether or not there is a definitive answer to this question at the moment, and if so, why? Thank you! Mi...

Django Inheritance and Permalinks

Hi, I'm creating a simple CMS in django, with multiple "modules" (each as a django app). I've set up the following models: class FooObject(models.Model): id = models.SlugField(primary_key=True) name = models.CharField(max_length=255) creator = models.ForeignKey(auth.models.User, editable=False, related_name="createdby") cl...

Conditional context processor for authenticated users

I have a context processor returning list of users friends. I'd like it to return the dictionary of friends only if user is logged in, because currently I have clean database without any users and I'm getting error : Exception Type: DoesNotExist at / Exception Value: UserProfile matching query does not exist. Here are two versions I wa...

Django Templates - Printing Comma-separated ManyToManyField, sorting results list into dict?

Hi, I have a Django project for managing a list of journal articles. The main model is Article. This has various fields to store things like title of the article, publication date, subject, as well as list of companies mentioned in the article. (company is it's own model). I want a template that prints out a list of the articles, sorte...

python path django

How can I add something to my "Pythonpath". Where exactly are the files located, I have to change to add to my pythonpath? What exactly do I add to my Pythonpath? If Python calls: /Library/Frameworks/Python.framework/Versions/2.6/Resources/Python.app/Contents/ But I want it to call /Library/Frameworks/Python.framework/Versions/2.6/...

How do I print some python function output to console (for debugging purposes, while using manage.py runserver) from within a django template

I am working on a custom Django form field and accompanying widget. While rendering the template, i would like to inspect the form.field as a python object. How do I do that, because anything in a Django template outside of template tags and filters is rendered as text. ...

Django apps equivalent to Drupal's CCK and Views modules?

Are there any Django apps equivalent to Drupal's Views and CCK modules? I find Django much more flexible and logically organized than Drupal. But I think Drupal's Views and CCK modules are killer apps. They let the webmaster very rapidly to build new data models and queries through GUI without touching the code. These modules are very u...

how to serve generated files via django

Hello I am generating tar.gz files with Django and save it to somewhere like /home/foo/foo.tar.gz but I don't know what is a good way to serve these generated files under django view. I am using return HttpResponseRedirect("/home/foo/foo.tar.gz") but it is actually not a good way to serve tar.gz files because the generated tar.gz file p...

How do I create a data structure that will be serialized this JSON format in python?

I have a function that accepts a list of date objects and should output the following dictionary in JSON: { "2010":{ "1":{ "id":1, "title":"foo", "postContent":"bar" }, "7":{ "id":2, "title":"foo again", "postContent":"bar baz boo" } }, "2009":{...

Django Python Delete Project App Library

If I want to delete a Django App or Project. Is there a way to cleanly delete it? Or a library in Python? How can I delete and re install libraries. So I am SURE that nothing is left of that library. Thanks a lot ...

Django forms analog in ASP.NET MVС

Hi guys, Is there any analog to Django forms (http://docs.djangoproject.com/en/dev/topics/forms/?from=olddocs) in ASP.NET MVC 2? ...

Django Photologue Tutorial

I have a hard time understanding how photologue works exactly. Is anybody aware of a Example Project Tutorial where I can display a gallery via Django-Photologue. Where Imagelinks are stored in a database? Or how can I achieve that in Django? Or what else is out there to create a decent Photo Display? Thanks for the time! ...

Cant understand the format of django.VERSION :-/

What does this mean? 1.0 or 1.1 ? >>> django.VERSION (1, 1, 1, 'final', 0) Apologies for such a dumb question! ...

Django static media files are not coming through

I cannot, for the life of me, get my static media files to come through on my local test machine in one particular project, though I've had no problem with a few other Django projects. I'm using Django 1.1.1 and a Windows XP environment. My settings.py looks like this for the media-hosting stuff: ROOT_PATH = os.path.dirname(__file__) ...