mirror of
https://gitlab.com/brutaldon/brutaldon.git
synced 2024-12-04 14:46:24 -05:00
Update settings view to use preferences system
This commit is contained in:
parent
5899b4bc14
commit
fea88a541e
@ -32,7 +32,7 @@ class Preference(models.Model):
|
|||||||
choices=timezones, default='UTC')
|
choices=timezones, default='UTC')
|
||||||
|
|
||||||
class Account(models.Model):
|
class Account(models.Model):
|
||||||
username = models.EmailField()
|
username = models.EmailField(unique=True)
|
||||||
email = models.EmailField(null=True, blank=True)
|
email = models.EmailField(null=True, blank=True)
|
||||||
django_user = models.ForeignKey(settings.AUTH_USER_MODEL, models.CASCADE, null=True)
|
django_user = models.ForeignKey(settings.AUTH_USER_MODEL, models.CASCADE, null=True)
|
||||||
access_token = models.CharField(null=True, blank=True, max_length=2048)
|
access_token = models.CharField(null=True, blank=True, max_length=2048)
|
||||||
|
@ -350,7 +350,7 @@ def user(request, username, prev=None, next=None):
|
|||||||
@never_cache
|
@never_cache
|
||||||
@br_login_required
|
@br_login_required
|
||||||
def settings(request):
|
def settings(request):
|
||||||
account = Account.objects.get(username=username, client_id=client.id)
|
account = Account.objects.get(username=request.session['username'])
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
form = PreferencesForm(request.POST)
|
form = PreferencesForm(request.POST)
|
||||||
if form.is_valid():
|
if form.is_valid():
|
||||||
@ -368,8 +368,7 @@ def settings(request):
|
|||||||
form = PreferencesForm(account.preferences)
|
form = PreferencesForm(account.preferences)
|
||||||
return render(request, 'setup/settings.html',
|
return render(request, 'setup/settings.html',
|
||||||
{ 'form': form,
|
{ 'form': form,
|
||||||
'own_acct': request.session['user'],
|
'account': account})
|
||||||
'fullbrutalism': fullbrutalism_p(request)})
|
|
||||||
|
|
||||||
@never_cache
|
@never_cache
|
||||||
@br_login_required
|
@br_login_required
|
||||||
|
Loading…
Reference in New Issue
Block a user