Re: How to get the class name of a ContentType in django

2013-12-01 Thread Timothy W. Cook
Be sure to post the results back here for the archive so others may find it in searches. On Sun, Dec 1, 2013 at 8:32 AM, Aamu Padi wrote: > Ok, I will try it! Thank you so very much!!! > > > On Sun, Dec 1, 2013 at 3:41 AM, Timothy W. Cook wrote: >> >> On Sat, Nov 30, 2013 at 3:37 PM, Aamu Padi

Re: How to get the class name of a ContentType in django

2013-12-01 Thread Aamu Padi
Ok, I will try it! Thank you so very much!!! On Sun, Dec 1, 2013 at 3:41 AM, Timothy W. Cook wrote: > On Sat, Nov 30, 2013 at 3:37 PM, Aamu Padi wrote: > > Yes!!! Can I use it as a string in template? > > > > > I haven't tested it but it seems you should be able to assign it to a > context var

Re: How to get the class name of a ContentType in django

2013-11-30 Thread Timothy W. Cook
On Sat, Nov 30, 2013 at 3:37 PM, Aamu Padi wrote: > Yes!!! Can I use it as a string in template? > I haven't tested it but it seems you should be able to assign it to a context variable or kwargs in a view and use it in a template. Something like: context['classname'] = type(myinstance) or kwa

Re: How to get the class name of a ContentType in django

2013-11-30 Thread Aamu Padi
Yes!!! Can I use it as a string in template? On Sat, Nov 30, 2013 at 2:45 PM, Timothy W. Cook wrote: > You can use type() on your instance(s) to find out their model class. > > If you have an instance of the model: > > stream = StreamItem.objects.create(user,ct,oid,pdate) > > Then type(stream)

Re: How to get the class name of a ContentType in django

2013-11-30 Thread Timothy W. Cook
You can use type() on your instance(s) to find out their model class. If you have an instance of the model: stream = StreamItem.objects.create(user,ct,oid,pdate) Then type(stream) should return Is that what you wanted? On Sat, Nov 30, 2013 at 1:14 AM, Simon Charette wrote: > Do you want

Re: How to get the class name of a ContentType in django

2013-11-30 Thread Aamu Padi
Yes. Could you kindly please show me how? On Sat, Nov 30, 2013 at 8:44 AM, Simon Charette wrote: > Do you want to retrieve the class name of the model class associated with > a content type? > > Le jeudi 28 novembre 2013 12:04:34 UTC-5, Aamu Padi a écrit : > >> How do I get the class name in str

Re: How to get the class name of a ContentType in django

2013-11-29 Thread Simon Charette
Do you want to retrieve the class name of the model class associated with a content type? Le jeudi 28 novembre 2013 12:04:34 UTC-5, Aamu Padi a écrit : > > How do I get the class name in string of a ContentType? I tried it this > way, but it didn't worked out: > > class StreamItem(models.Model):

How to get the class name of a ContentType in django

2013-11-28 Thread Aamu Padi
How do I get the class name in string of a ContentType? I tried it this way, but it didn't worked out: class StreamItem(models.Model): user = models.ForeignKey(User) content_type = models.ForeignKey(ContentType) object_id = models.PositiveIntegerField() pub_date = models.DateTimeFi