mirror of
https://github.com/retspen/webvirtcloud
synced 2024-12-25 07:35:22 +00:00
Removed UserAddForm as it is not used
This commit is contained in:
parent
d3c59acb3f
commit
20d4aaac30
2 changed files with 4 additions and 29 deletions
|
@ -1,26 +0,0 @@
|
||||||
import re
|
|
||||||
from django import forms
|
|
||||||
from django.utils.translation import ugettext_lazy as _
|
|
||||||
from django.contrib.auth.models import User
|
|
||||||
from django.conf import settings
|
|
||||||
|
|
||||||
|
|
||||||
class UserAddForm(forms.Form):
|
|
||||||
name = forms.CharField(label="Name",
|
|
||||||
error_messages={'required': _('No username has been entered')},
|
|
||||||
max_length=20)
|
|
||||||
password = forms.CharField(required=not settings.ALLOW_EMPTY_PASSWORD,
|
|
||||||
error_messages={'required': _('No password has been entered')},)
|
|
||||||
|
|
||||||
def clean_name(self):
|
|
||||||
name = self.cleaned_data['name']
|
|
||||||
have_symbol = re.match('^[a-z0-9]+$', name)
|
|
||||||
if not have_symbol:
|
|
||||||
raise forms.ValidationError(_('The flavor name must not contain any special characters'))
|
|
||||||
elif len(name) > 20:
|
|
||||||
raise forms.ValidationError(_('The flavor name must not exceed 20 characters'))
|
|
||||||
try:
|
|
||||||
User.objects.get(username=name)
|
|
||||||
except User.DoesNotExist:
|
|
||||||
return name
|
|
||||||
raise forms.ValidationError(_('Flavor name is already use'))
|
|
|
@ -1,16 +1,17 @@
|
||||||
|
import os
|
||||||
|
|
||||||
|
import sass
|
||||||
from django.core.validators import ValidationError
|
from django.core.validators import ValidationError
|
||||||
from django.http import HttpResponseRedirect
|
from django.http import HttpResponseRedirect
|
||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
from accounts.forms import UserAddForm
|
|
||||||
from accounts.models import *
|
from accounts.models import *
|
||||||
from admin.decorators import superuser_only
|
from admin.decorators import superuser_only
|
||||||
from appsettings.models import AppSettings
|
from appsettings.models import AppSettings
|
||||||
from instances.models import Instance
|
from instances.models import Instance
|
||||||
|
|
||||||
import sass
|
|
||||||
import os
|
|
||||||
|
|
||||||
def profile(request):
|
def profile(request):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in a new issue