django

Django: What exactly are signals good for?

I have a tough time understanding how signals work into my application (and how they work period). These are three areas where I assume they would apply (with my current knowledge): 1) Send XML to a remote server for reporting (after a transaction is complete). 2) Re size an image and upload the thumbnail to S3 after a user uploads it. ...

Set parent in a ModelForm in Google App Engine

I want to create an Entity Group relationship in an Entity that is being created through a ModelForm. How do I pass the parent instance and set the parent= attribute in the ModelForm? ...

Retrieving "businesses" with Google Maps API?

This is an example of a Business on Google Maps http://tiny.cc/5IMLd It has elements attached such as: Reviews from various sites (qype, viewlondon, etc...) Details provided by various sites Photos and other content I don't know how to go on about retrieving such Business and associate any items generated on my website. What I have...

How do I create a request object in Django?

So I'm using Django with Google App Engine and I have an urls.py file that redirects each url to a corresponding method. Each one of those methods is automatically passed "request" as one of the arguments, which I believe is an HttpRequest object. How do I create this populated request object from within my code? For example, if I'm wi...

What is the purpose of pinax's groups?

I viewed the DjangoCon 2009 talks about pinax by James Tauber and pydanny and heared about pinax's groups. But I don't get the actual usecases they describe, even after reading the documentation. So what is the real purpose of groups and what advantages do I get in using them? It would be nice if you could provide a simple usecase to l...

POSTing forms in Django's admin interface

I'm writing a Django admin action to mass e-mail contacts. The action is defined as follows: def email_selected(self,request,queryset): rep_list = [] for each in queryset: reps = CorporatePerson.objects.filter(company_id = Company.objects.get(name=each.name)) contact_reps = reps.filter(is_contact=True) ...

Best JSON library to get JSON data for Django?

What is the best JSON library to get JSON data for Django, 'simplejson' or otherwise? thanks very much ...

Is a reason I can't add a ManyToManyField?

So I'm building a Django application, and these are a few models I have: class MagicType(models.Model): name = models.CharField(max_length=155) parent = models.ForeignKey('self', null=True, blank=True) class Spell(models.Model): name = models.CharField(max_length=250, db_index=True) magic_words = models.CharField(ma...

Reverse ForeignKey lookup

I'm new to Django and am still trying to break old PHP habits. Below are two models. To make things confusing they live in separate files, in different apps... #article.models from someapp.author.models import Author class Article(model.Model): ... author = models.ForeignKey(Author) # author.models class Author(model.Model): ...

Django template ifequal tag

I'm using an ifequal tag in my django template inside a loop where atleast one of the items should equal the other at some point in the loop but for some reason it never displays what it should. I was wondering if there are any weird cases that i should know about. I have a list of int city ID's that should be checked as check boxes. so...

using django and twisted together

1)I want to devlop a website that has forums and chat.The chat and forums are linked in some way.Meaning for each thread the users can chat in the chat room for that thread or can post a reply to the forum. I was thinking of using django for forums and twisted for chat thing.Can i combine the two? The chat application devloped using twi...

Which Postgres value should I use in Django's DATABASE_ENGINE?

It's my first time using PostgreSQL 8.4.2 with Django(I have always used MySQL or sqlite3 in the past). Which value should I use for DATABASE_ENGINE in settings.py, postgresql_psycopg2 or postgresql? How do they differ from each other? ...

why 1 is ok,but 2 is error,use django and jquery.

django view: def json_view(request): import json tag=request.GET.get('tag') if tag=='userName': username=request.GET.get('userName') result='successName' if username: try: user=User.objects.get(username=username) result='existName' except User.Do...

Where is the function 'real_ugettext' in django?

In django.utils.translations.__init__.py: def ugettext(message): return real_ugettext(message) I can't find it. ...

Resilient '%' escape for string formatting in Python

I have a string, specifically a SQL query, that goes through multiple formatting passes before it is passed to the backend to be executed, at which point Django performs yet another string format. How can I preserve the placeholders that need to make it to the database throughout all of this? Something like the following is the best I've...

django error. about django.forms

from django import forms class a(forms.Form): name = forms.CharField(initial='Your name') url = forms.URLField(initial='Your Web site') comment = forms.CharField() data = {'name': 'hahaha', 'url': '', 'comment': 'Foo'} f = a(data,auto_id=False) #print f.is_valid() print f.errors errors: Traceback (most recent call last)...

Django: Check on type of relation a form has

I have a situation where I need to check if a form has m2m relation before saving it in views.py as I am using the same views.py for different models. Example: #models.py class BaseClass(models.Model): # Some generic stuff. class SomeClass(BaseClass): # This class doesnt have any many2many relations class SomeOtherClass(BaseCla...

Django ForeignKey issue

I have two classes class A(models.Model): id=models.IntegerField(primary_key=True) name=models.CharField(max_length=200) store_id=models.IntegerField() type=models.ForeignKey(B) class B(models.Model): id=models.IntegerField(primary_key=True) type=models.CharField(max_length=10) class C(models.Model): id=mo...

problem in installing django

problem with installing django i am geting folllowing error E:\Softwares\Django-1.1.1.tar\Django-1.1.1\Django-1.1.1>setup.py install Traceback (most recent call last): File "E:\Softwares\Django-1.1.1.tar\Django-1.1.1\Django-1.1.1\setup.py", line 48, in ? root_dir = os.path.dirname(__file__) NameError: name '__file__' is not define...

Is there a Django or Rails for the .Net Platform?

Now before I dive too far into this this question, I am aware of nDjango and MonoRail; however, those project seem to be lacking. What I'm wondering is if there is a solution out in the .Net world that has the following features out of a single box like Rails has in Ruby or Django has for Python. I know tools that do pieces but am curi...