user.get_profile()->user.profile
This commit is contained in:
parent
3e8f28ff47
commit
1cc795995d
27 changed files with 72 additions and 70 deletions
|
|
@ -84,7 +84,7 @@ class Text(models.Model):
|
|||
return False
|
||||
if self.user == user or \
|
||||
user.is_staff or \
|
||||
user.get_profile().capability('canEditFeaturedTexts') == True:
|
||||
user.profile.capability('canEditFeaturedTexts') == True:
|
||||
return True
|
||||
return False
|
||||
|
||||
|
|
@ -104,7 +104,7 @@ class Text(models.Model):
|
|||
pos.section = 'personal'
|
||||
pos.save()
|
||||
elif value == 'featured':
|
||||
if user.get_profile().capability('canEditFeaturedTexts'):
|
||||
if user.profile.capability('canEditFeaturedTexts'):
|
||||
pos, created = Position.objects.get_or_create(text=self, user=user,
|
||||
section='featured')
|
||||
if created:
|
||||
|
|
@ -305,7 +305,7 @@ class Position(models.Model):
|
|||
|
||||
text = models.ForeignKey(Text, related_name='position')
|
||||
user = models.ForeignKey(User, related_name='text_position')
|
||||
section = models.CharField(max_length='255')
|
||||
section = models.CharField(max_length=255)
|
||||
position = models.IntegerField(default=0)
|
||||
|
||||
def __unicode__(self):
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ def getText(request, data):
|
|||
'name': '',
|
||||
'text': '',
|
||||
'type': 'html',
|
||||
'editable': not request.user.is_anonymous() and request.user.get_profile().capability('canEditFeaturedTexts')
|
||||
'editable': not request.user.is_anonymous() and request.user.profile.capability('canEditFeaturedTexts')
|
||||
}
|
||||
else:
|
||||
text = qs[0]
|
||||
|
|
@ -140,7 +140,7 @@ def editText(request, data):
|
|||
else:
|
||||
qs = models.Text.objects.filter(name='')
|
||||
if qs.count() == 0:
|
||||
if request.user.get_profile().capability('canEditFeaturedTexts'):
|
||||
if request.user.profile.capability('canEditFeaturedTexts'):
|
||||
text = models.Text(name='', user=request.user)
|
||||
text.save()
|
||||
else:
|
||||
|
|
@ -331,7 +331,7 @@ def sortTexts(request, data):
|
|||
}.get(section,section)
|
||||
#ids = list(set(data['ids']))
|
||||
ids = data['ids']
|
||||
if section == 'featured' and not request.user.get_profile().capability('canEditFeaturedTexts'):
|
||||
if section == 'featured' and not request.user.profile.capability('canEditFeaturedTexts'):
|
||||
response = json_response(status=403, text='not allowed')
|
||||
else:
|
||||
user = request.user
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue