1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2025-07-31 12:41:08 +00:00

Added migration

This commit is contained in:
Retspen 2015-03-25 11:36:37 +02:00
parent 5ccc813336
commit 1f68e8c5ed
7 changed files with 71 additions and 40 deletions

View file

@ -0,0 +1,13 @@
[
{
"model": "auth.user",
"pk": 1,
"fields": {
"username": "admin",
"password": "pbkdf2_sha256$15000$Qkg4dizzDzpM$SRXEyTJR5d198JZes4LVhFXlWQYJGOAjQhnfhGXQLtc=",
"is_active": true,
"is_superuser": true,
"is_staff": true
}
}
]

View file

@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.contrib.auth.models import User
def add_admin(apps, schema_editor):
add_user = User.objects.create_user("admin", None, "admin")
add_user.is_active = True
add_user.is_superuser = True
add_user.is_staff = True
add_user.save()
class Migration(migrations.Migration):
dependencies = [
('accounts', '0001_initial'),
]
operations = [
migrations.RunPython(add_admin),
]

View file

@ -1,20 +0,0 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('accounts', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='userinstance',
name='is_block',
field=models.BooleanField(default=False),
preserve_default=True,
),
]

View file

@ -1,18 +0,0 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('accounts', '0002_userinstance_is_block'),
]
operations = [
migrations.RemoveField(
model_name='userinstance',
name='is_block',
),
]

View file

@ -31,6 +31,8 @@ def profile(request):
oldpasswd = request.POST.get('oldpasswd', '')
password1 = request.POST.get('passwd1', '')
password2 = request.POST.get('passwd2', '')
if not password1 or not password2:
error_messages.append("Passwords didn't enter")
if password1 and password2 and password1 != password2:
error_messages.append("Passwords don't match")
if not user.check_password(oldpasswd):
@ -74,7 +76,7 @@ def accounts(request):
user_id = request.POST.get('user_id', '')
user_pass = request.POST.get('user_pass', '')
user_edit = User.objects.get(id=user_id)
user.password = user_pass
user_edit.set_password(user_pass)
user_edit.save()
return HttpResponseRedirect(request.get_full_path())
if 'block' in request.POST: