Possible bug in prefetch_related used with Reverse generic relations

2015-02-02 Thread Todor Velichkov
Hi, guys. About a week ago i asked the same question on stackoverflow. Since i got no response there i started to read how to report a bug

How to use natural keys when dumping/loading fixture data for models that use generic relations?

2014-10-02 Thread Stodge
> > "permissions": [], > > "public": false, > > "users": [] > > } > > } > > > I can't use this fixture as it's referencing an object ID. How do I use natural keys when dumping/loading fixtur

Querying across Generic Relations

2013-10-28 Thread Lee Hinde
I have a table, Credit, that I want to query based on a value several hops away. There's a CreditLineItems that has a Generic Foreign Key to one of two tables, each of which has a Foreign Key to the table I want to search. I've not as yet setup a reverse relation in the related tables. My question

Re: Required True to Generic Relations

2012-05-15 Thread Guevara
Solution: http://pastebin.com/011WsfzD Regards. On 15 maio, 23:43, Guevara wrote: > Hi all! > > I need a required true in Generic Relations. > Have this code: > > # Models > class Client(Person): >     addresses = GenericRelation(Address) > > class Address(model

Required True to Generic Relations

2012-05-15 Thread Guevara
Hi all! I need a required true in Generic Relations. Have this code: # Models class Client(Person): addresses = GenericRelation(Address) class Address(models.Model): # others fields content_type = models.ForeignKey(ContentType) object_id = models.PositiveIntegerField

Excel Import Generic Relations

2011-10-23 Thread stephenstubbs
using a get or create and so will create the foreign key if not found but only with the one field. We would like to do something similar for generic relations and manytomany fields before moving on to be able to import multiple tables at once. I'm thinking of possibly matching the object on a

Re: Getting started with generic relations

2010-12-06 Thread mack the finger
fields will be handled by the generic relation API. On Dec 6, 4:34 am, bruno desthuilliers wrote: > On 5 déc, 20:30, mack the finger wrote: > > > I can't quite wrap my brain around how to do generic relations. I have > > a `Receipt` model which is a receipt of a purchase.

Re: Getting started with generic relations

2010-12-06 Thread bruno desthuilliers
On 5 déc, 20:30, mack the finger wrote: > I can't quite wrap my brain around how to do generic relations. I have > a `Receipt` model which is a receipt of a purchase. One of the fields > is `item` which is a foreign key to a product model. I want to be able > to not only have pr

Getting started with generic relations

2010-12-05 Thread mack the finger
I can't quite wrap my brain around how to do generic relations. I have a `Receipt` model which is a receipt of a purchase. One of the fields is `item` which is a foreign key to a product model. I want to be able to not only have products, but other things that the user can buy. What do I ne

Re: Generic relations

2010-11-18 Thread Jonas Geiregat
That was it! After running: ./manage.py sqlclear foo | ./manage.py dbshell && ./manage.py syncdb it works! So something in my db was inconsistent! Thanks! Op 18-nov-2010, om 09:57 heeft Marc Aymerich het volgende geschreven: > On Thu, Nov 18, 2010 at 12:00 AM, Jonas Geiregat wrote: >> >> Op

Re: Generic relations

2010-11-18 Thread Marc Aymerich
On Thu, Nov 18, 2010 at 12:00 AM, Jonas Geiregat wrote: > > Op 17-nov-2010, om 23:46 heeft Marc Aymerich het volgende geschreven: > > GenericPost.objects.get(pk=1).content_object.content > > > That's the strange thing. It just doesn't work: > > Some code: > > > In [3]: GenericPost.objects.get(

Re: Generic relations

2010-11-17 Thread Jonas Geiregat
Op 17-nov-2010, om 23:46 heeft Marc Aymerich het volgende geschreven: GenericPost.objects.get(pk=1).content_object.content That's the strange thing. It just doesn't work: Some code: In [3]: GenericPost.objects.get(pk=1).content_object In [4]: GenericPost.objects.get(pk=1).content_objec

Re: Generic relations

2010-11-17 Thread Marc Aymerich
On Wed, Nov 17, 2010 at 11:46 PM, Marc Aymerich wrote: > On Wed, Nov 17, 2010 at 11:36 PM, Jonas Geiregat wrote: >> Hello, >> >>  Can I use django's generic relations to create a model (GenericPost) that >> can point to other model (APost) or model (Rev

Re: Generic relations

2010-11-17 Thread Marc Aymerich
On Wed, Nov 17, 2010 at 11:36 PM, Jonas Geiregat wrote: > Hello, > >  Can I use django's generic relations to create a model (GenericPost) that > can point to other model (APost) or model (ReviewPost) ? >  And then use this GenericPost model to get a list of al

Generic relations

2010-11-17 Thread Jonas Geiregat
Hello, Can I use django's generic relations to create a model (GenericPost) that can point to other model (APost) or model (ReviewPost) ? And then use this GenericPost model to get a list of all latest APost's and ReviewPost's ? I've been trying this all day long but I

Re: Generic Relations: questions

2010-08-19 Thread tsmets
clean up stored procs to have the non-meaningfull data being purged. I don't understand what you mean with proble 3 ! \T, On Aug 19, 6:15 am, v0idnull wrote: > I asked a while back about having generic relations and someone pointed > me tohttp://docs.djangoproject.com/en/1.2/

Generic Relations: questions

2010-08-18 Thread v0idnull
I asked a while back about having generic relations and someone pointed me to http://docs.djangoproject.com/en/1.2/ref/contrib/contenttypes/#generic-relations This wasn't what I was looking for. What I was looking for is this model I made: class Relationship(models.Model):

generic relations with admin

2010-03-04 Thread Simon Davies
Hi I have a shopping cart application, where by each cart can hold several kinds of objects, I have therefore used generic relations to model the application along the lines of below, whereby each cart can have many cartitems which are linked by a standard foreign key relationship, the cartitems

Re: ordering by fields in related models with Generic Relations

2010-02-17 Thread amenasse
sorry the last model was incorrectly pasted by me. class Tag(models.Model): # Content-object field content_type = models.ForeignKey(ContentType, verbose_name='content type', related_name="content_type_set_for_%(class)s") object_id = models.TextField('object ID') content_object = generic.Generi

ordering by fields in related models with Generic Relations

2010-02-17 Thread sysantmin
Hello, I have a Tag model which has a Generic Foreign Key . I want to order a query on the Tag model by fields in related models (related via the Generic Foreign Key), for Example: >>> [ o.content_object for o in >>> Tag.objects.order_by('content_type__id','foo__name','bar__name') ] Gives

Re: Generic Relations and Django Admin?

2010-01-20 Thread Victor Hooi
27;t filled. > > > How do people normally do this sort of thing, with a polymorphic > > object that's referenced by multiple other objects? > > Edit the address inline with the parent object (hospital, etc) by > using the generic.GenericInlineAdmin class - works exactly th

Re: Generic Relations and Django Admin?

2010-01-20 Thread Victor Hooi
heya, The thing is, it's a one-to-many for UserProfile/Hospital/Institution to Addresses - that is, each entity can (and probably will) have multiple addresses. That's why the FK field is on Address. Also, I thought that was the way it was traditionally modelled in database design? (I admit I'm o

Re: Generic Relations and Django Admin?

2010-01-19 Thread LostCruz
Hi Victor, You are trying to do this the wrong way around. It shouldn't be the Adress class on which you want to define a relationship, but on the other classes. An address is an address whether it's the address of a User or the address of an Institution. class Address(models.Model): # the fi

Re: Generic Relations and Django Admin?

2010-01-19 Thread Daniel Roseman
tc) by using the generic.GenericInlineAdmin class - works exactly the same as a normal inline admin class, but using generic relations. -- DR. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us

Re: Generic Relations and Django Admin?

2010-01-19 Thread Raffaele Salmaso
Victor Hooi wrote: > I tried that, and the fields aren't there, but when I try to save the > object, I get a: > > IntegrityError at /admin/people/address/add/ > people_address.content_type_id may not be NULL > > so obvoiusly Django doesn't like it if those fields aren't filled. it's a bug

Re: Generic Relations and Django Admin?

2010-01-19 Thread Victor Hooi
heya, Thanks for the reply =). I tried that, and the fields aren't there, but when I try to save the object, I get a: IntegrityError at /admin/people/address/add/ people_address.content_type_id may not be NULL so obvoiusly Django doesn't like it if those fields aren't filled. How do pe

Re: Generic Relations and Django Admin?

2010-01-19 Thread Victor Hooi
heya, The thing is, the foreign key field is on the Address object, linking to another object that *has* an address. AFAIK, that's how it's meant to be in database design. That's why I need to put something there - e.g. class Address(models.Model): ... user = models.ForeignKey(UserProfi

Re: Generic Relations and Django Admin?

2010-01-18 Thread greatlemer
On Jan 19, 5:25 am, Victor Hooi wrote: > heya, > > I'm trying to use an "Address" model as a generic relation against > multiple other models (e.g. in a "User Profile", for each User, as > well as for "Building", "Institution", and various other ones). > > So I've added the content_type, object_id

Re: Generic Relations and Django Admin?

2010-01-18 Thread Raffaele Salmaso
Victor Hooi wrote: > class AddressAdmin(VersionAdmin): > pass > class AddressInline(generic.GenericTabularInline): > model = Address > ... fields = (the fields you want to display) or exclude = ('content_type', 'object_id',) > class HospitalAdmin(admin.ModelAdmin): > inline

Generic Relations and Django Admin?

2010-01-18 Thread Victor Hooi
heya, I'm trying to use an "Address" model as a generic relation against multiple other models (e.g. in a "User Profile", for each User, as well as for "Building", "Institution", and various other ones). So I've added the content_type, object_id and content_object fields to Address. class Addres

Re: null = True and blank = True in contenttypes generic relations: why not ?

2010-01-18 Thread Karen Tracey
On Mon, Jan 18, 2010 at 3:58 AM, Alessandro Pasotti wrote: > Hello, > > I would like to have a table with optional pointers to other tables > items, generic relations would do it fine, the only problem seems to > be the fact that generic forreign keys don't accept null val

null = True and blank = True in contenttypes generic relations: why not ?

2010-01-18 Thread Alessandro Pasotti
Hello, I would like to have a table with optional pointers to other tables items, generic relations would do it fine, the only problem seems to be the fact that generic forreign keys don't accept null values. Any hint or idea about why NOT NULL is enforced in this kind of rela

Re: Questions about ContentType generic relations

2009-11-16 Thread Daniel Roseman
On Nov 16, 8:12 am, Continuation wrote: > > As the docs show, when you've defined a GenericRelation, querying is > > exactly the same as with a reverse foreign key. So: > > Bookmark.objects.get(tags__tag='django') > > A somewhat related question: > > What if instead of having a ForeignKey to Conte

Re: Questions about ContentType generic relations

2009-11-16 Thread Continuation
> As the docs show, when you've defined a GenericRelation, querying is > exactly the same as with a reverse foreign key. So: > Bookmark.objects.get(tags__tag='django') > A somewhat related question: What if instead of having a ForeignKey to ContentType, TaggedItem has a direct ForeignKey to Book

Re: Questions about ContentType generic relations

2009-11-15 Thread Dennis Kaarsemaker
On zo, 2009-11-15 at 00:13 -0800, Continuation wrote: > I checked out the doc (http://docs.djangoproject.com/en/dev/topics/db/ > queries/) and can't find reference to it. Can you explain its usage a > bit more or point me to the relevant section of the doc? http://docs.djangoproject.com/en/dev/to

Re: Questions about ContentType generic relations

2009-11-15 Thread Daniel Roseman
On Nov 15, 8:13 am, Continuation wrote: > > As the docs show, when you've defined a GenericRelation, querying is > > exactly the same as with a reverse foreign key. So: > > Bookmark.objects.get(tags__tag='django') > > I don't quite understand your use of tags__tag='django' in retrieving > the obje

Re: Questions about ContentType generic relations

2009-11-15 Thread Continuation
> > As the docs show, when you've defined a GenericRelation, querying is > exactly the same as with a reverse foreign key. So: > Bookmark.objects.get(tags__tag='django') > I don't quite understand your use of tags__tag='django' in retrieving the objects. I've never seen this usage before. I che

Re: Questions about ContentType generic relations

2009-11-14 Thread esatterwh...@wi.rr.com
> class Bookmark(models.Model): >     url = models.URLField() >     tags = generic.GenericRelation(TaggedItem) > > So say I attached a bunch of tags to a bunch of bookmarks. > > How do I get a list of all bookmarks that have the tag "django"? > > Also what kind o

Re: Questions about ContentType generic relations

2009-11-14 Thread Daniel Roseman
generic.GenericRelation(TaggedItem) > > So say I attached a bunch of tags to a bunch of bookmarks. > > How do I get a list of all bookmarks that have the tag "django"? > > Also what kind of SQL statements are generated behind the scene to > enable this querying over g

Questions about ContentType generic relations

2009-11-13 Thread Continuation
f all bookmarks that have the tag "django"? Also what kind of SQL statements are generated behind the scene to enable this querying over generic relations? Say I have many different classes (e.g. Bookmark, ForumPost, WikiEntry, QnA, Message, Photo, etc) that I want to attach tags to. If I

Using generic relations as an inline - not working

2009-11-11 Thread neridaj
I'm trying to add some model fields to another model for admin editing and can't seem to get it to work i.e., model doesn't show up in admin, inline or otherwise. project/app/admin.py from project.app.models import SearchKeyword from django.contrib.flatpages.models import FlatPage from django.co

Re: Newbie question on ContentTypes and Generic Relations

2009-06-14 Thread Rana
TextField() > > > I would like to modify this so that I can have the related products > > from articles also available in my Blog class and the related products > > table should be the same between Article class and Blog class, i.e. I > > do not want to have two instan

Re: Newbie question on ContentTypes and Generic Relations

2009-06-13 Thread Daniel Roseman
can have the related products > from articles also available in my Blog class and the related products > table should be the same between Article class and Blog class, i.e. I > do not want to have two instances of the RelatedProduct class. > > Thank you for any help you can offer. >

Newbie question on ContentTypes and Generic Relations

2009-06-12 Thread Rana
Hi, I am trying to modify a blog and article model that will both display data from a related products model. I read that the way I should do this is through the ContentTypes framework and generic foreign relations. I would be grateful for some guidance on how to do this. I've read the documentat

Re: Generic relations and unit tests.

2009-04-16 Thread Stavros
Is there some way I can empty the contenttypes table before the fixtures are loaded and have django load them normally? That would take care of this problem, as it would mean that the proper contenttypes would get loaded from the fixture. Unfortunately, I have not been able to find a way to run co

Re: Generic relations swamp

2009-04-14 Thread zayatzz
Ok your idea worked just fine, but i keep coming up with new questions :) The result of it was that when i opened poll i got poll with name So i wrote something (i dont know how its called - model instance? model manager?) to retrieve the actual value of translation and my poll model looks like

Re: Generic relations swamp

2009-04-14 Thread zayatzz
On Apr 14, 3:45 pm, matehat wrote: > Sorry about the last post (was a little tired from a sleepless night > of solving problems in physics ...). I think you can solve the issue > by putting "return unicode(self.name)" instead of "return self.name" > in all of the __unicode__ method of your mode

Re: Generic relations swamp

2009-04-14 Thread matehat
Sorry about the last post (was a little tired from a sleepless night of solving problems in physics ...). I think you can solve the issue by putting "return unicode(self.name)" instead of "return self.name" in all of the __unicode__ method of your models. The things is that you must make sure to r

Re: Generic relations swamp

2009-04-12 Thread zayatzz
Admin for language: from kyss.front.models import lang from django.contrib import admin class FrontAdmin(admin.ModelAdmin): fieldsets = [ ('General info', {'fields': ['name', 'short', 'locale', 'encoding', 'url', 'fdef', 'bdef']}), ('SEO stuff', {'fields':

Re: Generic relations swamp

2009-04-12 Thread matehat
Hi, can you show us the code for each of your admin classes? This probably has something to do with some method overrides, but I can't say much about the cause of your problem from the error message you gave... Cheers Mathieu --~--~-~--~~~---~--~~ You received th

Re: Generic relations swamp

2009-04-11 Thread zayatzz
ll-trans-content_type-object_id-0-name > u'Pollname in estonian' > poll-trans-content_type-object_id-INITIAL_FORMS > u'0' > > If i understand this correctly then the content object id is not > beeing saved - it does not save the id of the poll wit

Re: Generic relations and unit tests.

2009-04-11 Thread Stavros
I agree with you on this, but it is often impractical due to the volume of the data required. I have this data already in my database, I shouldn't have to spend a few days moving it to the tests file... Fixtures are a quick way to import your data to the test DB without having to recreate everythi

Re: Generic relations and unit tests.

2009-04-10 Thread Malcolm Tredinnick
On Sat, 2009-04-11 at 08:47 +0800, Russell Keith-Magee wrote: > On Sat, Apr 11, 2009 at 5:53 AM, Poromenos wrote: > > > > Hello, > > I created a model that has a ForeignKey to ContentType, but now I > > can't use my test fixtures, since the IDs they point to are random > > every time the test dat

Re: Generic relations and unit tests.

2009-04-10 Thread Russell Keith-Magee
On Sat, Apr 11, 2009 at 5:53 AM, Poromenos wrote: > > Hello, > I created a model that has a ForeignKey to ContentType, but now I > can't use my test fixtures, since the IDs they point to are random > every time the test database is created. I can't dump the contenttypes > data because then I get

Generic relations and unit tests.

2009-04-10 Thread Poromenos
Hello, I created a model that has a ForeignKey to ContentType, but now I can't use my test fixtures, since the IDs they point to are random every time the test database is created. I can't dump the contenttypes data because then I get many duplicate inserts, since Django rebuilds them every time i

Re: Generic relations swamp

2009-04-10 Thread zayatzz
27;on' poll-trans-content_type-object_id-0-name u'Pollname in estonian' poll-trans-content_type-object_id-INITIAL_FORMS u'0' If i understand this correctly then the content object id is not beeing saved - it does not save the id of the poll with the translations. Is this cor

Re: Generic relations swamp

2009-04-10 Thread zayatzz
n and poll name > failed or something else at all? > > Alan. > > On Apr 9, 6:36 pm, matehat wrote: > > > First of all, the ModelAdmin needs to know about how to handle the > > generic relations and whether you even need them to appear. You need > > to subclass &q

Re: Generic relations swamp

2009-04-09 Thread zayatzz
python.org/pipermail/python-list/2006-July/566947.html Does that mean, that connection between translation and poll name failed or something else at all? Alan. On Apr 9, 6:36 pm, matehat wrote: > First of all, the ModelAdmin needs to know about how to handle the > generic relations and wheth

Re: Generic relations swamp

2009-04-09 Thread matehat
First of all, the ModelAdmin needs to know about how to handle the generic relations and whether you even need them to appear. You need to subclass "generic.GenericTabularInline" (in the same way you subclassed "admin.ModelAdmin") and specify fields you want to be able t

Generic relations swamp

2009-04-09 Thread zayatzz
lines below it are for generic relations as good as i understand them object_id = models.PositiveIntegerField() content_object = generic.GenericForeignKey() name= models.CharField(max_length=500) # for the translation itself def __unicode__(self): return

[Django Admin + Generic Relations] ManyToMany Model Inline?

2009-03-30 Thread Liquidrums
In the documentation for Generic Relations, a Vegetable and Animal can be Tagged via a GenericInline for each model. I want to be able to choose a tag and subsequently add/remove which models have that tag via a ManyToMany-style inline. Is this already available, or do I have to roll my own? I

Re: Values from Reverse Generic Relations on multiple objects

2009-03-10 Thread Daniel Roseman
On Mar 10, 7:50 pm, Adam Nelson wrote: > http://docs.djangoproject.com/en/dev/ref/contrib/contenttypes/#revers... > > I'm working with Reverse Generic Relations and I was wondering if > there is a way to get the related objects for multiple objects in a > simple way.  For in

Values from Reverse Generic Relations on multiple objects

2009-03-10 Thread Adam Nelson
http://docs.djangoproject.com/en/dev/ref/contrib/contenttypes/#reverse-generic-relations I'm working with Reverse Generic Relations and I was wondering if there is a way to get the related objects for multiple objects in a simple way. For instance, based on the bookmark example of that

'extra' modifier and generic relations

2008-12-05 Thread Julien Phalip
database. Can the extra modifier be reliably used with generic relations, or is there a workaround? Thanks a lot for your advice. Julien --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group

Re: ContentTypes Framework and generic relations : no index on object_id ?

2008-09-07 Thread bruno desthuilliers
body, > > > > Today I was hunting down some serious performance problems in my app > > > and I found something pretty "confusing". I realized that, when > > > creating generic relations with the ContentTypes framework (http:// > > > docs.djangoproject.

Re: ContentTypes Framework and generic relations : no index on object_id ?

2008-09-06 Thread Sylvain
> > and I found something pretty "confusing". I realized that, when > > creating generic relations with the ContentTypes framework (http:// > > docs.djangoproject.com/en/dev/ref/contrib/contenttypes/#id1) Django > > does create a foreign key relationship on the content_

Re: ContentTypes Framework and generic relations : no index on object_id ?

2008-09-05 Thread bruno desthuilliers
On 5 sep, 23:52, Sylvain <[EMAIL PROTECTED]> wrote: > Hi everybody, > > Today I was hunting down some serious performance problems in my app > and I found something pretty "confusing". I realized that, when > creating generic relations with t

ContentTypes Framework and generic relations : no index on object_id ?

2008-09-05 Thread Sylvain
Hi everybody, Today I was hunting down some serious performance problems in my app and I found something pretty "confusing". I realized that, when creating generic relations with the ContentTypes framework (http:// docs.djangoproject.com/en/dev/ref/contrib/contenttypes/#id1) Django doe

Re: prepopulated_fields with generic relations

2008-08-26 Thread Donovan
Oops, correct here: class Content(models.Model): seo_urls = generic.GenericRelation(SeoUrl) def get_absolute_url(self): return ('/%s/' % self.seo_urls.order_by('priority')[0].seotitle) On 25 Aug, 23:04, Donovan <[EMAIL PROTECTED]> wrote: > Hi, > > I am trying to g

prepopulated_fields with generic relations

2008-08-25 Thread Donovan
Hi, I am trying to get this model and admin declaration working: #models.py class SeoUrl(models.Model): seotitle = models.SlugField(max_length = 100) priority = models.PositiveIntegerField(blank=False, null=False) content_type = models.ForeignKey(ContentType) ob

Re: generic relations

2008-06-06 Thread M.Ganesh
Filippo Santovito wrote: > Hi all, > I've read http://www.djangoproject.com/documentation/models/generic_relations/ > . > How can I share a tag between Animal and Vegetables? > > have a look at http://code.google.com/p/django-tagging/ Ganesh --~--~-~--~~~---~--~--

generic relations

2008-06-04 Thread Filippo Santovito
Hi all, I've read http://www.djangoproject.com/documentation/models/generic_relations/ . How can I share a tag between Animal and Vegetables? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To p

Generic relations - reasonable usage?

2007-10-22 Thread David Reynolds
Hi, I have the requirement to have an active/inactive function for all contenttypes in a site I'm working on. Is this a valid usage for a Generic Relationship? If so, any tips as to how I'd go about implementing this? Thanks, David -- David Reynolds [EMAIL PROTECTED] --~--~-~-

Re: Stuck on generic relations

2007-10-11 Thread Doug B
Anwering my own question... it helps to specify an actual join condition. This worked: extra['last_event_when'] = "SELECT event_loggedevent.when FROM event_loggedevent,event_eventrelation WHERE (event_eventrelation.event_id = event_loggedevent.id) AND (event_eventrelation.content_type_id = %s) AN

Stuck on generic relations

2007-10-11 Thread Doug B
I have a page that needs to display basic user information plus the last logged activity date for the user, and I need to be able to sort by that value. (there are two of these relations,I'm just mentioning one here) My SQL-fu is very, very weak and I just can't seem to get it. There is a table

Re: cascading delete and generic relations

2007-08-07 Thread Jonathan Wood
On Aug 1, 12:30 pm, Jonathan Wood <[EMAIL PROTECTED]> wrote: > > Do I need to somehow clean up the "test_group_perms" table when Ideletea > subject? Or am I coding my modules incorrectly? Followup: After a bit more digging, it looks like Django is not emulating cascading deletes properly her

cascading delete and generic relations

2007-08-01 Thread Jonathan Wood
I think I am confused about how to use generic relations properly - when I delete something, cascading delete is not happening as expected. Here are my models: class Permission(models.Model): name = models.CharField(maxlength=32) content_type = models.ForeignKey(ContentType, null=True

Re: Generic Relations + Admin Interface

2007-07-03 Thread Russell Keith-Magee
an Article. I need to be able to do this via the Admin > interface in a user friendly way so that the people who write the > articles can do it easily. > > The way I had this working in Rails was with a fancy controller method > and some Ajax. As you have noticed, there is limited s

Re: Generic Relations + Admin Interface

2007-07-03 Thread Wiley
I posted about the exact same issue a couple days ago and someone suggested using the js attribute of the admin class. Unfortunately as a novice programmer this is going to take me a while to navigate so I've moved on to other areas of my application before I get down into it. I'm watching this

Generic Relations + Admin Interface

2007-07-03 Thread David
I was really excited about Rails. But however much it claims that it follows the DRY convention, I unfortunately do find myself repeating myself for things like the admin area of my site. That's why the Admin interface of Django has now become ever so much more appealing to me. Having spent a who

Re: One-to-one relationship (model inheritance) or generic relations?

2007-06-29 Thread Jamie Pittock
Russ, Really useful response, thanks. I had thought about your third option but as I figured there'd be a lot of empty fields I didn't give it much consideration. I might actually go down that route until I have a better understanding of generic relations. Thanks again. j. On Jun 2

Re: One-to-one relationship (model inheritance) or generic relations?

2007-06-28 Thread Russell Keith-Magee
etc. If you have very few common attributes anyway, generic relations are probably worth investigation. However, as always, YMMV. My only reservation in recommending generic relations is that they aren't fully integrated with admin yet (though there is a patch floating around to integrate them with n

One-to-one relationship (model inheritance) or generic relations?

2007-06-28 Thread Jamie Pittock
ionship (until model inheritance is reintroduced), so that each venue had a unique primary key that could be related to the rating. However, apps such as comment and tagging get away with it. Is this through Generic Relations? I don't want to code myself into a corner, so when I start lo

Re: relation-spanning lookups with generic relations?

2007-06-17 Thread [EMAIL PROTECTED]
lskdfjladf='dog') and you'll see that it tells you that books (among other generic relations made by TaggedItem) is one of the fields it suggests to span across. Going to post a separate question about this after I try to see if this topic has been discussed in these groups, but I&#

Re: deleting rows with generic relations

2007-06-14 Thread Brian Luft
I'm interested in this problem as well since I'll be using generic relations for an app I'm working on. I haven't done any analysis yet so I'm just writing to bump this back up in hopes that the smart people will chime in. Here are some very naive solutions: 1) Write a

deleting rows with generic relations

2007-06-13 Thread Bram - Smartelectronix
hello everyone, Say I have Model1 Model2 Model3 And generic relations pointing to these... Like, say, Comments or Tags When deleting Model1, 2, 3 I obviously need to delete all the generic ones! Is there any smarter way to go about this except for overriding delete( ) and doing it by hand

Query-light retrieval of generic relations

2007-06-04 Thread Jonathan Buchanan
Hi all, I'm trying to write a utility method to retrieve generically related content (the particular model I'm using has the standard ContentType FK, object id and GenericFK) without ending up with one database hit per object: http://dpaste.com/11633/ from django.cont

Re: relation-spanning lookups with generic relations?

2007-05-28 Thread Jonathan Buchanan
On 5/28/07, Bram - Smartelectronix <[EMAIL PROTECTED]> wrote: > > Hi there, > > > > Say I have: > > class TaggedItem(models.Model): > """A tag on an item.""" > tag = models.SlugField() > content_type = models.ForeignKey(ContentType) > object_id = models.PositiveIntegerField() >

relation-spanning lookups with generic relations?

2007-05-28 Thread Bram - Smartelectronix
Hi there, Say I have: class TaggedItem(models.Model): """A tag on an item.""" tag = models.SlugField() content_type = models.ForeignKey(ContentType) object_id = models.PositiveIntegerField() content_object = models.GenericForeignKey() class Meta: orderi

Re: Generic relations naming

2007-05-21 Thread James Bennett
On 5/21/07, Sebastjan Trepca <[EMAIL PROTECTED]> wrote: > I just started to use generic relations and I was wondering why are the > default field names "object_id" and "content_type" and not "object_id" and > "object_type"? > Seems bet

Generic relations naming

2007-05-21 Thread Sebastjan Trepca
Hi, I just started to use generic relations and I was wondering why are the default field names "object_id" and "content_type" and not "object_id" and "object_type"? Seems better that way and more logical ... or is it? Thanks, Sebastjan --~--~-~-

Re: fixtures for generic relations?

2007-05-19 Thread Malcolm Tredinnick
On Sat, 2007-05-19 at 13:11 +0200, Bram - Smartelectronix wrote: > Russell Keith-Magee wrote: > >> how do I -in fixtures- explain a variable needs to come from another table? > >> I don't want to write "content_type: 15" as elsewhere! > > > > That's the way its done. GenericRelation is a convenie

Re: fixtures for generic relations?

2007-05-19 Thread Bram - Smartelectronix
Russell Keith-Magee wrote: >> how do I -in fixtures- explain a variable needs to come from another table? >> I don't want to write "content_type: 15" as elsewhere! > > That's the way its done. GenericRelation is a convenience wrapper > around the content type and object id database entries; you n

Re: fixtures for generic relations?

2007-05-18 Thread Russell Keith-Magee
On 5/18/07, Bram - Smartelectronix <[EMAIL PROTECTED]> wrote: > > hi everyone, > > > how do I -in fixtures- explain a variable needs to come from another table? > > I don't want to write "content_type: 15" as elsewhere! That's the way its done. GenericRelation is a convenience wrapper around the

fixtures for generic relations?

2007-05-18 Thread Bram - Smartelectronix
hi everyone, how do I -in fixtures- explain a variable needs to come from another table? I don't want to write "content_type: 15" as elsewhere! - bram --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django us

generic relations for auth.User instead of myapp.UserProfile?

2007-01-19 Thread Bram - Smartelectronix
Hello everyone, currently we have a working UserProfile, working with the auth.User. Now, we plenty of things in this profile (tags, favorites, the usual social networking blah ;-)), and we would really like to move them to User as the rest of the models all refer to User! So, there's Arti

Re: Generic relations in admin proposal

2006-12-19 Thread zenx
It's not my code, just took a look at it and found it useful. Thank you for looking at it! zenx --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us

Re: Generic relations in admin proposal

2006-12-18 Thread Jacob Kaplan-Moss
On 12/18/06 6:24 PM, zenx wrote: > After finding a good solution for generic relations in admin: > http://net-x.org/weblog/2006/nov/29/django-generic-relations-made-easier/ > > I think that it should be implemented in the admin app of the django > development version. > &

Generic relations in admin proposal

2006-12-18 Thread zenx
Hi, After finding a good solution for generic relations in admin: http://net-x.org/weblog/2006/nov/29/django-generic-relations-made-easier/ I think that it should be implemented in the admin app of the django development version. What do you think about it? Want django developers to take the

Re: generic relations in the admin interface

2006-07-06 Thread va:patrick.kranzlmueller
7/6/06, va:patrick.kranzlmueller <[EMAIL PROTECTED]> wrote: >> >> just tested generic relations for tagging. >> to my surprise, there´s no possibility to enter tags (for my blog- >> entries) in the admin interface. >> >> however, i do get additional user permissions: "

  1   2   >