Assume i have a model as follows:

class Website(models.Model):
    user = models.ForeignKey(User)
    name = models.CharField(unique=True, max_length=32)
    url = models.URLField(unique=True)

Now i have a generic (detail) view as follows:

class WebsiteRead(DetailView):
    model = Website

    @method_decorator(login_required())
    def dispatch(self, *args, **kwargs):
        return super(WebsiteRead, self).dispatch(*args, **kwargs)

I want users to only be able to view an object when they have created
it; [self.request.user == Website.user].

What is the best approach to create this?
- I could overload get_object to query for the object based on the pk
and the fk of the user.
- Or should i use a package (from http://www.djangopackages.com/grids/g/perms/)
such as django-guardian?

Paul

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