samedi 28 novembre 2015

How can I enable the users delete and edit the objects they create in Django?

Now I have a model called lyric. The detail is as below:

class Lyric(models.Model):
    title = models.CharField(max_length = 200)
    body = models.CharField(max_length = 12000)
    pub_date = models.DateTimeField('date published')
    user = models.OneToOneField(User)

I have a form that user can create lyric. Next I want to enable the user can edit and delete the lyrics. Now I have implemented the form of editing and the function of delete. But how can I limit the permission? Thank you in advance!!!




Aucun commentaire:

Enregistrer un commentaire