django

Web application background processes, newbie design question

I'm building my first web application after many years of desktop application development (I'm using Django/Python but maybe this is a completely generic question, I'm not sure). So please beware - this may be an ultra-newbie question... One of my user processes involves heavy processing in the server (i.e. user inputs something, serv...

how to do a select max in django

I have a list of objects how can I run a query to give the max value of a field: I'm using this code: def get_best_argument(self): try: arg = self.argument_set.order_by('-rating')[0].details except IndexError: return 'no posts' return arg rating is an integer ...

Performing a getattr() style lookup in a django template

Python's getattr() method is useful when you don't know the name of a certain attribute in advance. This functionality would also come in handy in templates, but I've never figured out a way to do it. Is there a built-in tag or non-built-in tag that can perform dynamic attribute lookups? ...

accurate page view count

What is a good approach to keeping accurate counts of how many times a page has been viewed I'm using Django. Specifically, I don't want refreshing the page to up the count. ...

problem with sqlite write access for django-apache-wsgi app

an idea why? the debug screen says that django does not have write access to the db ...

"x Days ago' template filter in Django?

I'm looking for a filter that turns a datetime instance into 'x Days' or 'x years y months' format (as on SO). Suggestions? Am I overlooking something very obvious? ...

Django templates: Group items in Threes

Hi here guys. I have an odd problem with Django. I have a set of objects that Im looping through in a template as you would normally. However, I need to group the items in threes. The layout of the page goes like this: Painting 1 - Painting 2 - Painting 3 D E S C R I P T I O N 1 D E S C R I P T I O N 2 D E S C ...

Background process in GAE

I am developing a website using Google App engine and Django 1.0 (app-engine-patch) a major part of my program has to run in the background and change local data and also post to a remote url... can sumone suggest an effective way of doin this... ...

choice property in google app engine

platform: django 1.0, google app engine, app-engine-patch , python 2.5.4 i am tring to use the choices attribute as i always have been using in django website STATUS_CHOICES = ( (1, _('Yet To Start')), (2, _('Running')), (3, _('Paused')), (4, _('Completed')), (5, _('Cancelled')), (6, _('Error')),) class Campaign(db.Model): name = ...

Finding object count where a field is unique in Django

I have a model that is something like this: class Input(models.Model): details = models.CharField(max_length=1000) user = models.ForeignKey(User) class Case(Input): title = models.CharField(max_length=200) views = models.IntegerField() class Argument(Input): case = models.ForeignKey(Case) s...

how can I change to way a boolean prints in a django template

I have some django code that prints a BooleanField it is rendered as True or False, can I change the label to be Agree/Disagree or do I need to write logic for that in the template? ...

Django select_related() for multi-join query using model & filters

Hi, I have two Models: Job & Location: class Job(models.Model): title = models.CharField(max_length=20) company = models.CharField(max_length=20) location = ForeignKey('Location') class Location(models.Model): country = models.CharField(max_length=20) state = models.CharField(max_length=20) city = models.CharField(m...

Django or Ruby-On-Rails?

I have been looking for jobs right now. And, most of the companies require RoR or Django experience. I don't know both ... number of organization working in RoR is greater than Django ... but, I prefer django coz of Python ... What do u coders/recruiter suggest me to know? ...

I get "parent_id may not be NULL" when creating my Django model

I'm creating my own Group model; I'm not referring to the builtin Group model. I want each hroup to be a member of another group (it's parent), but there is the one "top" group that doesn't have a parent group. The admin interface won't let me create a group without entering a parent. I get the error personnel_group.parent_id may not be...

Problem installing pyscopg2 on Mac OS X

I have downloaded the latest build of pyscopg2 and have tried to build and install it using the directions provided. However i always get an error saying that 'w' is undeclared. Does anybody have any experience with this? ...

Modelling a swiss tournament in Django

I'm trying to create models that represent a swiss tournament, with multiple rounds. Each round everyone will be paired up with another player, except in the case where there is an odd player out, when one player will get a bye. I need to keep track of the outcome of each pairing; i.e., which player won. Also, I'd like to be able to ef...

User-defined derived data in Django

How do I let my users apply their own custom formula to a table of data to derive new fields? I am working on a Django application which is going to store and process a lot of data for subscribed users on the open web. Think 100-10,000 sensor readings in one page request. I am going to be drawing graphs using this data and also showing ...

How do I upload pickled data to django FileField?

I would like to store large dataset generated in Python in a Django model. My idea was to pickle the data to a string and upload it to FileField of my model. My django model is: #models.py from django.db import models class Data(models.Model): label = models.CharField(max_length=30) file = models.FileField(upload_to="data") I...

actions in django

How can i enable or disable actions according to the value of a field.For example In my model I have a status field which can have either of the value 'activate','pending','expired'.I am making a action which set the status equals to 'activate'.Know I want the action to be enable only if status is 'pending'. ...

Javascript graphing library to draw a region

As a keen windsurfer, I'm interested in how windy the next few weeks are going to be. To that end, I've been writing a little app to scrape a popular weather site (personal use only - not relaying the information or anything) and collate the data into a single graph so that I can easily see when's going to be worth heading out. I have t...