django-models

I have a collection of objects in a database. Images in a photo gallery, products in a catalog, chapters in a book, etc. Each object is represented as a row. I want to be able to arbitrarily order these images, storing that ordering in the database so when I display the objects, they will be in the right order.
For example, let's say...

Hi, I'm work on project with django framework and use control version system to synchronize my code with other peoples. But i don't know how organize work with database.
In django, any people, worked on project, may changes django models, and tell 'syncdb' to synchronize model objects with db.
But other people don't about this changes, ...

Can I have a custom service providing the storage of the models I use in Django? That service would not be speaking SQL.
I would like to build a web frontend to a system that consists of multiple services linked with a network based IPC, one of which provides an interface to commonly used, persistent objects (stored in a database).
The...

I am performing a lot of JavaScript work in the browser and would like to have some of that backend functionality in the front-end. Specifically, it would be nice to have the functions get(), save(), all() and count() available to the client. Additionally, it would be great to have the field list of the model already available in the gen...

I have a two way foreign relation similar to the following
class Parent(models.Model):
name = models.CharField(max_length=255)
favoritechild = models.ForeignKey("Child", blank=True, null=True)
class Child(models.Model):
name = models.CharField(max_length=255)
myparent = models.ForeignKey(Parent)
How do I restrict the choices ...

Is there explicit support for Single Table Inheritance in Django? Last I heard, the feature was still under development and debate.
Are there libraries/hacks I can use in the meantime to capture the basic behavior? I have a hierarchy that mixes different objects. The canonical example of a corporation structure with an Employee class, ...

Specifically, I have a model that has a field like this
pub_date = models.DateField("date published")
I want to be able to easily grab the object with the most recent pub_date. What is the easiest/best way to do this?
Would something like the following do what I want?
Edition.objects.order_by('pub_date')[:-1]
...

Hi,
I'm trying to design a model for a application allowing 2 people to bet with each other (I know, sounds stupid...). What I'm wondering about is how to connect the bet with users. The structure is like this
|-------------| |----------|
| Bet | | User |
| BetUser1 | |----------|
| BetUser2 |
| Winn...

So let's say I'm using Python 2.5's built-in default sqlite3 and I have a Django model class with the following code:
class SomeEntity(models.Model):
some_field = models.CharField(max_length=50, db_index=True, unique=True)
I've got the admin interface setup and everything appears to be working fine except that I can create two Som...

I need to store a tree data structure in my database, for which I plan on using django-treebeard or possibly django-mptt. My source of confusion is that each node could be one of three different possible types: root nodes will always be a type A entity, leaf nodes a type C entity, and anything in between will be a type B entity. I woul...

I'm having an error where I am not sure what caused it.
Here is the error:
Exception Type: OperationalError
Exception Value:
(1054, "Unknown column 'user_id' in 'field list'")
Does anyone know why I am getting this error? I can't figure it out. Everything seems to be fine.
My view code is below:
if "login" in request.sessi...

Given a class:
from django.db import models
class Person(models.Model):
name = models.CharField(max_length=20)
Is it possible (and if so how) to have a QuerySet that filters based on dynamic arguments, likeso:
# instead of
Person.objects.filter(name__startswith='B')
# and
Person.objects.filter(name__endswith='B')
# is th...

Here's what I'm trying to do, and failing...
I have a File model which has a generic-relation to other objects:
class File(models.Model):
content_type = models.ForeignKey(ContentType)
object_id = models.PositiveIntegerField()
content_object = generic.GenericForeignKey()
file = models.FileField(upload_to='files/%Y/%m/%d'...

In my specific case, I have two kinds of "messages" that I need to retrive and paginate.
Let's omit the details, and just say that the first kind is in a model called Msg1 and the other is called Msg2
The fields of these two models are completely different, the only fields that are common to the two models are "date" and "title" (and o...

If there a way to protect against concurrent modifications of the same data base entry by two or more users?
It would be acceptable to show an error message to the user performing the second commit/save operation, but data should not be silently overwritten.
I think locking the entry is not an option, as a user might use the "Back" but...

Hi,
I'm wondering if it's possible to define a foreign key in a models.py file in Django that is a reference to a table in another app?
In other words, I have two apps, called cf and profiles, and in cf/models.py I have (amongst other things):
class Movie(models.Model):
title = models.CharField(max_length=255)
and in profiles/mo...