From 8a55f4bb503709fc6784dd48119e9b88b3b5b358 Mon Sep 17 00:00:00 2001 From: samay-rgb Date: Fri, 4 Feb 2022 09:25:50 +0530 Subject: [PATCH 1/2] Simplified Sign Up page --- AlumniConnect/forms.py | 225 +++++++++++++++++++-------- AlumniConnect/urls.py | 18 ++- AlumniConnect/views.py | 55 +++++-- Pipfile | 73 +++++++++ applications/alumniprofile/models.py | 50 ++++-- requirements.txt | 2 +- templates/AlumniConnect/signup.html | 64 ++++++++ templates/globals/navbar.html | 12 +- 8 files changed, 401 insertions(+), 98 deletions(-) create mode 100644 Pipfile create mode 100644 templates/AlumniConnect/signup.html diff --git a/AlumniConnect/forms.py b/AlumniConnect/forms.py index e387c6ad..4d23dda8 100644 --- a/AlumniConnect/forms.py +++ b/AlumniConnect/forms.py @@ -1,10 +1,14 @@ import datetime +from logging import PlaceHolder from django import forms from applications.alumniprofile.models import Profile, Constants, Batch from django.contrib.auth.models import User from crispy_forms.helper import FormHelper from crispy_forms.layout import Layout, Submit, Row, Column, Div, Field from crispy_forms.bootstrap import InlineRadios +from django.contrib.auth.forms import UserCreationForm +import re +from django.core.exceptions import ValidationError class RegisterForm(forms.ModelForm): @@ -58,10 +62,14 @@ class ProfileEdit(forms.ModelForm): widget=forms.Select(attrs={'id': 'stateId', 'class': 'states order-alpha custom-select', 'name': 'state'})) city = forms.CharField( widget=forms.Select(attrs={'id': 'cityId', 'class': 'cities order-alpha custom-selects', 'name': 'city'})) - linkedin = forms.URLField(widget=forms.TextInput(attrs={'placeholder': 'Linkedin URL'})) - website = forms.URLField(widget=forms.TextInput(attrs={'placeholder': 'Website'}), required=False) - facebook = forms.URLField(widget=forms.TextInput(attrs={'placeholder': 'Facebook URL'}), required=False) - instagram = forms.CharField(widget=forms.TextInput(attrs={'placeholder': 'Instagram Username'}), required=False) + linkedin = forms.URLField(widget=forms.TextInput( + attrs={'placeholder': 'Linkedin URL'})) + website = forms.URLField(widget=forms.TextInput( + attrs={'placeholder': 'Website'}), required=False) + facebook = forms.URLField(widget=forms.TextInput( + attrs={'placeholder': 'Facebook URL'}), required=False) + instagram = forms.CharField(widget=forms.TextInput( + attrs={'placeholder': 'Instagram Username'}), required=False) def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) @@ -79,40 +87,56 @@ def __init__(self, *args, **kwargs): self.helper = FormHelper() self.helper.layout = Layout( Div( - Field('roll_no', css_class="form-control", wrapper_class='col-md-4'), - Field('name', css_class="form-control", wrapper_class='col-md-4'), - Field('sex', css_class="custom-select", wrapper_class="col-md-4"), + Field('roll_no', css_class="form-control", + wrapper_class='col-md-4'), + Field('name', css_class="form-control", + wrapper_class='col-md-4'), + Field('sex', css_class="custom-select", + wrapper_class="col-md-4"), css_class='form-row', ), Div( - Field('fathers_name', css_class="form-control", wrapper_class='col-md-6'), - Field('husbands_name', css_class="form-control", wrapper_class='col-md-6'), + Field('fathers_name', css_class="form-control", + wrapper_class='col-md-6'), + Field('husbands_name', css_class="form-control", + wrapper_class='col-md-6'), css_class='form-row', ), Div( - Field('date_of_birth', css_class="form-control", wrapper_class='col-md-4'), - Field('year_of_admission', css_class="custom-select", wrapper_class='col-md-4'), - Field('batch', css_class="custom-select", wrapper_class="col-md-4"), + Field('date_of_birth', css_class="form-control", + wrapper_class='col-md-4'), + Field('year_of_admission', css_class="custom-select", + wrapper_class='col-md-4'), + Field('batch', css_class="custom-select", + wrapper_class="col-md-4"), css_class='form-row', ), Div( - Field('branch', css_class="custom-select", wrapper_class="col-md-6"), - Field('programme', css_class="custom-select", wrapper_class="col-md-6"), + Field('branch', css_class="custom-select", + wrapper_class="col-md-6"), + Field('programme', css_class="custom-select", + wrapper_class="col-md-6"), css_class='form-row', ), Div( - Field('mobile1', css_class="form-control", wrapper_class='col-md-4'), - Field('mobile2', css_class="form-control", wrapper_class='col-md-4'), - Field('phone_no', css_class="form-control", wrapper_class="col-md-4"), + Field('mobile1', css_class="form-control", + wrapper_class='col-md-4'), + Field('mobile2', css_class="form-control", + wrapper_class='col-md-4'), + Field('phone_no', css_class="form-control", + wrapper_class="col-md-4"), css_class='form-row', ), Div( - Field('email', css_class="form-control", wrapper_class='col-md-6'), - Field('alternate_email', css_class="form-control", wrapper_class='col-md-6'), + Field('email', css_class="form-control", + wrapper_class='col-md-6'), + Field('alternate_email', css_class="form-control", + wrapper_class='col-md-6'), css_class='form-row', ), Div( - Field('current_address', css_class="form-control", wrapper_class='col-md'), + Field('current_address', css_class="form-control", + wrapper_class='col-md'), css_class='form-row', ), Div( @@ -122,30 +146,41 @@ def __init__(self, *args, **kwargs): css_class='form-row', ), Div( - Field('permanent_address', css_class="form-control", wrapper_class='col-md'), + Field('permanent_address', css_class="form-control", + wrapper_class='col-md'), css_class='form-row', ), InlineRadios('working_status'), Div( - Field('current_position', css_class="form-control", wrapper_class='col-md-6 col-lg-4'), - Field('current_organisation', css_class="form-control", wrapper_class='col-md-6 col-lg-4'), - Field('date_of_joining', css_class="form-control", wrapper_class='col-md-6 col-lg-4'), - Field('past_experience', css_class="form-control", wrapper_class="col-md-6 col-lg-4"), + Field('current_position', css_class="form-control", + wrapper_class='col-md-6 col-lg-4'), + Field('current_organisation', css_class="form-control", + wrapper_class='col-md-6 col-lg-4'), + Field('date_of_joining', css_class="form-control", + wrapper_class='col-md-6 col-lg-4'), + Field('past_experience', css_class="form-control", + wrapper_class="col-md-6 col-lg-4"), css_class='form-row', ), Div( - Field('current_course', css_class="form-control", wrapper_class='col-md-6 col-lg-4'), - Field('current_university', css_class="form-control", wrapper_class='col-md-6 col-lg-4'), + Field('current_course', css_class="form-control", + wrapper_class='col-md-6 col-lg-4'), + Field('current_university', css_class="form-control", + wrapper_class='col-md-6 col-lg-4'), css_class='form-row', ), Div( - Field('linkedin', css_class="form-control", wrapper_class='col-md-6'), - Field('website', css_class="form-control", wrapper_class='col-md-6'), + Field('linkedin', css_class="form-control", + wrapper_class='col-md-6'), + Field('website', css_class="form-control", + wrapper_class='col-md-6'), css_class='form-row', ), Div( - Field('facebook', css_class="form-control", wrapper_class='col-md-6'), - Field('instagram', css_class="form-control", wrapper_class='col-md-6'), + Field('facebook', css_class="form-control", + wrapper_class='col-md-6'), + Field('instagram', css_class="form-control", + wrapper_class='col-md-6'), css_class='form-row', ), Field('profile_picture', css_class="w-100"), @@ -241,11 +276,15 @@ class NewRegister(forms.ModelForm): widget=forms.Select(attrs={'id': 'stateId', 'class': 'states order-alpha custom-select', 'name': 'state'})) city = forms.ChoiceField( widget=forms.Select(attrs={'id': 'cityId', 'class': 'cities order-alpha custom-select', 'name': 'city'})) - linkedin = forms.URLField(widget=forms.TextInput(attrs={'placeholder': 'Linkedin URL'})) - website = forms.URLField(widget=forms.TextInput(attrs={'placeholder': 'Website'}), required=False) - facebook = forms.URLField(widget=forms.TextInput(attrs={'placeholder': 'Facebook URL'}), required=False) + linkedin = forms.URLField(widget=forms.TextInput( + attrs={'placeholder': 'Linkedin URL'})) + website = forms.URLField(widget=forms.TextInput( + attrs={'placeholder': 'Website'}), required=False) + facebook = forms.URLField(widget=forms.TextInput( + attrs={'placeholder': 'Facebook URL'}), required=False) # checkbox_terms = forms.BooleanField(required=True) - instagram = forms.CharField(widget=forms.TextInput(attrs={'placeholder': 'Instagram Username'}), required=False) + instagram = forms.CharField(widget=forms.TextInput( + attrs={'placeholder': 'Instagram Username'}), required=False) checkbox_update = forms.BooleanField(required=True) def __init__(self, *args, **kwargs): @@ -267,40 +306,56 @@ def __init__(self, *args, **kwargs): self.helper = FormHelper() self.helper.layout = Layout( Div( - Field('roll_no', css_class="form-control", wrapper_class='col-md-4'), - Field('name', css_class="form-control", wrapper_class='col-md-4'), - Field('sex', css_class="custom-select", wrapper_class="col-md-4"), + Field('roll_no', css_class="form-control", + wrapper_class='col-md-4'), + Field('name', css_class="form-control", + wrapper_class='col-md-4'), + Field('sex', css_class="custom-select", + wrapper_class="col-md-4"), css_class='form-row', ), Div( - Field('fathers_name', css_class="form-control", wrapper_class='col-md-6'), - Field('husbands_name', css_class="form-control", wrapper_class='col-md-6'), + Field('fathers_name', css_class="form-control", + wrapper_class='col-md-6'), + Field('husbands_name', css_class="form-control", + wrapper_class='col-md-6'), css_class='form-row', ), Div( - Field('date_of_birth', css_class="form-control", wrapper_class='col-md-4'), - Field('year_of_admission', css_class="custom-select", wrapper_class='col-md-4'), - Field('batch', css_class="custom-select", wrapper_class="col-md-4"), + Field('date_of_birth', css_class="form-control", + wrapper_class='col-md-4'), + Field('year_of_admission', css_class="custom-select", + wrapper_class='col-md-4'), + Field('batch', css_class="custom-select", + wrapper_class="col-md-4"), css_class='form-row', ), Div( - Field('branch', css_class="custom-select", wrapper_class="col-md-6"), - Field('programme', css_class="custom-select", wrapper_class="col-md-6"), + Field('branch', css_class="custom-select", + wrapper_class="col-md-6"), + Field('programme', css_class="custom-select", + wrapper_class="col-md-6"), css_class='form-row', ), Div( - Field('mobile1', css_class="form-control", wrapper_class='col-md-4'), - Field('mobile2', css_class="form-control", wrapper_class='col-md-4'), - Field('phone_no', css_class="form-control", wrapper_class="col-md-4"), + Field('mobile1', css_class="form-control", + wrapper_class='col-md-4'), + Field('mobile2', css_class="form-control", + wrapper_class='col-md-4'), + Field('phone_no', css_class="form-control", + wrapper_class="col-md-4"), css_class='form-row', ), Div( - Field('email', css_class="form-control", wrapper_class='col-md-6'), - Field('alternate_email', css_class="form-control", wrapper_class='col-md-6'), + Field('email', css_class="form-control", + wrapper_class='col-md-6'), + Field('alternate_email', css_class="form-control", + wrapper_class='col-md-6'), css_class='form-row', ), Div( - Field('current_address', css_class="form-control", wrapper_class='col-md'), + Field('current_address', css_class="form-control", + wrapper_class='col-md'), css_class='form-row', ), Div( @@ -310,30 +365,41 @@ def __init__(self, *args, **kwargs): css_class='form-row', ), Div( - Field('permanent_address', css_class="form-control", wrapper_class='col-md'), + Field('permanent_address', css_class="form-control", + wrapper_class='col-md'), css_class='form-row', ), InlineRadios('working_status'), Div( - Field('current_position', css_class="form-control", wrapper_class='col-md-6 col-lg-4'), - Field('current_organisation', css_class="form-control", wrapper_class='col-md-6 col-lg-4'), - Field('date_of_joining', css_class="form-control", wrapper_class='col-md-6 col-lg-4'), - Field('past_experience', css_class="form-control", wrapper_class="col-md-6 col-lg-4"), + Field('current_position', css_class="form-control", + wrapper_class='col-md-6 col-lg-4'), + Field('current_organisation', css_class="form-control", + wrapper_class='col-md-6 col-lg-4'), + Field('date_of_joining', css_class="form-control", + wrapper_class='col-md-6 col-lg-4'), + Field('past_experience', css_class="form-control", + wrapper_class="col-md-6 col-lg-4"), css_class='form-row', ), Div( - Field('current_course', css_class="form-control", wrapper_class='col-md-6 col-lg-4'), - Field('current_university', css_class="form-control", wrapper_class='col-md-6 col-lg-4'), + Field('current_course', css_class="form-control", + wrapper_class='col-md-6 col-lg-4'), + Field('current_university', css_class="form-control", + wrapper_class='col-md-6 col-lg-4'), css_class='form-row', ), Div( - Field('linkedin', css_class="form-control", wrapper_class='col-md-6'), - Field('website', css_class="form-control", wrapper_class='col-md-6'), + Field('linkedin', css_class="form-control", + wrapper_class='col-md-6'), + Field('website', css_class="form-control", + wrapper_class='col-md-6'), css_class='form-row', ), Div( - Field('facebook', css_class="form-control", wrapper_class='col-md-6'), - Field('instagram', css_class="form-control", wrapper_class='col-md-6'), + Field('facebook', css_class="form-control", + wrapper_class='col-md-6'), + Field('instagram', css_class="form-control", + wrapper_class='col-md-6'), css_class='form-row', ), Field('profile_picture', css_class="w-100"), @@ -392,6 +458,41 @@ class Meta: } +class SignUp(UserCreationForm): + username = forms.CharField( + label='Enter Username', min_length=4, max_length=150, widget=forms.TextInput(attrs={'placeholder': 'Enter your roll number'})) + email = forms.EmailField(label='Enter email', widget=forms.EmailInput( + attrs={'placeholder': 'Enter your email'})) + password1 = forms.CharField( + label='Enter password', widget=forms.PasswordInput(attrs={'placeholder': 'Enter your password'})) + password2 = forms.CharField( + label='Confirm password', widget=forms.PasswordInput(attrs={'placeholder': 'Reenter your password'})) + user_type = forms.ChoiceField(choices=(('A', 'Alumini'), ('S', 'Student'))) + + def clean_email(self): + email = self.cleaned_data['email'].lower() + r = User.objects.filter(email=email) + if re.findall("iiitdmj.ac.in$", email): + raise ValidationError( + "Institute email id is not accepted.Kindly enter your personal email id.") + return email + + def clean_username(self): + username = self.cleaned_data.get('username').lower() + r = User.objects.filter(username=username) + match = re.search('20\w\w\w\d\d\d', username) + match2 = re.search('20\d\d\d\d\d', username) + if(match == match2 == None): + raise ValidationError( + 'Please enter your institute roll number.' + ) + return username + + class Meta: + model = User + fields = ['username', 'email', 'password1', 'password2', 'user_type'] + + class PasswordResetRequestForm(forms.Form): roll_no = forms.IntegerField(label=("Roll No.")) email = forms.CharField(label=("Email"), max_length=254) diff --git a/AlumniConnect/urls.py b/AlumniConnect/urls.py index 75d37304..d6071075 100644 --- a/AlumniConnect/urls.py +++ b/AlumniConnect/urls.py @@ -22,7 +22,7 @@ from django.views.generic.base import RedirectView from os import listdir -from . import views +from . import views favicon_view = RedirectView.as_view(url='/static/favicon.ico', permanent=True) @@ -37,13 +37,16 @@ #path('account/reset_password/', views.ResetPasswordRequestView.as_view(), name="reset_password"), path('logout/', LogoutView.as_view(), name='logout'), path('register/', views.register, name='register'), - path('newregister/', views.new_register, name='new_register'), - re_path(r'^activate/(?P[0-9A-Za-z_\-]+)/(?P[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$', views.activate, name='activate'), - path('confirm/', TemplateView.as_view(template_name='AlumniConnect/confirm_email.html'), name = 'confirm'), - path('success/', TemplateView.as_view(template_name='AlumniConnect/account_success.html'), name = 'success'), + path('signup/', views.signup, name='signup'), + # path('newregister/', views.new_register, name='new_register'), + re_path( + r'^activate/(?P[0-9A-Za-z_\-]+)/(?P[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$', views.activate, name='activate'), + path('confirm/', TemplateView.as_view(template_name='AlumniConnect/confirm_email.html'), name='confirm'), + path('success/', TemplateView.as_view(template_name='AlumniConnect/account_success.html'), name='success'), re_path('^', include('django.contrib.auth.urls')), path('password/', views.change_password, name='change_password'), - re_path(r'^profileedit/(?P[0-9]+)/$', views.profileedit, name='profileedit'), + re_path(r'^profileedit/(?P[0-9]+)/$', + views.profileedit, name='profileedit'), path('profile/', include('applications.alumniprofile.urls')), path('members/', include('applications.members.urls')), path('events/', include('applications.events_news.urls')), @@ -63,13 +66,12 @@ ] if settings.DEBUG: - import debug_toolbar urlpatterns = [ path('__debug__/', include(debug_toolbar.urls)), ] + urlpatterns - + admin.site.site_header = "IIITDMJ Alumni Association" admin.site.site_title = "Alumni Association" admin.site.index_title = "Alumni Association Admin" diff --git a/AlumniConnect/views.py b/AlumniConnect/views.py index b27d74fb..56489904 100644 --- a/AlumniConnect/views.py +++ b/AlumniConnect/views.py @@ -15,10 +15,10 @@ from django.contrib.auth.views import LoginView from django.contrib.messages.views import SuccessMessageMixin -from .forms import RegisterForm, ProfileEdit, NewRegister +from .forms import RegisterForm, ProfileEdit, NewRegister, SignUp from .token import account_activation_token from applications.events_news.models import Event, Attendees -from applications.alumniprofile.models import Profile, Constants +from applications.alumniprofile.models import Profile, Constants, Batch from applications.news.models import News from applications.gallery.models import Album from applications.geolocation.views import addPoints @@ -49,7 +49,8 @@ def index(request): news = News.objects.filter().order_by('-date') # messages.success(request, 'Your password was successfully updated!') events_to_display = list(chain(events, events_completed))[:3] - albums_list = Album.objects.order_by('-created').annotate(images_count=Count('albumimage'))[:3] + albums_list = Album.objects.order_by( + '-created').annotate(images_count=Count('albumimage'))[:3] return render(request, "AlumniConnect/index.html", {'name': sname, 'events': events_to_display, 'news': news, 'albums': albums_list}) @@ -84,7 +85,8 @@ def register(request): batch = form.cleaned_data.get('batch') branch = form.cleaned_data.get('branch') programme = form.cleaned_data.get('programme') - l = Profile.objects.filter(batch=batch, programme=programme, branch=branch) + l = Profile.objects.filter( + batch=batch, programme=programme, branch=branch) print('Testing output\n') print(l) check = True @@ -94,10 +96,43 @@ def register(request): return render(request, 'AlumniConnect/registration.html', {'form': form, 'check': check, 'l': l}) +def signup(request): + if request.method == 'POST': + form = SignUp(request.POST) + if form.is_valid(): + + # CREATING THE USER FROM THE MODEL FORM DATA + user = form.save(commit=False) + user.username = form.cleaned_data.get('username') + user.email = str(form.cleaned_data.get('email')) + user.is_active = False + user.save() + # THEN CREATING THE PROFILE INSTANCE AND SAVING THE USER AND USER_TYPE + profile = Profile.objects.create( + roll_no=form.cleaned_data.get('username'), + email=form.cleaned_data.get('email'), + user_type=form.cleaned_data.get('user_type'), + user=user, + batch=Batch(2009), + ) + + profile.save() + messages.success( + request, f'Your account has been created! You are now able to log in') + return render(request, 'AlumniConnect/confirm_email.html') + # return HttpResponseRedirect('/') + else: + form = SignUp() + return render(request, 'AlumniConnect/signup.html', {'form': form}) + + def reg_no_gen(degree_, spec_, year): - degree = {"B.Tech": "1", "B.Des": '2', "M.Tech": '3', "M.Des": '4', "PhD": '5'} - spec = {"NA": '00', "CSE": "01", "ECE": "02", "ME": "03", "MT": "04", "NS": "05", "DS": "06"} - last_reg_no = Profile.objects.filter(year_of_admission=year).order_by('user__date_joined').last() + degree = {"B.Tech": "1", "B.Des": '2', + "M.Tech": '3', "M.Des": '4', "PhD": '5'} + spec = {"NA": '00', "CSE": "01", "ECE": "02", + "ME": "03", "MT": "04", "NS": "05", "DS": "06"} + last_reg_no = Profile.objects.filter( + year_of_admission=year).order_by('user__date_joined').last() # print(last_reg_no) new_reg_no = (int(str(last_reg_no.reg_no)[-4:]) + 1) if last_reg_no else 1 return degree[degree_] + spec[spec_] + str(year)[2:] + str(convert_int(new_reg_no, 4)) @@ -119,7 +154,8 @@ def new_register(request): last_name = "" # print (form.cleaned_data.get('date_of_joining')) profile = form.save(commit=False) - profile.reg_no = reg_no_gen(profile.programme, profile.branch, profile.year_of_admission) + profile.reg_no = reg_no_gen( + profile.programme, profile.branch, profile.year_of_admission) profile.country = request.POST['country'] profile.state = request.POST['state'] profile.city = request.POST['city'] @@ -190,7 +226,8 @@ def change_password(request): if form.is_valid(): user = form.save() update_session_auth_hash(request, user) # Important! - messages.success(request, 'Your password was successfully updated!') + messages.success( + request, 'Your password was successfully updated!') return redirect('home') else: messages.error(request, 'Please correct the error below.') diff --git a/Pipfile b/Pipfile new file mode 100644 index 00000000..6bcd45a3 --- /dev/null +++ b/Pipfile @@ -0,0 +1,73 @@ +[[source]] +url = "https://pypi.org/simple" +verify_ssl = true +name = "pypi" + +[packages] +amqp = "==2.5.2" +anyjson = "==0.3.3" +astroid = "==2.1.0" +beautifulsoup4 = "==4.6.0" +billiard = "==3.6.1.0" +cachetools = "==3.1.0" +celery = "==4.3.0" +certifi = "==2018.11.29" +chardet = "==3.0.4" +colorama = "==0.4.4" +defusedxml = "==0.5.0" +django-allauth = "==0.32.0" +django-anymail = "==6.0" +django-appconf = "==1.0.2" +django-ckeditor = "==5.6.1" +django-cleanup = "==3.0.1" +django-crispy-forms = "==1.7.2" +django-debug-toolbar = "==1.11" +django-imagekit = "==4.0.2" +django-js-asset = "==1.1.0" +django-material = "==1.5.3" +django-model-utils = "==4.0.0" +django-semanticui-forms = "==1.6.5" +django-tempus-dominus = "==5.1.2.13" +django-widget-tweaks = "==1.4.3" +easy-thumbnails = "==2.6" +google-auth = "==1.6.3" +html5lib = "==1.0b10" +httplib2 = "==0.12.3" +idna = "==2.8" +importlib-metadata = "==1.3.0" +isort = "==4.2.15" +kombu = "==4.6.7" +lazy-object-proxy = "==1.3.1" +mailjet-rest = "==1.3.3" +mccabe = "==0.6.1" +more-itertools = "==8.0.2" +oauthlib = "==3.0.1" +pilkit = "==2.0" +pyasn1 = "==0.4.5" +pyasn1-modules = "==0.2.5" +pyflakes = "==1.5.0" +pylint = "==2.2.2" +python3-openid = "==3.1.0" +pytz = "==2018.9" +redis = "==3.3.11" +requests = "==2.21.0" +requests-oauthlib = "==1.2.0" +rsa = "==4.0" +six = "==1.12.0" +sqlparse = "==0.2.4" +typed-ast = "==1.3.2" +uritemplate = "==3.0.0" +urllib3 = "==1.24.2" +vine = "==1.3.0" +webencodings = "==0.5.1" +wrapt = "==1.11.1" +xlrd = "==1.2.0" +zipp = "==0.6.0" +Django = "==2.2.20" +Markdown = "==3.0.1" +Pillow = "==6.2.0" + +[dev-packages] + +[requires] +python_version = "3.7" diff --git a/applications/alumniprofile/models.py b/applications/alumniprofile/models.py index c599a1bd..012211df 100644 --- a/applications/alumniprofile/models.py +++ b/applications/alumniprofile/models.py @@ -1,15 +1,22 @@ from django.contrib.auth.models import User from django.db import models from django.utils import timezone -import datetime, os +import datetime +import os from django.db.models.signals import post_save, pre_save from django.dispatch import receiver from model_utils import FieldTracker from time import strftime + # from .funcs import send_verification_email class Constants: + USER_TYPE = ( + ('S', 'Student'), + ('A', 'Alumni') + ) + SEX_CHOICES = ( ('M', 'Male'), ('F', 'Female'), @@ -40,7 +47,8 @@ class Constants: ('Is Self Employed', 'Is Self Employed') ) - YEAR_OF_ADDMISSION = tuple((n, str(n)) for n in range(2005, datetime.datetime.now().year)) + YEAR_OF_ADDMISSION = tuple((n, str(n)) + for n in range(2005, datetime.datetime.now().year)) class Batch(models.Model): @@ -60,40 +68,54 @@ class Profile(models.Model): roll_no = models.IntegerField(primary_key=True) email = models.EmailField(null=False, default="") alternate_email = models.EmailField(null=True, blank=True) - year_of_admission = models.IntegerField(null=True, choices=Constants.YEAR_OF_ADDMISSION) + year_of_admission = models.IntegerField( + null=True, choices=Constants.YEAR_OF_ADDMISSION) batch = models.ForeignKey(Batch, on_delete=models.CASCADE) name = models.CharField(max_length=1000, default="", null=False) fathers_name = models.CharField(max_length=1000, default="") - husbands_name = models.CharField(null=True, blank=True, max_length=1000, default="") - programme = models.CharField(max_length=1000, choices=Constants.PROG_CHOICES, null=False) - branch = models.CharField(choices=Constants.BRANCH, max_length=1000, null=False) - sex = models.CharField(max_length=2, choices=Constants.SEX_CHOICES, default='M') + husbands_name = models.CharField( + null=True, blank=True, max_length=1000, default="") + programme = models.CharField( + max_length=1000, choices=Constants.PROG_CHOICES, null=False) + branch = models.CharField(choices=Constants.BRANCH, + max_length=1000, null=False) + sex = models.CharField( + max_length=2, choices=Constants.SEX_CHOICES, default='M') date_of_birth = models.DateField(default=datetime.date(1970, 1, 1)) current_address = models.TextField(max_length=1000, default="") - permanent_address = models.TextField(max_length=1000, blank=True, null=True) + permanent_address = models.TextField( + max_length=1000, blank=True, null=True) mobile1 = models.BigIntegerField(null=True) mobile2 = models.BigIntegerField(null=True, blank=True) phone_no = models.BigIntegerField(null=True, blank=True) - working_status = models.CharField(max_length=1000, choices=Constants.WORKING_STATUS, default='1', null=False) + working_status = models.CharField( + max_length=1000, choices=Constants.WORKING_STATUS, default='1', null=False) current_position = models.CharField(max_length=1000, null=True, blank=True) - current_organisation = models.CharField(max_length=1000, null=True, blank=True) + current_organisation = models.CharField( + max_length=1000, null=True, blank=True) past_experience = models.IntegerField(null=True, blank=True) current_course = models.CharField(null=True, blank=True, max_length=1000) - current_university = models.CharField(null=True, blank=True, max_length=1000) + current_university = models.CharField( + null=True, blank=True, max_length=1000) city = models.CharField(null=True, max_length=1000, blank=True) country = models.CharField(null=True, max_length=1000, blank=True) state = models.CharField(null=True, max_length=1000, blank=True) - facebook = models.URLField(null=True, blank=True, default="www.facebook.com") - linkedin = models.URLField(null=True, blank=True, default="www.linkedin.com") + facebook = models.URLField( + null=True, blank=True, default="www.facebook.com") + linkedin = models.URLField( + null=True, blank=True, default="www.linkedin.com") instagram = models.CharField(null=True, blank=True, max_length=1000) website = models.URLField(null=True, blank=True) profile_picture = models.ImageField(null=True, upload_to=upload_photo) is_verified = models.BooleanField(default=True) - date_of_joining = models.DateField(null=True, blank=True, default=datetime.date.today) + date_of_joining = models.DateField( + null=True, blank=True, default=datetime.date.today) reg_no = models.BigIntegerField(null=True, default=0, editable=False) mail_sent = models.BooleanField(default=False) verify = models.BooleanField(null=True) mail_sent_tracker = FieldTracker(fields=['verify']) + user_type = models.CharField( + max_length=2, choices=Constants.USER_TYPE, default='A') def __str__(self): return self.name diff --git a/requirements.txt b/requirements.txt index 261462c2..b1bf2d90 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ amqp==2.5.2 -anyjson==0.3.3 +anyjson astroid==2.1.0 beautifulsoup4==4.6.0 billiard==3.6.1.0 diff --git a/templates/AlumniConnect/signup.html b/templates/AlumniConnect/signup.html new file mode 100644 index 00000000..03031c0f --- /dev/null +++ b/templates/AlumniConnect/signup.html @@ -0,0 +1,64 @@ +{% extends 'globals/base.html' %} +{% load static %} +{% load crispy_forms_tags %} +{% block title %} +AlumniConnect - Login +{% endblock %} + +{% block body %} +{% include 'globals/navbar.html' %} +
+ +
+
+
+
+

+ +

+
+
+

+ STUDENT ALUMNI CELL +

+
+
+
+
+ +
+
+ +
+ +
+{% include 'globals/footer.html' %} +{% endblock %} \ No newline at end of file diff --git a/templates/globals/navbar.html b/templates/globals/navbar.html index 7f13339e..e776eac7 100644 --- a/templates/globals/navbar.html +++ b/templates/globals/navbar.html @@ -4,7 +4,7 @@ + \ No newline at end of file From 724d3464dc3797a463e21780cc26923a9b891398 Mon Sep 17 00:00:00 2001 From: samay-rgb Date: Fri, 4 Feb 2022 09:28:45 +0530 Subject: [PATCH 2/2] Simplified Sign up page --- .gitignore | 2 ++ Pipfile | 73 ------------------------------------------------------ 2 files changed, 2 insertions(+), 73 deletions(-) delete mode 100644 Pipfile diff --git a/.gitignore b/.gitignore index f534bd81..09c35fbc 100644 --- a/.gitignore +++ b/.gitignore @@ -94,3 +94,5 @@ dump.rdb celerybeat-schedule .idea/ + +Pipfile \ No newline at end of file diff --git a/Pipfile b/Pipfile deleted file mode 100644 index 6bcd45a3..00000000 --- a/Pipfile +++ /dev/null @@ -1,73 +0,0 @@ -[[source]] -url = "https://pypi.org/simple" -verify_ssl = true -name = "pypi" - -[packages] -amqp = "==2.5.2" -anyjson = "==0.3.3" -astroid = "==2.1.0" -beautifulsoup4 = "==4.6.0" -billiard = "==3.6.1.0" -cachetools = "==3.1.0" -celery = "==4.3.0" -certifi = "==2018.11.29" -chardet = "==3.0.4" -colorama = "==0.4.4" -defusedxml = "==0.5.0" -django-allauth = "==0.32.0" -django-anymail = "==6.0" -django-appconf = "==1.0.2" -django-ckeditor = "==5.6.1" -django-cleanup = "==3.0.1" -django-crispy-forms = "==1.7.2" -django-debug-toolbar = "==1.11" -django-imagekit = "==4.0.2" -django-js-asset = "==1.1.0" -django-material = "==1.5.3" -django-model-utils = "==4.0.0" -django-semanticui-forms = "==1.6.5" -django-tempus-dominus = "==5.1.2.13" -django-widget-tweaks = "==1.4.3" -easy-thumbnails = "==2.6" -google-auth = "==1.6.3" -html5lib = "==1.0b10" -httplib2 = "==0.12.3" -idna = "==2.8" -importlib-metadata = "==1.3.0" -isort = "==4.2.15" -kombu = "==4.6.7" -lazy-object-proxy = "==1.3.1" -mailjet-rest = "==1.3.3" -mccabe = "==0.6.1" -more-itertools = "==8.0.2" -oauthlib = "==3.0.1" -pilkit = "==2.0" -pyasn1 = "==0.4.5" -pyasn1-modules = "==0.2.5" -pyflakes = "==1.5.0" -pylint = "==2.2.2" -python3-openid = "==3.1.0" -pytz = "==2018.9" -redis = "==3.3.11" -requests = "==2.21.0" -requests-oauthlib = "==1.2.0" -rsa = "==4.0" -six = "==1.12.0" -sqlparse = "==0.2.4" -typed-ast = "==1.3.2" -uritemplate = "==3.0.0" -urllib3 = "==1.24.2" -vine = "==1.3.0" -webencodings = "==0.5.1" -wrapt = "==1.11.1" -xlrd = "==1.2.0" -zipp = "==0.6.0" -Django = "==2.2.20" -Markdown = "==3.0.1" -Pillow = "==6.2.0" - -[dev-packages] - -[requires] -python_version = "3.7"