Esame:
name = models.Foreignkey(User)
...

Then queryset=Esame.name.get_rows_with_permission(Ecg(),'add')

On 1月4日, 下午8时02分, MarcoS <marc.se...@gmail.com> wrote:
> Hi people, probably I'm making a mountain out of a molehill but I
> can't figure
> how to solve this problem;
>
> I've a form with a ModelMultipleChoiceField. The queryset will
> contains all models for
> which the user has a particular permission
> (django.contrib.auth.models.Permission) (can_add).
>
> This is the models.py
>
> class Esame(models.Model):
>     name = models.CharField(max_length=80)
>     name_model_referenced = models.CharField(max_length=80)
>
> class Ecg(models.Model):
>     esame = models.ForeignKey(Esame)
>     patient = models.ForeignKey(Patient, null=True)
>
> class Ecg_da_sforzo(models.Model):
>     esame = models.ForeignKey(Esame)
>     patient = models.ForeignKey(Patient, null=True)
>
> Supposing we have a user Tom which can add an Ecg but not an
> Ecg_da_sforzo,
> can I use the Django Queryset API to obtaing the correct queryset?
> If yes, how can I construct it?

-- 
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...@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