Skip to content

Commit 19b53ec

Browse files
committed
Commit pred rozdelenim
Signed-off-by: Kosieh Barter <[email protected]>
1 parent 63d2bc3 commit 19b53ec

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

apps/web/views.py

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,11 @@
1414

1515

1616
def index(request):
17-
link_dict = {"Login": 'login_screen', "Register": 'register',
18-
"Log out": 'logout_user', "Car Management": 'cars',
19-
"User Management": 'user'}
20-
return render(request, 'web/index.html', {"links": link_dict})
17+
return render(request, 'web/index.html')
2118

2219
def logout_user(request):
2320
logout(request)
24-
return HttpResponseRedirect('../../')
21+
return HttpResponseRedirect('../../') ## TODO: OPRAVIT, vyvaruj se absolutnim adresam
2522

2623

2724
class LoginScreen(View):
@@ -46,13 +43,14 @@ def post(self, request):
4643

4744
if self.user:
4845
login(request, self.user)
46+
return HttpResponseRedirect('../../')
4947
else:
5048
return HttpResponse("INVALID CREDENTIALS!")
51-
return HttpResponseRedirect('../../')
5249

5350
def _check_credentials(self):
5451
if self.user_name and self.user_pass:
55-
self.user = authenticate(username = self.user_name, password = self.user_pass)
52+
self.user = authenticate(email=self.user_name,
53+
password=self.user_pass)
5654
else:
5755
return HttpResponse("MISSING CREDENTIALS!")
5856

@@ -125,15 +123,17 @@ def _check_details(self):
125123

126124

127125
def _check_existing_user(self):
128-
test_auth = authenticate(username = self.user_mail, password = self.user_pass)
126+
test_auth = authenticate(username = self.user_mail,
127+
password = self.user_pass,
128+
email = self.user_mail)
129129
if test_auth:
130130
self.user_exists = True
131131
else:
132132
self.user_exists = False
133133

134134

135135

136-
class CarManagement(View):
136+
class Car(View):
137137
header = "Car Management page"
138138

139139
model = None
@@ -167,7 +167,6 @@ def get(self, request):
167167

168168
def post(self, request):
169169
self.inp_method = request.POST.get('method')
170-
print (request.POST)
171170
if self.inp_method == 'add_vehicle':
172171
return self._add_car(request)
173172
elif self.inp_method == 'remove_vehicle':
@@ -210,7 +209,7 @@ def _check_required(self):
210209
return HttpResponse("FAILED TO SAVE, MISSING DATA!")
211210

212211

213-
class UserManagement(View):
212+
class User(View):
214213
header = "User control panel and information page"
215214
form = forms.ManageForm
216215

0 commit comments

Comments
 (0)