displaying tree data in admin

2009-10-14 Thread ev
I've created model Structure referenced to itself and filled it with my data. class Structure(models.Model): parent=models.ForeignKey('self', blank=True, null=True, related_name='child_set') title=models.CharField(max_length=100) Default admin interface shows my data as a plain l

Re: displaying tree data in admin

2009-10-15 Thread ev
May be there were developers solutions? Where should I look for? On Oct 15, 9:18 am, Михаил Лукин wrote: > There is no sucj feature in admin interface > > On Wed, Oct 14, 2009 at 9:18 PM, ev wrote: > > > I've created model Structure referenced to itself and fil

Re: displaying tree data in admin

2009-10-15 Thread ev
Thank you, Daniel, I'm trying to use this: http://magicrebirth.wordpress.com/2009/08/18/django-admin-and-mptt-2/ On Oct 15, 12:09 pm, Daniel Roseman wrote: > On Oct 15, 8:16 am, ev wrote: > > > May be there were developers solutions? Where should I look for? > > Look at

Is it possible to change order of elements in model?

2009-12-30 Thread ev
Example: I have a playlist and I want to have a possibility to change songs order (manually, not by name or raiting). This task could be done by adding to the model an integer field (to remember the order): ordering=models.IntField() I'd like to know, if there is any feature to realize such a fun

how to put html in __unicode__() ?

2010-01-01 Thread ev
I tryed to do: class Structure(models.Model): def __unicode__(self): deep = Structure.getDeep(self) return deep * " " + self.title def getDeep(self): ... The result was: Level 1  Level 2   Level 3 etc So, how to put h

Re: how to put html in __unicode__() ?

2010-01-01 Thread ev
t; Xia Kai(夏恺) > xia...@gmail.comhttp://blog.xiaket.org > > -- > From: "ev" > Sent: Saturday, January 02, 2010 12:35 AM > To: "Django users" > Subject: how to put html in __unicode__() ? > > > > > I tryed to do: > > >

Re: how to put html in __unicode__() ?

2010-01-01 Thread ev
rmed. > > Xia Kai(夏恺) > xia...@gmail.comhttp://blog.xiaket.org > > -- > From: "ev" > Sent: Saturday, January 02, 2010 12:35 AM > To: "Django users" > Subject: how to put html in __unicod

set model field some value before add

2010-05-26 Thread ev
class Structure(models.Model): parent = models.ForeignKey('site.Structure',blank=True,null=True,default=0) title = models.CharField(max_length=128,verbose_name=u'Заголовок') url = models.CharField(max_length=48,verbose_name=u'URL') ordering = models.IntegerField(blan

Re: set model field some value before add

2010-05-26 Thread ev
se,default=1) > >     def save(self, *args, **kwargs): >         if not self.id: >             # If the primary key is not defined, this is a new insertion >             self.ordering = 42 # set magic values >             self.level = 99 >         super(Structure, self).save(*ar

delete file or image after deleting model item

2010-05-28 Thread ev
There are ImageField and FileField in a model. When model item removed, image and file stay. Is it normal behavior? Is there a way to remove image and file automatically? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group,

Re: delete file or image after deleting model item

2010-06-01 Thread ev
Thank you, Shawn. I just wander, why auto-deleting files was not included in django as well? Just your opinion? On May 30, 6:32 am, Shawn Milochik wrote: > You can override thedeletefunction of your model to take care of this. > > Alternatively, if you want to do this for a bunch of different mo

get item value in Field.__init__()

2010-06-19 Thread ev
I have a form to edit my model. There is a select box in this form. By default there are all the data in this select box. My goal is exclude some data from select box, depending on current item data. So, to achieve my goal, I need to know field value of the current model item in the __init__ method