forked from 0x2620/pandora
editable
This commit is contained in:
parent
6aaa88d3bc
commit
7b0773ab6d
1 changed files with 2 additions and 1 deletions
|
@ -49,7 +49,7 @@ class Place(models.Model):
|
||||||
return self.name
|
return self.name
|
||||||
|
|
||||||
def editable(self, user):
|
def editable(self, user):
|
||||||
if user.is_staff or self.user == user:
|
if user and user.is_staff or self.user == user:
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@ -60,6 +60,7 @@ class Place(models.Model):
|
||||||
j = {
|
j = {
|
||||||
'id': self.get_id(),
|
'id': self.get_id(),
|
||||||
'user': self.user.username,
|
'user': self.user.username,
|
||||||
|
'editable': self.editable(user)
|
||||||
}
|
}
|
||||||
for key in ('created', 'modified',
|
for key in ('created', 'modified',
|
||||||
'name', 'alternativeNames', 'geoname', 'countryCode',
|
'name', 'alternativeNames', 'geoname', 'countryCode',
|
||||||
|
|
Loading…
Reference in a new issue