django

Django Longint in Mysql

Hi there, my project was not working properly when switching from my local development (sqlite3) to mysql. After some inspection, I found that Django seems to use 32-bit-ints for IntegerField on mysql, but I need 64 bit. Is there any way to achieve this? ...

Django: Unpack argument list for use in aggregate query

I am attempting to create a semi-dynamic aggregate function that will return the sums of all fields within a list. The assumption is that running get_query_set() will return a filtered query that contains all the fields in the list and some others that may not play so well with a Sum aggregate (date fields, char fields, Foreign Keys, etc...

Range Queries in Haystack

I need Haystack to send Solr range queries of the type q=age:[10 TO 15]. It messes up the querystring by tokenizing and adding the default operator AND. In this example, Solr receives the query as age:[10 and TO and 15] and it doesn't work. ...

After a PostgreSQL restore, I get "permission denied for relation django_session"

I'm currently running my Django 1.1.1 site with PostgreSQL 8.4.2 both on the live server and locally. When I try to restore one of my backup from the live server on my local box, I get the following error while accessing my site locally(http://localhost:8000): Exception Type: ProgrammingError at / Exception Value: permission denied for...

When is django_authopenid.views.signin_success() called from because I can't find it in project.

OpenId is vexing me. I'm trying to add a related UserProfile after a User is created from django_authopenid. As I currently understand how this module works, it seems that: User.objects.create_user(form1.cleaned_data['username'], form1.cleaned_data['email'], tmp_pwd) is only called from 2 methods: django_authopenid.views.reg...

Dump django debug output to a file?

I noticed in the django documentation that when DEBUG is False it will mail your configured ADMINS the full exception information. Is there an easy way to dump the full exception information this to a file? ...

Django check if JavaScript is on

Hi, Is there a way in Django (preferably in a view) to check if the user has JavaScript turned on? I need to display a very different page if a user has JavaScript than if they don't. Thanks ...

What does Django do with `MEDIA_ROOT`?

What does Django do with MEDIA_ROOT exactly? I never understood it. Since Django itself doesn't serve static media, and you have to set up apache or something similar for it, why does it care in which directory it sits? ...

Django's forms.Form vs forms.ModelForm

Could anyone please explain to me similarities and differences of Django's forms.Form & forms.ModelForm? I've used Django for 4 days, so excuse me if I don't know basic things. Thanks in advance! ...

django database many2many relationship errors

hi i am using the following models to build a database from django.db import models from django.contrib import admin class Team(models.Model): """Model docstring""" slug = models.SlugField(max_length=200) Team_ID = models.AutoField(primary_key=True) Team_Name = models.CharField(max_length=100,) College = models.Ch...

Django RegexField

Hello, at the registration process I want to enforce typing first and last name of the users. For this purpose, I need to write a regex. What I need is the username should accept any char input but starting with a number like (1sdasd) or an empty string (like pressing space at this field which makes an empty string " ") What can be the...

django having multiple one many to many relations that references same model

i have a model that is having multiple many to many relation to another model it is as follows: class Match(models.Model): """Model docstring""" Match_Id = models.AutoField(primary_key=True) Team_one = models.ManyToManyField('Team',related_name='Team one',symmetrical=False,) Team_two = models.ManyToManyField('Team',related_nam...

Where does 'article_set' come from in Django?

Hello! I am currently working on a Django/Pinax application (I'm sure my question is not pinax-specific, that's why Pinax's not mentioned in the theme title), and trying to figure out how the whole framowork works. Right now I have to write a view to pass data to a tempate. I've only seen it done in the django manual: there ObjectName.o...

Get zip code based on IP Address with Python

Is it possible to find the zip code based on a users IP address using python / django (not geodjango)? I assume I would have to use a web service, but I would really like to just be able to query a database if possible. I am using geopy right now, so it would be cool if I could integrate that somehow. ...

Django: Two Users with the same username.

How can I extend Auth to allow for multiple users with the same username. In SAAS this is a need because two accounts might have a user called "owner" or something like that. ...

500 error when deploying django-testapp to app-engine using django-nonrel

I'm trying to get up and running with the django-testapp on app engine. I've gotten it working fine in my development environment, but I'm getting 500 server errors when I deploy it to app engine. Here's what I'm doing: Per http://www.allbuttonspressed.com/blog/django/2010/01/Native-Django-on-App-Engine#disqus_thread hg clone http...

python 2.6.4 doesn't support mod_python?

Hi, am looking for a way to run django by just using my xampp, and i bumped into this tutorial online http://jyotirmaya.blogspot.com/2008/11/xampp-python-django.html according to the author, mod_python 3.3.1 is not supported by python 2.6, but the blog post was created more then a year ago i think. is this thing still true until now? or ...

How can I limit an SQL query to be nondestructive?

I'm planning on building a Django log-viewing app with powerful filters. I'd like to enable the user to finely filter the results with some custom (possibly DB-specific) SELECT queries. However, I dislike giving the user write access to the database. Is there a way to make sure a query doesn't change anything in the database? Like a 'dr...

django quantity form widget

Hello, I want to develop a basic quantity widget that is a dropdown selection box, consuming an integer which will be the maximum amount of quantity, users can select from 1 to the maximum quantity. And in the end my form will be using this widget and if somehow the given amount is greater than the maximum, it shouldn't validate. (indee...

How do I make Django-Piston to include related child objects in the serialized output?

Hi guys! I am pulling my hair out here because this isn't working for me and seems like it should be. I am using Django-Piston to develop an API and have 2 models, Building and Building Area. BuildingArea has a ForeignKey to Building as there are multiple areas in a building. The 'related_name' property for the FK is 'areas' so I can a...