Apps importing from each others models

2007-07-12 Thread leanmeandonothingmachine
Is it possible for two apps to import from each others models? Lets say I have two apps, articles and photos: App articles: from mysite.photos.models import photo class topics: class articles with a ManytoManyKey to photos App photos: from mysite.articles.models import topics class photos with

Re: syncdb building freaky database

2007-07-12 Thread leanmeandonothingmachine
You need to use null=False to allow null values. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this gro

Re: syncdb building freaky database

2007-07-12 Thread leanmeandonothingmachine
sry it's null=True --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTEC

Re: Apps importing from each others models

2007-07-12 Thread leanmeandonothingmachine
I was trying to avoid that, as in my actual use case it doesn't seem to make sense to combine apps. Thanks for the help. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, s

Auto generate url patterns

2006-12-07 Thread leanmeandonothingmachine
Noob question: I've just started getting into django, and wanted to get opinions on auto generating url patterns from a db. Is that bad practice, will it slow down the site? I'm thinking of doing this for a few reasons: 1) The client is very particular about the path. So I want to use one app to

Re: Auto generate url patterns

2006-12-08 Thread leanmeandonothingmachine
I'll try to be a little clearer with what I need. The client is going to provide a list of arbitary urls that they wants ei: about/, about/history/, contact/, services/, etc... and they need to be able to add or remove urls using the admin interface, no changing the url.py file. So there will be

Re: Auto generate url patterns

2006-12-08 Thread leanmeandonothingmachine
I did want to use flatpages but can't for the 2 reasons in my orginal post, unless I'm wrong about those limitations, in which case flatpages would be perfect. I understand about urls being a collection of patterns, but I don't see how I can make a pattern that fits when I won't have a set parent

select_related() with the ForeignKey in the same table

2006-12-15 Thread leanmeandonothingmachine
I have a model where the foreign key refers to it self. parent = models.ForeignKey('self', core=True, null=True, blank=True) What i want to do is to be able to run a query with select_related and get all the parents of that row. When I run test = content.objects.select_related().get(pk=3) and if

Getting the new data value

2007-01-05 Thread leanmeandonothingmachine
How do you get values that will be written to the db in a models save(self) method before you save the changes to the db? I tried self.field but that gives what the current db value is? I need change the data that is being written, but I'd rather not have to do multiple writes to the db. --~--~

Getting data that will be written

2007-01-05 Thread leanmeandonothingmachine
I have a model where I'm using the save(self) method, but I can't figure out how to get the data that will be writen without writing it to the db first. I need to modify a value that's being writen. --~--~-~--~~~---~--~~ You received this message because you are

Re: Getting the new data value

2007-01-05 Thread leanmeandonothingmachine
tx for the reply sry about the double post On Jan 5, 3:07 pm, David Zhou <[EMAIL PROTECTED]> wrote: On Jan 5, 2007, at 2:04 PM, leanmeandonothingmachine wrote: > How do you get values that will be written to the db in a models > save(self) method before you save the changes to the

Re: Getting data that will be written

2007-01-05 Thread leanmeandonothingmachine
tx for the reply sry about the double post On Jan 5, 3:31 pm, "James Bennett" <[EMAIL PROTECTED]> wrote: On 1/5/07, leanmeandonothingmachine <[EMAIL PROTECTED]> wrote: > I have a model where I'm using the save(self) method, but I can't > figure out h

Re: Getting data that will be written

2007-01-05 Thread leanmeandonothingmachine
turns out i was modifying the values in a post_init and thats why I thought I wasn't getting the right thing. On Jan 5, 3:33 pm, "leanmeandonothingmachine" <[EMAIL PROTECTED]> wrote: tx for the reply sry about the double post On Jan 5, 3:31 pm, "James Bennett" &

Inner Join

2007-01-08 Thread leanmeandonothingmachine
I have 2 models, table1 and table2 table2 has a foreign key to table1. How djagno do a inner join with an instance of table1? the sql I want is: select * from table1 INNER JOIN table2 where table1.id = table2.table1_id AND table2.field = 'foo' but I want to use the table1 object: foo = table1.o

New QuerySet Object in admin search

2007-01-18 Thread leanmeandonothingmachine
This isn't really a question, I'm just trying to understand why in the admin code for searching on the changelist page it creates a new QuerySet object instead of using the same one? lines 730-734 admin/views/main.py other_qs = QuerySet(self.model) if qs._select_rel