django

File uploads in Django: prevent FileField from writing the full path to the database.

I'm building a software repository on top of the Django framework. Because it will contain a lot of files, i want it to make some sense when looking at it through a file manager. So i grouped the files first by the URL of a program they belong to and then by first two letters of that URL. Here's how it looks: The schema looks like thi...

Which MVC framework in Perl has its own standalone server?

I am creating an automated testing framework in Perl for regression tests. I would like to post my results from the test machines. I have used django before where the server ran standalone with no installation needed. Which MVC framework in Perl has its own standalone server? Basically, which of the Perl MVC frameworks is closest to dja...

Ordering fields inside Inlines in Django Admin

I have a ManyToMany relationship setup with intermediary objects in Django. Any ideas how I can order the < select >s in the Inlines that show up for the intermediary objects? ...

does custom user class break applications in django?

Let's say that I have subclassed User model (CustomUser) properly (as explained here: http://scottbarnham.com/blog/2008/08/21/extending-the-django-user-model-with-inheritance/) and installed the comments app. to access the user of a comment in the template I write: {{comment.user}} # which provides User, not my CustomUser and theref...

Reorder users in django auth

I have a model that has a ForeignKey to the built-in user model in django.contrib.auth and I'm frustrated by the fact the select box in the admin always sorts by the user's primary key. I'd much rather have it sort by username alphabetically, and while it's my instinct not to want to fiddle with the innards of Django, I can't seem to fi...

Capturing Implicit Signals of Interest in Django

To set the background: I'm interested in: Capturing implicit signals of interest in books as users browse around a site. The site is written in django (python) using mysql, memcached, ngnix, and apache Let's say, for instance, my site sells books. As a user browses around my site I'd like to keep track of which books they've viewed, ...

Uploading multiple images in Django admin

I'm currently building a portfolio site for a client, and I'm having trouble with one small area. I want to be able to upload multiple images (varying number) inline for each portfolio item, and I can't see an obvious way to do it. The most user-friendly way I can see would be a file upload form with a JavaScript control that allows the...

Giving anonymous users the same functionality as registered ones

I'm working on an online store in Django (just a basic shopping cart right now), and I'm planning to add functionality for users to mark items as favorite (just like in stackoverflow). Models for the cart look something like this: class Cart(models.Model): user = models.OneToOneField(User) class CartItem(models.Model): cart = m...

Need help for facebook fql query

Hi, I wanted to know why is this code wrong. new_query = "SELECT time,message FROM status WHERE (uid=%s % request.facebook.uid) AND time > someval.time" new_result = request.facebook.fql.query(new_query) Someval.time is correct time format according to facebook time format. So why does it gives me wrong code?? new_query = "SELECT ti...

Stackless installation and configuration with DJango

I am trying to run a DJango Command Extension which uses stackless. I have installed Stackless Python (compiled with python 2.5) so whenever I type python2.5 at the console it fires up indicating that the version is Python 2.5.2 Stackless 3.1b3 060516 (python-2.52:72942, May 26 2009, 23:07:34) [GCC 4.3.3] on linux2 But in my eclipse ...

Implementing Tiny MCE As Local HTML Editor

UPDATE: There are stupid questions, and this is one of them. I didn't realize that serving JavaScript via Django was so large a question. When I've answered it, I'll post the most useful resources for those who want to RTFM, unless the mods close this first. Until then, sorry for wasting your time. How do I install and configure Ti...

How to use different template for different browser

I'd like to deliver special versions of my django site for different (mobile-)browser. What are possible solutions to do this? ...

Configure Apache to recover from mod_python errors

I am hosting a Django app on Apache using mod_python. Occasionally, I get some cryptic mod_python errors, usually of the ImportError variety, although not usually referring to the same module. The thing is, these seem to come up for a single forked subprocess, while the others operate fine, even when I force behavior that requires usin...

django -- application subdirectory site/app1/app2/app3

Hello, If you were to write an app for a site, but wanted to make the app plug&play so you can just drop it in any Django project, set the main URL and there you go, how would you do that if you wanted to keep all the other required utility apps included in your portable app. Example: site/ site/site-app1 site/templates/site-app1 site...

Django Formset.is_valid() failing for extra forms

In my Django application application I have a formset that is created from a simple (not-model) form, with the extra=1 (to allow javasript to add more forms later on). class SomeForm(forms.Form): #some fields with required=False length = forms.IntegerField(required=False) # An example of one of the fields with choices i hav...

how to override the verbose name of a superclass model field in django

Let's say that I have a model Foo that inherits from SuperFoo: class SuperFoo(models.Model): name = models.CharField('name of SuperFoo instance', max_length=50) ... class Foo(SuperFoo): ... # do something that changes verbose_name of name field of SuperFoo In class Foo, I'd like to override the verbose_name of the name fi...

django filter format for date

Hello, year_id (2004 etc) is a dropdown box on the template. The users selects a year and this is retrieved as year_id in the view. I need to select publications based on year from a field called grantstartdt which is in the format 2008-01-01. The error is: int() argument must be a string or a number, not 'Year' year_id = request....

In Django, how do you retrieve a field of a many-to-many related class?

I have two classes with a ManyToMany relationship. I'd like to select one from the first class and access the fields of the related class. It seems like this should be easy. For example: class Topping(models.Model): name = models.CharField(max_length=40) class Pizza(models.Model): name = models.CharField(max_length=40) toppings =...

How do I access the child classes of an object in django without knowing the name of the child class?

In Django, when you have a parent class and multiple child classes that inherit from it you would normally access a child through parentclass.childclass1_set or parentclass.childclass2_set, but what if I don't know the name of the specific child class I want? Is there a way to get the related objects in the parent->child direction witho...

Django ORM Query to limit for the specific key instance.

Projectfundingdetail has a foreign key to project. The following query gives me the list of all projects that have any projectfundingdetail under 1000. How do I limit it to latest projectfundingdetail only. projects_list.filter(projectfundingdetail__budget__lte=1000).distinct() I have defined the following function, def latest_fundi...