http://docs.djangoproject.com/en/dev/topics/db/queries/#topics-db-queries

i would use .filter and .order_by

On Jan 4, 8:30 pm, Patrick <pstei...@gmail.com> wrote:
> Ok, I will rephrase that with a concrete example:
> I have those to models:
>
> class Modelo(models.Model):
>     nome = models.CharField(max_length=10)
>     manageable = models.BooleanField()
>
> class Equipamento(models.Model):
>     modelo = models.ForeignKey(Modelo)
>     nome = models.CharField(max_length=20)
>     #manageable = models.BooleanField()
>
> You see, i want to be able to filter the Equipamento objects based on
> the value previously attributed in Modelo, but it seems to be not
> possible, since 'manageable' is not an field in Equipamento. But the
> workaround would be, create that manageable field, but make it auto-
> populated based on the value already defined in the Modelo object, and
> hiding it from the user, at the admin page.
>
> How could I accomplished that?
>
> Any help, tips, or different approach to accomplish are welcome.
>
> Thank you in advance.
>
> On 4 jan, 18:57, Patrick <pstei...@gmail.com> wrote:
>
> > Hello  everybody.
>
> > Let's say i have the models Model1 and Model2. Model1 has a
> > BooleanField called Personalizabe. Model2 has a field named 'model1'
> > that is a ForeignKey to Model1.
>
> > Is there a way, through the admin page, to filter all the Model2
> > objects according to this Personalizable attribute?
>
> > If not, what is the best approach to achieve this kind of stuff?
--~--~---------~--~----~------------~-------~--~----~
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@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to