Depends on who are the "other visitors" :) And there's more than one
way to do it.

  If you mean something like: it is either public or private, a
BooleanField() on class Photo should do it.

  If you mean something like: The owner chooses the users that will
have access to the photo, you can do a ManyToManyField() on Photo:

class Photo(model.Model):
    owner = models.ForeignKey(User, related_name = 'owner')
    users = models.ManyToManyField(User, verbose_name = 'Give access
to', related_name = 'access_to')

  But if you want more granularity on "access", for example, giving
access for someone to see the Photo, and others to see and edit, and
others to edit and send to email:

permissions = (
    ('see', 'See'),
    ('edit', 'Edit'),
    ('email', 'Email'),
)

# owner is assumed to come from Photo
class PhotoPermission(models.Model):
    photo = models.ForeignKey(Photo)
    access_to = models.ForeignKey(User)
    permission = models.CharField('Type of permission', maxlength = 5,
choices = permissions)

  And there's always Django custom permissions, if it fits your needs:

http://www.djangoproject.com/documentation/authentication/#custom-permissions

On 7/22/06, PythonistL <[EMAIL PROTECTED]> wrote:
>
> I am creating an application in Django where users can insert photos
> and I would like each owner of the photo(s) to be able to grant/revoke
> access to this photo(s) to other visitors.
> What could be the best idea how to do that?
> Thank you for replies

-- 
Julio Nobrega - http://www.inerciasensorial.com.br

--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to