mirror of
https://github.com/retspen/webvirtcloud
synced 2025-07-31 12:41:08 +00:00
Fixed pep8
This commit is contained in:
parent
b9bf14fdb5
commit
56f840c893
13 changed files with 37 additions and 18 deletions
|
@ -6,8 +6,8 @@ from django.contrib.auth.models import User
|
|||
|
||||
class UserAddForm(forms.Form):
|
||||
name = forms.CharField(label="Name",
|
||||
error_messages={'required': _('No User name has been entered')},
|
||||
max_length=20)
|
||||
error_messages={'required': _('No User name has been entered')},
|
||||
max_length=20)
|
||||
password = forms.CharField(required=True, error_messages={'required': _('No password has been entered')},)
|
||||
|
||||
def clean_name(self):
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import models, migrations
|
||||
from django.db import 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
|
||||
|
@ -11,6 +12,7 @@ def add_admin(apps, schema_editor):
|
|||
add_user.is_staff = True
|
||||
add_user.save()
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
|
@ -19,4 +21,4 @@ class Migration(migrations.Migration):
|
|||
|
||||
operations = [
|
||||
migrations.RunPython(add_admin),
|
||||
]
|
||||
]
|
||||
|
|
|
@ -10,4 +10,4 @@ class UserInstance(models.Model):
|
|||
is_delete = models.BooleanField(default=False)
|
||||
|
||||
def __unicode__(self):
|
||||
return self.instance.name
|
||||
return self.instance.name
|
||||
|
|
|
@ -122,7 +122,7 @@ def account(request, user_id):
|
|||
instances = Instance.objects.all()
|
||||
|
||||
if user.username == request.user.username:
|
||||
return HttpResponseRedirect(reverse('profile'))
|
||||
return HttpResponseRedirect(reverse('profile'))
|
||||
|
||||
if request.method == 'POST':
|
||||
if 'delete' in request.POST:
|
||||
|
@ -150,4 +150,4 @@ def account(request, user_id):
|
|||
add_user_inst.save()
|
||||
return HttpResponseRedirect(request.get_full_path())
|
||||
|
||||
return render(request, 'account.html', locals())
|
||||
return render(request, 'account.html', locals())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue