Re: Foreign Keys

2009-07-21 Thread AKK
Thank you, got it working On 21 July, 16:55, Daniel Roseman wrote: > On Jul 21, 4:25 pm, AKK wrote: > > > > > Thanks, i tried this: > > > blog_posts = Post.objects.filter(post_slug=slug) > > blog_comments = blog_posts.comment_set.all() > > > but i got this error and i don't know why: > > > Trac

Re: Foreign Keys

2009-07-21 Thread Daniel Roseman
On Jul 21, 4:25 pm, AKK wrote: > Thanks, i tried this: > > blog_posts = Post.objects.filter(post_slug=slug) > blog_comments = blog_posts.comment_set.all() > > but i got this error and i don't know why: > > Traceback: > File "C:\ProgLangs\Python25\lib\site-packages\django\core\handlers > \base.py"

Re: Foreign Keys

2009-07-21 Thread AKK
Thanks, i tried this: blog_posts = Post.objects.filter(post_slug=slug) blog_comments = blog_posts.comment_set.all() but i got this error and i don't know why: Traceback: File "C:\ProgLangs\Python25\lib\site-packages\django\core\handlers \base.py" in get_response 86. response =

Re: Foreign Keys

2009-07-21 Thread TiNo
On Mon, Jul 20, 2009 at 23:24, AKK wrote: > > Hello, i currently have two classes in my model: > > class Post(models.Model): >prepopulated_fields = {"post_slug": ("post_title",)} > >post_title = models.CharField(max_length=750) >post_slug = models.SlugField() >

Re: Foreign Keys

2009-07-21 Thread AKK
Do i need to have a one to many or many to many field for this to work? Thanks Andrew On 20 July, 22:24, AKK wrote: > Hello, i currently have two classes in my model: > > class Post(models.Model): >     prepopulated_fields = {"post_slug": ("post_title",)} > >     post_title = models.CharField(

Re: Foreign keys in admin

2009-03-26 Thread Leonel Nunez
> Hi, > > google for raw_id_fields > > That was faster !! Thank you very much Leonel --~--~-~--~~~---~--~~ 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@googl

Re: Foreign keys in admin

2009-03-26 Thread Thomas Guettler
Hi, google for raw_id_fields Leonel Nunez schrieb: > Hello : > > I have this model : > > class Rel(models.Model): > n = models.ForeignKey(MASTER) > r = models.ForeignKey(MASTER,null=True,related_name='child_set', > blank=True) > > > But in the admin gets too slow since this mod

Re: Foreign keys with null=True and QuerySet.exclude

2007-11-23 Thread Michael Radziej
On Fri, Nov 23, Andrew McMurry wrote: > > I have models something like this: > > class Attribute (Model): > name = CharField(maxlength=32) > private = BooleanField(default=False) > > class Object (Model): > ... > attr = ForeignKey(Attribute, null=True, blank=True) > >

Re: foreign keys between different application models

2007-08-30 Thread Russell Keith-Magee
On 8/30/07, Graham Carlyle <[EMAIL PROTECTED]> wrote: > > I haven't found a lot of information on how people typically do schema > migrations for Django after reading the docs/scanning the wiki/googling. > However the manual route seems to be a preferred option... At the moment, yes. The purpose

Re: foreign keys between different application models

2007-08-30 Thread Graham Carlyle
On Thu, 2007-08-30 at 07:27 +0800, Russell Keith-Magee wrote: > 1) If you have a non-trivial amount of data in your production > database, the space and time required to deserialize, store and > reserialize the contents of the databse could be problematic. Fortunately I have a small amount of dat

Re: foreign keys between different application models

2007-08-29 Thread Russell Keith-Magee
On 8/29/07, Graham Carlyle <[EMAIL PROTECTED]> wrote: > > I was hoping something similar would be tenable for the production phase > as well... just dumping the data and then re-loading after recreating > the database, with some possible data munging if the schema has changed > in an incompatible

Re: foreign keys between different application models

2007-08-29 Thread Graham Carlyle
On Wed, 2007-08-29 at 21:12 +0800, Russell Keith-Magee wrote: > There are 2 options for workarounds: > 1) use SQL ALTER statements rather than resetting the table. This > requires writing manual SQL statements to modify the existing tables > 2) Drop the entire database and start again from scratch

Re: foreign keys between different application models

2007-08-29 Thread Russell Keith-Magee
On 8/29/07, Graham Carlyle <[EMAIL PROTECTED]> wrote: > > So should models in different application's never have foreign key > dependencies and so i should bring them back to one application? or does > anyone know if there is another way around this problem? Models can and should have foreign key

Re: Foreign keys and applications

2006-06-15 Thread Luke Plant
On Thursday 15 June 2006 19:12, Luke Plant wrote: > This is because your models are in different apps. I can't remember > off-hand what the correct syntax is of course, the way to find out is to use the /admin/doc/ view, or examine the object with 'dir' in a python interactive shell, or the t

Re: Foreign keys and applications

2006-06-15 Thread Luke Plant
On Wednesday 14 June 2006 12:20, Viktor wrote: > I have two applications in my project: > ... > But when in my views I try to do: > > c1 = Cls1.objects.get(pk=1) > clss = c1.cls2_set.all() > > I get: > > 'Cls1' object has no attribute 'cls2_set' This is because your models are in different apps.

Re: Foreign keys in views

2006-05-27 Thread Christian Schneider
Jorge,thanks for your answer. That's what I'm doing now. Unfortunately, I don't have time to dive deeper into CustomManipulators but maybe for the next project.Best regardschris On 5/26/06, Jorge Gajon <[EMAIL PROTECTED]> wrote: Hi,I also found that behavior and what I did was to copynew_data['stat

Re: Foreign keys in views

2006-05-26 Thread Jorge Gajon
Hi, I also found that behavior and what I did was to copy new_data['station'] to new_data['station_id'] when there were errors from "get_validation_errors()". Like this: def change_recording(request, recording_id): snip. if request.POST: new_data = request.POST.copy()

Re: Foreign keys in Django models without id fields?

2005-08-03 Thread gheorghe
" this can cause *huge* performance problems" True, but I believe that's why we usualy set up 2 databases one transactinal, where we stay put on to much normalization, relatinships, indexes etc., and query oriented databases where this performance may no matter that much since all the database

Re: Foreign keys in Django models without id fields?

2005-08-03 Thread xtian
On 8/2/05, gheorghe <[EMAIL PROTECTED]> wrote: > > Another scenario not uncomon where integer ID are not the best is when > 2 tables from 2 location need to be merged into one table (ex. collect > data from 2 stores and maintain it centraly somewhere). > > There are many cases where people are w

Re: Foreign keys in Django models without id fields?

2005-08-02 Thread gheorghe
Another scenario not uncomon where integer ID are not the best is when 2 tables from 2 location need to be merged into one table (ex. collect data from 2 stores and maintain it centraly somewhere). There are many cases where people are working closely to the database like datawarehosing or if the