def create(request): user = User() user.first_name = request.POST.get('first_name') user.last_name = request.POST.get('last_name') user.email = request.POST.get('email') user.description = request.POST.get('description') user.password = request.POST.get('password') user.created_at = timezone.now() user.user_level = 1 user.save() return redirect('/dashboard')
def register(request): user = User.objects.filter(email= request.POST.get('email'), password=request.POST.get('password')) if len(user) > 0 and len(request.POST.get('email'))<3: return redirect('/') else: user = User() user.first_name = request.POST.get('first_name') user.last_name = request.POST.get('last_name') user.email = request.POST.get('email') user.description = request.POST.get('description') user.password = request.POST.get('password') user.created_at = timezone.now() if len(User.objects.all()) < 1: user.user_level = 9; else: user.user_level = 1; user.save() return redirect('/')