From 457bb862a99f687b8dd60d01066d0294465ea85a Mon Sep 17 00:00:00 2001 From: kasv-p <84275697+kasv-p@users.noreply.github.com> Date: Sat, 28 May 2022 23:04:06 +0530 Subject: [PATCH 01/15] Add files via upload place superuser.bat file in cdc_backend folder and setup.bat in cdc folder. updated setup.sh please check and review --- setup.bat | 12 ++++++++++++ superuser.bat | 11 +++++++++++ 2 files changed, 23 insertions(+) create mode 100644 setup.bat create mode 100644 superuser.bat diff --git a/setup.bat b/setup.bat new file mode 100644 index 0000000..73da3f2 --- /dev/null +++ b/setup.bat @@ -0,0 +1,12 @@ + +start /wait python -m venv venv && venv\Scripts\activate && pip install -r requirements.txt &^ +echo Environment Setup Complete &^ +timeout 3 > NUL &^ +cd "CDC_Backend" &^ + +python manage.py flush --no-input &^ +python manage.py makemigrations &^ +python manage.py migrate &^ +echo Migrations complete &^ +start superuser.bat &^ +echo done successfully diff --git a/superuser.bat b/superuser.bat new file mode 100644 index 0000000..88d3591 --- /dev/null +++ b/superuser.bat @@ -0,0 +1,11 @@ +@echo off +set /p create="do you want to create supruser ? (Y/N) " + + +if %create% equ Y ( python manage.py createsuperuser ) +if %create% equ y ( python manage.py createsuperuser ) + +python manage.py collectstatic --noinput +if exist Storage (echo Storage Directory already exists) else ( echo Creating Storage Directory... & mkdir Storage & echo Storage Directory Created) +timeout 3 > NUL +pause From b04b53069c1b72f1e0483ca667100144cbcc3cc9 Mon Sep 17 00:00:00 2001 From: kasv-p <84275697+kasv-p@users.noreply.github.com> Date: Sat, 28 May 2022 23:07:38 +0530 Subject: [PATCH 02/15] Update setup.sh --- setup.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/setup.sh b/setup.sh index 86a2bc3..aaa20b9 100644 --- a/setup.sh +++ b/setup.sh @@ -20,3 +20,11 @@ else echo "${DIR} Directory Created" fi +echo Do you want ceate credentials for super user (Y/N) ? +read create +create=${create^^} + +if [ "$create" == "Y" ]; then + ### Take action if user want to create ### + python3 manage.py createsuperuser +fi From 419eaa40ac17be979f23288b34a69ee701c04f68 Mon Sep 17 00:00:00 2001 From: Abhishek28112002 <72252789+Abhishek28112002@users.noreply.github.com> Date: Thu, 2 Jun 2022 15:45:22 +0530 Subject: [PATCH 03/15] Update README.md --- README.md | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 83ac1d8..21b39b1 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,8 @@ python# CDC - Backend ### Setup 1. Download the Repository to your local machine
-2. Create a Virtual Environment in the [CDC_Backend](./) folder with this command below
+2. Make Sour u have downloaded python from python.org +3. Create a Virtual Environment in the [CDC_Backend](./) folder with this command below
`python -m venv venv` 3. Activate the environment with this command
`.\venv\Scripts\activate` @@ -13,6 +14,15 @@ python# CDC - Backend `pip install -r requirements.txt ` 5. Ensure that you have the PostgreSQL installed on your machine and is running on PORT **5432**
6. Make sure to give the correct database credentials in [settings.py](./CDC_Backend/CDC_Backend/settings.py) +7. Run these following commands .. +8. cd CDC_Backend +python manage.py flush --no-input +python manage.py makemigrations +python manage.py migrate +python manage.py collectstatic --noinput +mkdir Storage +python manage.py makemigrations APIs + ### Running the Application @@ -26,8 +36,13 @@ python# CDC - Backend 1. You can access the admin panel by running the server and opening 2. Run `python manage.py createsuperuser` to create a user to access the admin panel. -3. Set up the Username and Password -4. You can log in and change the database values anytime. +3. if there is an error due to time then sync your machine time . +4. Set up the Username and Password +5. You can log in and change the database values anytime. +6. Create your id as insitute Roll No for both admin and student . +7.if u are still getting an error ,open inspect and see in network +And then recognize it +8.Check the client link in dev.env in backend and .env in frontend is the same ### Deploying From a05ec1430f876803ca995880494ab87a6ece11f6 Mon Sep 17 00:00:00 2001 From: kasv-p <84275697+kasv-p@users.noreply.github.com> Date: Mon, 6 Jun 2022 19:03:04 +0530 Subject: [PATCH 04/15] creating db command added --- setup.bat | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/setup.bat b/setup.bat index 73da3f2..26ffaf0 100644 --- a/setup.bat +++ b/setup.bat @@ -2,11 +2,14 @@ start /wait python -m venv venv && venv\Scripts\activate && pip install -r requirements.txt &^ echo Environment Setup Complete &^ timeout 3 > NUL &^ +echo enter password for user postgres &^ +createdb -h localhost -p 5432 -U postgres cdc &^ cd "CDC_Backend" &^ python manage.py flush --no-input &^ python manage.py makemigrations &^ python manage.py migrate &^ echo Migrations complete &^ -start superuser.bat &^ +cd .. &^ +start .\superuser.bat &^ echo done successfully From 76b9cfc9b8ffb4c177662897410b522cc2c36734 Mon Sep 17 00:00:00 2001 From: kasv-p <84275697+kasv-p@users.noreply.github.com> Date: Mon, 6 Jun 2022 19:25:25 +0530 Subject: [PATCH 05/15] Update superuser.bat --- superuser.bat | 1 + 1 file changed, 1 insertion(+) diff --git a/superuser.bat b/superuser.bat index 88d3591..7afce95 100644 --- a/superuser.bat +++ b/superuser.bat @@ -1,6 +1,7 @@ @echo off set /p create="do you want to create supruser ? (Y/N) " +cd "CDC_Backend" &^ if %create% equ Y ( python manage.py createsuperuser ) if %create% equ y ( python manage.py createsuperuser ) From 52b74e2e9f1b299da451578d3a3642695e6b2f5d Mon Sep 17 00:00:00 2001 From: Gowtham Sai <66207607+gowtham3105@users.noreply.github.com> Date: Sat, 8 Oct 2022 14:26:27 +0530 Subject: [PATCH 06/15] Send reminder mails service --- CDC_Backend/APIs/constants.py | 2 + CDC_Backend/CDC_Backend/settings.py | 1 + CDC_Backend/scripts/send_reminder_mails.py | 63 +++++++++++++++++++ .../templates/students_opening_reminder.html | 2 +- 4 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 CDC_Backend/scripts/send_reminder_mails.py diff --git a/CDC_Backend/APIs/constants.py b/CDC_Backend/APIs/constants.py index 5696feb..42b2736 100644 --- a/CDC_Backend/APIs/constants.py +++ b/CDC_Backend/APIs/constants.py @@ -158,6 +158,7 @@ STUDENT_APPLICATION_SUBMITTED_TEMPLATE_SUBJECT = 'CDC - Application Submitted - STUDENT_APPLICATION_UPDATED_TEMPLATE_SUBJECT = 'CDC - Application Updated - {company_name}' COMPANY_EMAIl_VERIFICATION_TEMPLATE_SUBJECT = 'Email Verification - Career Development Cell, IIT Dharwad' NOTIFY_STUDENTS_OPENING_TEMPLATE_SUBJECT = 'Placement Opportunity at {company_name}' +REMINDER_STUDENTS_OPENING_TEMPLATE_SUBJECT = 'Reminder - Placement Opportunity at {company_name}' STUDENT_APPLICATION_SUBMITTED_TEMPLATE = 'student_application_submitted.html' COMPANY_OPENING_SUBMITTED_TEMPLATE = 'company_opening_submitted.html' @@ -167,6 +168,7 @@ STUDENT_APPLICATION_UPDATED_TEMPLATE = 'student_application_updated.html' COMPANY_EMAIL_VERIFICATION_TEMPLATE = 'company_email_verification.html' COMPANY_JNF_RESPONSE_TEMPLATE = 'company_jnf_response.html' NOTIFY_STUDENTS_OPENING_TEMPLATE = 'notify_students_new_opening.html' +REMINDER_STUDENTS_OPENING_TEMPLATE = 'students_opening_reminder.html' APPLICATION_CSV_COL_NAMES = ['Applied At', 'Roll No.', 'Name', 'Email', 'Phone Number', 'Branch', 'Batch', 'CPI', 'Resume', 'Selected', ] diff --git a/CDC_Backend/CDC_Backend/settings.py b/CDC_Backend/CDC_Backend/settings.py index c5667cf..154e430 100644 --- a/CDC_Backend/CDC_Backend/settings.py +++ b/CDC_Backend/CDC_Backend/settings.py @@ -46,6 +46,7 @@ INSTALLED_APPS = [ 'background_task', 'simple_history', 'import_export', + 'django_extensions', ] MIDDLEWARE = [ diff --git a/CDC_Backend/scripts/send_reminder_mails.py b/CDC_Backend/scripts/send_reminder_mails.py new file mode 100644 index 0000000..0048c34 --- /dev/null +++ b/CDC_Backend/scripts/send_reminder_mails.py @@ -0,0 +1,63 @@ +from APIs.models import Placement, Student, PlacementApplication, User +from APIs.utils import sendEmail, PlacementApplicationConditions +from APIs.constants import * +from django.shortcuts import get_object_or_404 +from django.utils import timezone +import time +import pytz + +REPEAT_AFTER = 10 * 60 + + +def send_reminder_mails(): + placements = Placement.objects.all() + students = Student.objects.all() + + for placement in placements.iterator(): + print("Processing placement: ", placement) + # if placement is approved and email is verified + if not (placement.offer_accepted and placement.email_verified): + continue + + # if placement is not expired + if placement.deadline_datetime < timezone.now(): + continue + + # send the reminder mail if the deadline is within 24 hours +- ReapetAfter + if timezone.now() - timezone.timedelta( + seconds=REPEAT_AFTER) <= placement.deadline_datetime - timezone.timedelta(days=1) < timezone.now() + \ + timezone.timedelta(seconds=REPEAT_AFTER): + for student in students: + try: + # if Application not found then send email + if not PlacementApplication.objects.filter(placement=placement, student=student).exists(): + if student.branch in placement.allowed_branch: + if student.degree == 'bTech' or placement.rs_eligible is True: + if PlacementApplicationConditions(student, placement)[0]: + student_user = get_object_or_404(User, id=student.id) + # change timezone to IST + deadline_datetime = placement.deadline_datetime.astimezone(pytz.timezone('Asia/Kolkata')) + data = { + "company_name": placement.company_name, + "opening_type": 'Placement', + "deadline": deadline_datetime.strftime("%A, %-d %B %Y, %-I:%M %p"), + "link": PLACEMENT_OPENING_URL.format(id=placement.id) + } + print("Sending mail to " + student_user.email, "placement id: ", placement.id) + sendEmail(student_user.email, + REMINDER_STUDENTS_OPENING_TEMPLATE_SUBJECT.format( + company_name=placement.company_name), + data, REMINDER_STUDENTS_OPENING_TEMPLATE) + + except Exception as e: + print(e) + continue + + +def run(): + while True: + print("Sleeping for", REPEAT_AFTER, "seconds") + time.sleep(REPEAT_AFTER) + print("Running send_reminder_mails()") + send_reminder_mails() + diff --git a/CDC_Backend/templates/students_opening_reminder.html b/CDC_Backend/templates/students_opening_reminder.html index 4541089..dd0b9d2 100644 --- a/CDC_Backend/templates/students_opening_reminder.html +++ b/CDC_Backend/templates/students_opening_reminder.html @@ -45,7 +45,7 @@

{{ opening_type }} Opportunity at {{ company_name }}

- Gentle reminder for the same. + Gentle reminder to fill out the application form. Interested students can apply before {{ deadline }} in the CDC-webportal.

From 653177d11ad70075e2b4db1337e1051545eacb63 Mon Sep 17 00:00:00 2001 From: karthikmurakonda Date: Sat, 8 Oct 2022 22:16:04 +0530 Subject: [PATCH 07/15] added django-extensions to requirements.txt --- requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.txt b/requirements.txt index d6465e1..efc1a43 100644 --- a/requirements.txt +++ b/requirements.txt @@ -14,6 +14,7 @@ django-background-tasks==1.2.5 django-compat==1.0.15 django-cors-headers==3.11.0 django-db-logger==0.1.12 +django-extensions==3.2.1 django-import-export==2.8.0 django-simple-history==3.1.1 djangorestframework==3.13.1 From dbc875eabfd23b3f94ce468cbb7a7753f4baf90c Mon Sep 17 00:00:00 2001 From: Gowtham Sai <66207607+gowtham3105@users.noreply.github.com> Date: Fri, 30 Dec 2022 17:30:02 +0530 Subject: [PATCH 08/15] minor fix to contributors api --- CDC_Backend/APIs/serializers.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/CDC_Backend/APIs/serializers.py b/CDC_Backend/APIs/serializers.py index ad7d9f7..bc8cbaa 100644 --- a/CDC_Backend/APIs/serializers.py +++ b/CDC_Backend/APIs/serializers.py @@ -162,7 +162,8 @@ class PlacementApplicationSerializer(serializers.ModelSerializer): return data def get_resume_link(self, obj): - ele = {'link': LINK_TO_STORAGE_RESUME + urllib.parse.quote(str(obj.student.roll_no) + "/" + obj.resume), 'name': obj.resume} + ele = {'link': LINK_TO_STORAGE_RESUME + urllib.parse.quote(str(obj.student.roll_no) + "/" + obj.resume), + 'name': obj.resume} return ele class Meta: @@ -186,6 +187,8 @@ class PlacementApplicationSerializerForAdmin(serializers.ModelSerializer): model = PlacementApplication exclude = ['placement', 'resume'] + class ContributorSerializer(serializers.ModelSerializer): class Meta: - model = Contributor \ No newline at end of file + model = Contributor + fields = '__all__' From b94d63febe3e4f5ddcb14a666e2b21744d962cb6 Mon Sep 17 00:00:00 2001 From: karthik mv Date: Tue, 2 May 2023 00:49:01 +0530 Subject: [PATCH 09/15] Update postgres.md --- doc/setup/postgres.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/setup/postgres.md b/doc/setup/postgres.md index d3dba5e..8941fa6 100644 --- a/doc/setup/postgres.md +++ b/doc/setup/postgres.md @@ -1,6 +1,6 @@ typical conf file for pg_hba.conf for dev work. - +``` # TYPE DATABASE USER ADDRESS METHOD # "local" is for Unix domain socket connections only @@ -13,4 +13,5 @@ host all all ::1/128 md5 # replication privilege. local replication all peer host replication all 127.0.0.1/32 ident -host replication all ::1/128 ident \ No newline at end of file +host replication all ::1/128 ident +``` From adc33a2430eca9b877b80563318b400b68d85f92 Mon Sep 17 00:00:00 2001 From: karthikmurakonda Date: Tue, 30 May 2023 15:00:02 +0530 Subject: [PATCH 10/15] make corrections to pr --- README.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 21b39b1..5c37318 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ python# CDC - Backend ### Setup 1. Download the Repository to your local machine
-2. Make Sour u have downloaded python from python.org +2. Make Sure u have downloaded python from python.org or windows store. 3. Create a Virtual Environment in the [CDC_Backend](./) folder with this command below
`python -m venv venv` 3. Activate the environment with this command
@@ -14,14 +14,15 @@ python# CDC - Backend `pip install -r requirements.txt ` 5. Ensure that you have the PostgreSQL installed on your machine and is running on PORT **5432**
6. Make sure to give the correct database credentials in [settings.py](./CDC_Backend/CDC_Backend/settings.py) -7. Run these following commands .. -8. cd CDC_Backend +7. Run these following commands below. (The same are there in setup.sh for linux users and setup.bat for windows users) +```cd CDC_Backend python manage.py flush --no-input python manage.py makemigrations python manage.py migrate python manage.py collectstatic --noinput mkdir Storage python manage.py makemigrations APIs +``` ### Running the Application @@ -40,7 +41,7 @@ python manage.py makemigrations APIs 4. Set up the Username and Password 5. You can log in and change the database values anytime. 6. Create your id as insitute Roll No for both admin and student . -7.if u are still getting an error ,open inspect and see in network +7. if you are still getting an error ,open inspect and see in network And then recognize it 8.Check the client link in dev.env in backend and .env in frontend is the same From 196dec66ee73be6221d3f73d16d4f1c63de1eeb0 Mon Sep 17 00:00:00 2001 From: Jaya Surya Date: Fri, 2 Jun 2023 22:44:07 +0530 Subject: [PATCH 11/15] autoFill JNF draft --- .DS_Store | Bin 6148 -> 8196 bytes CDC_Backend/.DS_Store | Bin 6148 -> 8196 bytes CDC_Backend/APIs/companyUrls.py | 1 + CDC_Backend/APIs/companyViews.py | 24 +++++++++++++++++++++++- CDC_Backend/APIs/constants.py | 3 +-- CDC_Backend/APIs/serializers.py | 12 ++++++++---- CDC_Backend/APIs/utils.py | 2 ++ CDC_Backend/CDC_Backend/settings.py | 4 +--- 8 files changed, 36 insertions(+), 10 deletions(-) diff --git a/.DS_Store b/.DS_Store index 4808ac220db1f705b679c3ca55b540e1421db6fa..b4c80e42b4f70ae56b414c81b32c47570ccce153 100644 GIT binary patch literal 8196 zcmeHMJ#Q015S_IhI46p5!AF`%mLj^y!~zl|gycAOK|vEoPyjk?pK*?yZ;gG9Bce#I zp+Tajp+iDcNc;c_{s7c8`~f;Dc(Z%4&SxL#5DL4}?(E0B-PyOZcb+p5iSocH5-kyt zh0HRyfMQ1Can4gI74|S#08h6)*=%^Sfp%_6+jJNP3GHFz_!hfOj@0E8)Gb zM@?xMFbw>c4DjNoXjfhKex6 z5MksXG#ullP=BPQhLcb$W1etj5k@E?3_L_$sgo#aX-dO@VPKj8j@>g|4{kF^Ng__>HKlLyBnGN@=IP~ z{@6a)*e0JO^{5rI^*!{Ww$1_Ll0z-3Pim&x(0m=))dFo%1=*%D)u~B)!1&}$qQr7+ z{sdHG*zbnB|JdkyZa-LC`zliD%-or?mSrti4{N(}SPSaGpkJ={?sIELO0RKTuQ%?x zt)ZPeza{;k?)t5s0=P~KDi7|tz9WZaIq;pn!q)VFmCa`D+|uD;@!D$sdU5?|HGf!K z+qi+o`qiVOtaV}K%FS(i&+GW|Id+01!UriW>h`#Nfm*`uCeHoV=O4+MQ7?G2VZVE; zy&z%Us85`%J>enMZ)|wNy!*AD?@6CeoOgR}_DRE2p21hTu@h$=q8^ooH%V&7w0_34 zE>V>_@FSNzcvK(0)T4d0nyA^djnPeb+a1UP^kQD7d^5V{JUo$arcVdZZ(@C)9#2}3 z`VzAsd(tZDtr#N5_lcg;04s5=gX~iP>kB9kWTmmpNr2iI@cm}*it^3fwH4F+iJmQ8%3gNl40P~ zFp$pJ=n*9C$)a=)6#4unOm}Wp^Dz!=({l`BE<0>3$=aC;Fb7H-bmI{JGh2xMa i9ETkLVTgJjs*EXxa-=1CkpB9I0Q3G=yqn_xX5cs2a%sW< delta 459 zcmZp1XfcprU|?W$DortDU=RQ@Ie-{Mvv5r;6q~50C@2Jy2Z`mR8wMxm=N4=%T+PfV zG}%O;x}KFmk0FyGg&~z85he>%4b=Q}29QLO&CPdlNy^Dj0*Z1p1#t=PcRAvSt|Eni zih>M?{Xl&{vo`>V$xedG!rPMyax#lc3=FO@GBLBTvaxfpPp%M**5crd7Z9(mHZ?HQ zQLr$r)lsOnG%^4(EsSexIXOg?^{s>AvvYFu@;fL06O?D{n(QDbHQ7RFe?1FB8PG#{ z3}wh(V(NQt4YUz1hwP!JdUG%ILOg^dkMIsQd1TKpmo@;6hJlGS=N7Yba0oI(1O&K& gv@0k+HWq$op3E=f35p#CCP++yB9CEnJkK0v0Hv5^&Hw-a diff --git a/CDC_Backend/.DS_Store b/CDC_Backend/.DS_Store index e1c33581097261a6347d20399bf80d77b0ff90e3..7f94099c4577cb0d3b65a1ddf7022978a9c0cc7e 100644 GIT binary patch literal 8196 zcmeHM&u1+)VHr2_nZ zFp(JR3CJK!z0$5LQrVuqSp{PJb70D4pBqs-<=xDDe@iT>r zPD1vK>m)skIElJK?X?10fmH?g?4G3qdP+wWrOxjMXe<4YCW-SnXB-WZ zbN&}+;CoSQS>HrvBYW+7&M=IE@w(j$$L-jTM^VEbzU0!gF!Y^YdE0sJb;q6Jt!5a+ zwik4VlHj>rguHs;1#UQQgrmTXB)6>^jC?-dDQ-?C<=ri_Qm#(7%t_hWtD#WcnNIV@ z?R$?NA9v3Eeh_|8Qx(bUf^Mqv+x2pOePhpx@FcXtkwRug={S?)q6|?wpJ>Za?RvY!gU~) zPo9)3hI|onCp3iT(mqwFN;TRci?;FMa)oy3q0C#<2Xlz{GNK0LQV*#@XS9b>5B>sa zgvId4p%A6;I7BEi6Rg&dCnRFjLKLFZjMrh+YHm=?UYe4T(48EzB8OL;phpR40cB=uF+|@5(^Db{9y+LB* nxS2vpfm`|_fb#qgL*z|_GN+#4Od)Du`iB51gLYbhzpB7bu+I}> delta 137 zcmZp1XfcprU|?W$DortDU=RQ@Ie-{MGjUEV6q~50D9Qwq2a7o|Br+s3WHY2Pr!8aRAzOpQ4=im@z2C4=E0d64S3NmG5;dkcA{4$OpYe43(fM}qZ OAbY@Ko8x)rFarPy>J@qb diff --git a/CDC_Backend/APIs/companyUrls.py b/CDC_Backend/APIs/companyUrls.py index 4db1c55..e09de52 100644 --- a/CDC_Backend/APIs/companyUrls.py +++ b/CDC_Backend/APIs/companyUrls.py @@ -5,4 +5,5 @@ from . import companyViews urlpatterns = [ path('addPlacement/', companyViews.addPlacement, name="Add Placement"), path('verifyEmail/', companyViews.verifyEmail, name="Verify Email"), + path('getAutoFillJnf/', companyViews.autoFillJnf, name="Auto FIll JNF"), ] diff --git a/CDC_Backend/APIs/companyViews.py b/CDC_Backend/APIs/companyViews.py index 77d228e..ec01f0a 100644 --- a/CDC_Backend/APIs/companyViews.py +++ b/CDC_Backend/APIs/companyViews.py @@ -1,6 +1,7 @@ from rest_framework.decorators import api_view from .utils import * +from .serializers import * logger = logging.getLogger('db') @@ -283,7 +284,8 @@ def verifyEmail(request): "opening_type": PLACEMENT, "company_name": opening.company_name, } - sendEmail([opening.email, CDC_MAIl_ADDRESS], COMPANY_OPENING_SUBMITTED_TEMPLATE_SUBJECT.format(id=opening.id), data, + sendEmail([opening.email, CDC_MAIl_ADDRESS], + COMPANY_OPENING_SUBMITTED_TEMPLATE_SUBJECT.format(id=opening.id), data, COMPANY_OPENING_SUBMITTED_TEMPLATE, attachment_jnf_respone) return Response({'action': "Verify Email", 'message': "Email Verified Successfully"}, @@ -298,3 +300,23 @@ def verifyEmail(request): logger.warning("Verify Email: " + str(sys.exc_info())) return Response({'action': "Verify Email", 'message': "Something went wrong"}, status=status.HTTP_400_BAD_REQUEST) + + +@api_view(['GET']) +@precheck([PLACEMENT_ID]) +def autoFillJnf(request): + try: + data = request.GET + placement_id = data.get(PLACEMENT_ID) + opening = get_object_or_404(Placement, id=placement_id) + serializer = AutofillSerializers(opening) + return Response({'action': "Get AutoFill", 'message': 'Data Found', 'placement_data': serializer.data}, + status=status.HTTP_200_OK) + except Http404: + return Response({'action': "Get AutoFill", 'message': 'Placement Not Found'}, + status=status.HTTP_404_NOT_FOUND) + except Exception as e: + traceback_str = traceback.format_exc() + logger.warning("Get AutoFill: " + traceback_str) + return Response({'action': "Get AutoFill", 'message': "Something went wrong"}, + status=status.HTTP_400_BAD_REQUEST) diff --git a/CDC_Backend/APIs/constants.py b/CDC_Backend/APIs/constants.py index 42b2736..cf3d50a 100644 --- a/CDC_Backend/APIs/constants.py +++ b/CDC_Backend/APIs/constants.py @@ -90,6 +90,7 @@ FIELD = "field" STATUS_ACCEPTING_APPLICATIONS = "Accepting Applications" PLACEMENT = "Placement" +PLACEMENT_ID = "placement_id" COMPANY_NAME = "company_name" ADDRESS = "address" @@ -158,7 +159,6 @@ STUDENT_APPLICATION_SUBMITTED_TEMPLATE_SUBJECT = 'CDC - Application Submitted - STUDENT_APPLICATION_UPDATED_TEMPLATE_SUBJECT = 'CDC - Application Updated - {company_name}' COMPANY_EMAIl_VERIFICATION_TEMPLATE_SUBJECT = 'Email Verification - Career Development Cell, IIT Dharwad' NOTIFY_STUDENTS_OPENING_TEMPLATE_SUBJECT = 'Placement Opportunity at {company_name}' -REMINDER_STUDENTS_OPENING_TEMPLATE_SUBJECT = 'Reminder - Placement Opportunity at {company_name}' STUDENT_APPLICATION_SUBMITTED_TEMPLATE = 'student_application_submitted.html' COMPANY_OPENING_SUBMITTED_TEMPLATE = 'company_opening_submitted.html' @@ -168,7 +168,6 @@ STUDENT_APPLICATION_UPDATED_TEMPLATE = 'student_application_updated.html' COMPANY_EMAIL_VERIFICATION_TEMPLATE = 'company_email_verification.html' COMPANY_JNF_RESPONSE_TEMPLATE = 'company_jnf_response.html' NOTIFY_STUDENTS_OPENING_TEMPLATE = 'notify_students_new_opening.html' -REMINDER_STUDENTS_OPENING_TEMPLATE = 'students_opening_reminder.html' APPLICATION_CSV_COL_NAMES = ['Applied At', 'Roll No.', 'Name', 'Email', 'Phone Number', 'Branch', 'Batch', 'CPI', 'Resume', 'Selected', ] diff --git a/CDC_Backend/APIs/serializers.py b/CDC_Backend/APIs/serializers.py index bc8cbaa..19d94bc 100644 --- a/CDC_Backend/APIs/serializers.py +++ b/CDC_Backend/APIs/serializers.py @@ -162,8 +162,7 @@ class PlacementApplicationSerializer(serializers.ModelSerializer): return data def get_resume_link(self, obj): - ele = {'link': LINK_TO_STORAGE_RESUME + urllib.parse.quote(str(obj.student.roll_no) + "/" + obj.resume), - 'name': obj.resume} + ele = {'link': LINK_TO_STORAGE_RESUME + urllib.parse.quote(str(obj.student.roll_no) + "/" + obj.resume), 'name': obj.resume} return ele class Meta: @@ -187,8 +186,13 @@ class PlacementApplicationSerializerForAdmin(serializers.ModelSerializer): model = PlacementApplication exclude = ['placement', 'resume'] - class ContributorSerializer(serializers.ModelSerializer): class Meta: model = Contributor - fields = '__all__' + + + +class AutofillSerializers(serializers.ModelSerializer): + class Meta: + model = Placement + fields = '__all__' \ No newline at end of file diff --git a/CDC_Backend/APIs/utils.py b/CDC_Backend/APIs/utils.py index be57175..4d037d2 100644 --- a/CDC_Backend/APIs/utils.py +++ b/CDC_Backend/APIs/utils.py @@ -267,6 +267,8 @@ def verify_recaptcha(request): } r = rq.post('https://www.google.com/recaptcha/api/siteverify', data=data) result = r.json() + # print + print(result) if not result['success']: logger.warning("Utils - verify_recaptcha: " + str(result)) return result['success'] diff --git a/CDC_Backend/CDC_Backend/settings.py b/CDC_Backend/CDC_Backend/settings.py index 9b2ee68..1fbc012 100644 --- a/CDC_Backend/CDC_Backend/settings.py +++ b/CDC_Backend/CDC_Backend/settings.py @@ -47,9 +47,7 @@ INSTALLED_APPS = [ 'background_task', 'simple_history', 'import_export', - 'django_extensions', - "django_extensions" - + 'django_extensions' ] MIDDLEWARE = [ From f678c47f014f70c674244488a5ee759ad62426a2 Mon Sep 17 00:00:00 2001 From: Jaya Surya P <99060910+JayaSurya-27@users.noreply.github.com> Date: Mon, 5 Jun 2023 20:52:10 +0530 Subject: [PATCH 12/15] Update constants.py --- CDC_Backend/APIs/constants.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CDC_Backend/APIs/constants.py b/CDC_Backend/APIs/constants.py index cf3d50a..bf5b7e8 100644 --- a/CDC_Backend/APIs/constants.py +++ b/CDC_Backend/APIs/constants.py @@ -159,7 +159,7 @@ STUDENT_APPLICATION_SUBMITTED_TEMPLATE_SUBJECT = 'CDC - Application Submitted - STUDENT_APPLICATION_UPDATED_TEMPLATE_SUBJECT = 'CDC - Application Updated - {company_name}' COMPANY_EMAIl_VERIFICATION_TEMPLATE_SUBJECT = 'Email Verification - Career Development Cell, IIT Dharwad' NOTIFY_STUDENTS_OPENING_TEMPLATE_SUBJECT = 'Placement Opportunity at {company_name}' - +REMINDER_STUDENTS_OPENING_TEMPLATE_SUBJECT = 'Reminder - Placement Opportunity at {company_name}' STUDENT_APPLICATION_SUBMITTED_TEMPLATE = 'student_application_submitted.html' COMPANY_OPENING_SUBMITTED_TEMPLATE = 'company_opening_submitted.html' STUDENT_APPLICATION_STATUS_SELECTED_TEMPLATE = 'student_application_status_selected.html' @@ -168,7 +168,7 @@ STUDENT_APPLICATION_UPDATED_TEMPLATE = 'student_application_updated.html' COMPANY_EMAIL_VERIFICATION_TEMPLATE = 'company_email_verification.html' COMPANY_JNF_RESPONSE_TEMPLATE = 'company_jnf_response.html' NOTIFY_STUDENTS_OPENING_TEMPLATE = 'notify_students_new_opening.html' - +REMINDER_STUDENTS_OPENING_TEMPLATE = 'students_opening_reminder.html' APPLICATION_CSV_COL_NAMES = ['Applied At', 'Roll No.', 'Name', 'Email', 'Phone Number', 'Branch', 'Batch', 'CPI', 'Resume', 'Selected', ] From 0c831f823533b5e8eda64bb574080e71da4c177f Mon Sep 17 00:00:00 2001 From: Jaya Surya P <99060910+JayaSurya-27@users.noreply.github.com> Date: Mon, 5 Jun 2023 20:53:26 +0530 Subject: [PATCH 13/15] Update utils.py --- CDC_Backend/APIs/utils.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/CDC_Backend/APIs/utils.py b/CDC_Backend/APIs/utils.py index 4d037d2..be57175 100644 --- a/CDC_Backend/APIs/utils.py +++ b/CDC_Backend/APIs/utils.py @@ -267,8 +267,6 @@ def verify_recaptcha(request): } r = rq.post('https://www.google.com/recaptcha/api/siteverify', data=data) result = r.json() - # print - print(result) if not result['success']: logger.warning("Utils - verify_recaptcha: " + str(result)) return result['success'] From 8f763a1f05baad76a1404fafe856b56748847a0f Mon Sep 17 00:00:00 2001 From: Jaya Surya P <99060910+JayaSurya-27@users.noreply.github.com> Date: Tue, 6 Jun 2023 16:59:12 +0530 Subject: [PATCH 14/15] Update utils.py --- CDC_Backend/APIs/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CDC_Backend/APIs/utils.py b/CDC_Backend/APIs/utils.py index be57175..3d64768 100644 --- a/CDC_Backend/APIs/utils.py +++ b/CDC_Backend/APIs/utils.py @@ -285,7 +285,7 @@ def opening_description_table_html(opening): else: # if isinstance(opening, QueryDict): details = opening keys = list(details.keys()) - newdetails = {} + newdetails = {"ID": opening.id} for key in keys: if isinstance(details[key], list): details[key] = {"details": details[key], "type": ["list"]} From 5a51147f31a08bd00ac2405200cade2603b79a04 Mon Sep 17 00:00:00 2001 From: karthikmurakonda Date: Tue, 6 Jun 2023 23:07:24 +0530 Subject: [PATCH 15/15] changed admins email. --- CDC_Backend/CDC_Backend/settings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CDC_Backend/CDC_Backend/settings.py b/CDC_Backend/CDC_Backend/settings.py index 1fbc012..7df7fc3 100644 --- a/CDC_Backend/CDC_Backend/settings.py +++ b/CDC_Backend/CDC_Backend/settings.py @@ -30,7 +30,7 @@ DEBUG = os.environ.get('DEBUG') == "True" ALLOWED_HOSTS = ['cdc.iitdh.ac.in', 'localhost'] -ADMINS = [('Gowtham Sai', '190010036@iitdh.ac.in'), ('Karthik Mv', '200010030@iitdh.ac.in')] +ADMINS = [ ('Karthik Mv', '200010030@iitdh.ac.in')] # Application definition INSTALLED_APPS = [