django

django error 'too many values to unpack'

I'm learning Django by building a simple recipes app. I have a 1 table model using the 'choices' field option for recipe categories rather than using a 2nd 'categories' table and a foreign key relationship. So i created db table via syncdb and then loaded table with test data. When i go to admin and click on the 'Recipes' link in an atte...

Admin Form Validation

I've got a Supplier Invoice (SupplierInvoice) parent model that holds a number of orders (SupplierOrder). Right now if the user puts together an invoice via django admin, django checks to see if there are price matches for that Supplier and Product in a cost price table and pulls through the respective fields. This process happens on a...

view on site

I am using def get_absolute_url in my model. It is giving the wrong "View on Site" link. How can it be corrected? ...

Django comment spam

How well does Django's anti-spam system in the comments framework work? Have you used it? What percentage of comment-spam does it prevent roughly? Is there anything else you do to help prevent comment spam on sites using the Django comments framework? ...

template django

how can i use different template in different application.in a project i have two app 1)Site 2)Ad .I want to use default template in Ad but different in Site..How to ?OR in the template is there is a way to use 'if condition' as i have to change only two lines in the templates. ...

Hierarchical Data Models: Adjacency List vs. Nested Sets

I have a product catalog. Each category consists of different number (in deep) of subcategories. The number of levels (deep) is unknown, but I quite sure that it will not be exceed of 5,6 levels. The data changes are much more rarely then reads. The question is: what type of hierarchical data model is more suitable for such situation. T...

django auth User truncating email field

I am having an issue with the django.contrib.auth User model where the email max_length is 75. I am receiving email addresses that are longer than 75 characters from the facebook api, and I need to (would really like to) store them in the user to continuity among users that are from facebook connect and others. I am able to solve the p...

database locking problems with django

I have a webpage which interacts with several external APIs and in order to speed things up (the speed increase is almost linear because the majority of the time is spent waiting for http responses, etc), the code is threaded so that it pulls the content from several APIs at once. The problem is, I am running into database locking presu...

Django Model Inheritance: Duplicated class fields

I have a Django project whereby every model inherits from a common "Object" model - which defines only two fields - the ID of the object (so every object in the entire system has a unique identifier) and a "type". The type is the type of object that particular instance is. This is a sort of "denormalized" field, making it faster to trave...

Customizing a Django admin template

I would like to modify an admin template in Django. % cat /Library/Python/2.5/site-packages/django/contrib/admin/templates/admin/includes/fieldset.html <fieldset class="module aligned {{ fieldset.classes }}"> {% if fieldset.name %}<h2>{{ fieldset.name }}</h2>{% endif %} {% if fieldset.description %}<div class="description">{{ fiel...

How do I filter by time in a date time field?

In the model 'entered' is a datetime field. I want to query the data to find all entry's that where made between noon(start_time) and 5:00pm (end_time). selected = Entry.objects.filter(entered__gte=start_time, entered__lte=end_time) (as I expected)I get an error of: "ValidationError: Enter a valid date/time in YYYY-MM-DD HH:MM[:ss[.u...

Are asynchronous Django model queries possible?

I'm new to Django, but the application that I have in mind might end up having URLs that look like this: http://mysite/compare/id_1/id_2 Where "id_1" and "id_2" are identifiers of two distinct Model objects. In the handler for "compare" I'd like to asynchronously, and in parallel, query and retrieve objects id_1 and id_2. Is there a...

Django question: how can I get user specific information related to a domain object?

Here are my models: class Activity(models.Model): title = models.CharField(blank=False, max_length=100) description = models.TextField(blank=False) class UserActivityWork(models.Model): activity = models.ForeignKey(Activity) user = models.ForeignKey(User) hours_worked = models.FloatField() comment = models.Tex...

after upgrade to python2.6 and ubuntu 9.0, django admin does not load css even though admin media is properly configured.

basically i upgraded ubuntu to juanty, and with it came python2.6 so i decided to take the chance and make django work with it. i re-svn'd django into dist-packages, and made sure to properly sym-link my admin media. Note that i'm not using apache, rather just the django development server. when i load up the admin the css seems to not...

Performance comparisons of Frameworks to Use for an Auction Web Site

I am a Java guy and therefore would prefer a Java based framework for an auction site that I am planning to develop from scratch. But all my colleagues and friends have pointed out to me that the better sites that are coming up now-a-days are mostly written either using Ruby on Rails, Django or ASP.net MVC framework. I was wondering ...

Out of range value adjusted for column warning in django when adding a large integer (11 chars)

i get an "Out of range value adjusted for column" not sure whether there is a fix for this in django ...

Progress bar with long web requests

In a django application I am working on, I have just added the ability to archive a number of files (starting 50mb in total) to a zip file. Currently, i am doing it something like this: get files to zip zip all files send HTML response Obviously, this causes a big wait on line two where the files are being compressed. What can i do to...

Stuck on official Django Tutorial

I am just started out learning Python and also started looking into Django a little bit. So I copied this piece of code from the tutorial: # Create your models here. class Poll(models.Model): question = models.CharField(max_length=200) pub_date = models.DateTimeField('date published') def __unicode__(self): return s...

Different behavior of python logging module when using mod_python

We have a nasty problem where we see that the python logging module is behaving differently when running with mod_python on our servers. When executing the same code in the shell, or in django with the runserver command or with mod_wsgi, the behavior is correct: import logging logger = logging.getLogger('site-errors') logging.debug('log...

django model with two generic (content_type) foreign keys?

I'm trying to create a mapping table between two generic (content_type) references, one for "agents" and one for "resources". So I take the usual way I make a generic foreign key : content_type = models.ForeignKey(ContentType) object_id = models.PositiveIntegerField() resource = generic.GenericForeignKey('content_type', 'object_id') ...