Re: Annotate an object with the value of a filtered, related object's attribute

2017-05-21 Thread Yo'av Moshe
Note that I haven't tried the above code myself so it might required > adjustments. > > Cheers, > Simon > > [0] > https://docs.djangoproject.com/en/1.11/ref/models/expressions/#subquery-expressions > > Le dimanche 21 mai 2017 10:41:44 UTC-4, Yo'av Moshe a écrit :

Annotate an object with the value of a filtered, related object's attribute

2017-05-21 Thread Yo'av Moshe
Hey Djangoists! I can't get my head around this and I'm not sure if it's even possible. Let's say I have an "Adult" object and a "Child" object. Every Child belongs to an Adult, and has a gender which is either "M" or "F", and also a "dob" field with their date of birth. I want to get a list of

Django removes fields from admin's list

2010-11-10 Thread Yo'av Moshe
Hey, I'm using Django's admin interface to list, edit and add objects to my application. When I start my Django application it all works fine, but after a while the list view goes crazy: first the checkboxes disappear, then the first field and later on the second one. Sometimes it goes even furthe

Re: Making a m2m field required

2010-11-08 Thread Yo'av Moshe
e_key') > > On Nov 8, 9:15 am, "Yo'av Moshe" wrote: > > > > > Hey, > > > I tried this method with no success. > > > Adding .clean to my Article's ModelForm and checking it's > > self.instance.tags.all(), gives me this ValueEr

Re: Making a m2m field required

2010-11-08 Thread Yo'av Moshe
Hey, I tried this method with no success. Adding .clean to my Article's ModelForm and checking it's self.instance.tags.all(), gives me this ValueError: 'Article' instance needs to have a primary key value before a many-to- many relationship can be used. Actually this seems right, since if my Art

Making a m2m field required

2010-11-06 Thread Yo'av Moshe
Hey, I'm getting frustrated with this... Is there any way to make a Many-to-Many field required? So that an object must have *at least one* relation (i.e. Article must have at least one Tag)? I'm showing Tag as an Inline in Article's from in the admin panel, but I can't find how to force the user

checkboxes disappearing in the admin panel?

2010-10-20 Thread Yo'av Moshe
Hey, I'm seeing some very odd behavior in Django's admin panel. I'm using the admin panel to list about 3500 objects of "people". The list view shows about 17 fields. I'm using the checkboxes to perform certain admin actions I wrote. This all works great, usually. Sometimes, when I'm looking at