Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified DjangoSSC/__pycache__/__init__.cpython-39.pyc
Binary file not shown.
Binary file modified DjangoSSC/__pycache__/settings.cpython-39.pyc
Binary file not shown.
Binary file modified DjangoSSC/__pycache__/urls.cpython-39.pyc
Binary file not shown.
Binary file modified DjangoSSC/__pycache__/wsgi.cpython-39.pyc
Binary file not shown.
12,331 changes: 12,331 additions & 0 deletions dataset.csv

Large diffs are not rendered by default.

Binary file modified db.sqlite3
Binary file not shown.
Binary file modified edu/__pycache__/__init__.cpython-39.pyc
Binary file not shown.
Binary file modified edu/__pycache__/admin.cpython-39.pyc
Binary file not shown.
Binary file modified edu/__pycache__/models.cpython-39.pyc
Binary file not shown.
Binary file modified edu/__pycache__/urls.cpython-39.pyc
Binary file not shown.
Binary file modified edu/__pycache__/views.cpython-39.pyc
Binary file not shown.
Binary file modified edu/migrations/__pycache__/__init__.cpython-39.pyc
Binary file not shown.
4 changes: 3 additions & 1 deletion edu/static/css/login.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
align-items: center;
justify-content: center;
font-family: ParastooBold;
height: 52vh;
height: 55vh;
background-color: #fff;
border-radius: 5px;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
Expand All @@ -27,4 +27,6 @@
.login-error {
font-family: Parastoo;
color: #e74c3c;
display: block;
text-align: right;
}
7 changes: 6 additions & 1 deletion edu/static/css/registration.css
Original file line number Diff line number Diff line change
Expand Up @@ -136,4 +136,9 @@ h2 {
font-family: Parastoo;
}

/***************************************/
.register-error {
font-family: Parastoo;
color: #e74c3c;
display: block;
text-align: right;
}
4 changes: 2 additions & 2 deletions edu/templates/edu/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

<div id="navbarSupportedContent" class="collapse navbar-collapse">
<ul class="navbar-nav ml-auto">
<li class="nav-item active"><a id="homePage" href="{% url 'index' %}" class="nav-link">صفحه اصلی <span class="sr-only">(current)</span></a></li>
<li class="nav-item active"><a id="homepage" href="/" class="nav-link">صفحه اصلی <span class="sr-only">(current)</span></a></li>
<li class="nav-item"><a id="register" href="{% url 'registration' %}" class="nav-link">ثبت نام</a></li>
{% if not access %}
<li class="nav-item"><a id="login" href="{% url 'login' %}" class="nav-link">ورود</a></li>
Expand All @@ -50,4 +50,4 @@
{% block script %}
{% endblock %}
</body>
</html>
</html>
4 changes: 2 additions & 2 deletions edu/templates/edu/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
{% endblock %}

{% block content %}
<h3>سلام. به سامانه‌ی انتخاب واحد مجازی خوش آمدید.</h3>
{% endblock %}
<h3>سلام. به فروشگاه آنلاین وبلوپرز خوش آمدید.</h3>
{% endblock %}
5 changes: 5 additions & 0 deletions edu/templates/edu/registration.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ <h2>ثبت نام</h2>
</div>
</div>
</div>
{% if error == 'password' %}
<div id="errors" class="register-error">گذرواژه و تکرار گذرواژه یکسان نیستند</div>
{% elif error == 'username' %}
<div id="errors" class="register-error">نام کاربری شما در سیستم موجود است</div>
{% endif %}
<button type="submit" name="submit">ثبت نام</button>
</form>
</div>
Expand Down
23 changes: 19 additions & 4 deletions edu/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def get(self, request):

class Register(View):
def get(self, request):
return render(request, 'edu/registration.html')
return render(request, 'edu/registration.html', {'access': request.user.is_authenticated, 'error': None})

def post(self, request):
data = {
Expand All @@ -23,9 +23,24 @@ def post(self, request):
'email': request.POST.get('email'),
'password': make_password(request.POST.get('password1'))
}
user = User(**data)
user.save()
return render(request, 'edu/index.html', {'access': False})

findUser = User.objects.filter(username=data['username'])
password1 = request.POST.get('password1')
password2 = request.POST.get('password2')
registerError = None

if findUser:
registerError = 'username'

if password1 != password2:
registerError = 'password'

if registerError:
return render(request, 'edu/registration.html', {'error': registerError})
else:
user = User(**data)
user.save()
return render(request, 'edu/index.html', {'access': False})


class Login(View):
Expand Down