Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added migrations to git #182

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
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
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,6 @@ dmypy.json
./CDC_Backend/Storage
/CDC_Backend/CDC_Backend/__pycache__/
/CDC_Backend/APIs/__pycache__/
/CDC_Backend/APIs/migrations/
/CDC_Backend/internAPIs/__pycache__/
/CDC_Backend/internAPIs/migrations/
/CDC_Backend/static/
/CDC_Backend/Storage/
.idea
Expand Down
6 changes: 3 additions & 3 deletions CDC_Backend/APIs/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,20 +64,20 @@ class StudentAdmin(ImportExportMixin, SimpleHistoryAdmin):

@admin.register(Student)
class Student(StudentAdmin):
list_display = ("roll_no", "name", "batch", "branch", "phone_number", 'can_apply')
list_display = ("roll_no", "name", "batch", "branch", "phone_number", 'can_apply_placements')
search_fields = ("roll_no", "name", "phone_number")
ordering = ("roll_no", "name", "batch", "branch", "phone_number")
list_filter = ("batch", "branch")
actions = ['mark_can_apply_as_no', 'mark_can_apply_as_yes']

@admin.action(description="Deregister students")
def mark_can_apply_as_no(self, request, queryset):
queryset.update(can_apply=False)
queryset.update(can_apply_placements=False)
self.message_user(request, "Deregistered the users")

@admin.action(description="Register students")
def mark_can_apply_as_yes(self, request, queryset):
queryset.update(can_apply=True)
queryset.update(can_apply_placements=True)
self.message_user(request, "Registered the users")

class PlacementResources(resources.ModelResource):
Expand Down
1 change: 1 addition & 0 deletions CDC_Backend/APIs/adminViews.py
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,7 @@ def generateCSV(request, id, email, user_type):
row_details.append(apl.student.phone_number)
row_details.append(apl.student.branch)
row_details.append(apl.student.batch)
row_details.append(apl.student.degree)
row_details.append(apl.student.cpi)
link = LINK_TO_STORAGE_RESUME + urllib.parse.quote(str(apl.student.id)) + "/" + urllib.parse.quote(str(apl.resume))
row_details.append(link)
Expand Down
38 changes: 18 additions & 20 deletions CDC_Backend/APIs/companyViews.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@
IS_COMPANY_DETAILS_PDF, CONTACT_PERSON_NAME, PHONE_NUMBER, EMAIL, CITY, STATE, COUNTRY, PINCODE, DESIGNATION,
DESCRIPTION,
IS_DESCRIPTION_PDF, COMPENSATION_CTC, COMPENSATION_GROSS, COMPENSATION_TAKE_HOME, COMPENSATION_BONUS,
IS_COMPENSATION_DETAILS_PDF, ALLOWED_BRANCH, RS_ELIGIBLE, SELECTION_PROCEDURE_ROUNDS,
SELECTION_PROCEDURE_DETAILS,
IS_COMPENSATION_DETAILS_PDF, BTECH_ALLOWED, MTECH_ALLOWED, MS_ALLOWED, PHD_ALLOWED,
BTECH_BRANCH, MTECH_BRANCH, MS_BRANCH, PHD_BRANCH,
SELECTION_PROCEDURE_ROUNDS, SELECTION_PROCEDURE_DETAILS,
IS_SELECTION_PROCEDURE_DETAILS_PDF, TENTATIVE_DATE_OF_JOINING, TENTATIVE_NO_OF_OFFERS, OTHER_REQUIREMENTS,
RECAPTCHA_VALUE, JOB_LOCATION
JOB_LOCATION
])
def addPlacement(request):
logger.info("JNF filled by " + str(request.data['email']))
Expand All @@ -23,8 +24,6 @@ def addPlacement(request):
data = request.data
files = request.FILES
opening = Placement()
if not verify_recaptcha(data[RECAPTCHA_VALUE]):
raise Exception("Recaptcha Failed")

opening.id = generateRandomString()
# Add a company details in the opening
Expand All @@ -36,10 +35,6 @@ def addPlacement(request):
opening.website = data[WEBSITE]
opening.company_details = data[COMPANY_DETAILS]
opening.is_company_details_pdf = data[IS_COMPANY_DETAILS_PDF]
if data[RS_ELIGIBLE] == 'Yes':
opening.rs_eligible = True
else:
opening.rs_eligible = False

if opening.is_company_details_pdf:
company_details_pdf = []
Expand Down Expand Up @@ -198,13 +193,19 @@ def addPlacement(request):

# Only Allowing Fourth Year for Placement
opening.allowed_batch = [FOURTH_YEAR,]
# Check if allowed_branch are valid
if data[ALLOWED_BRANCH] is None:
raise ValueError('Allowed Branch cannot be empty')
elif set(json.loads(data[ALLOWED_BRANCH])).issubset(BRANCHES):
opening.allowed_branch = json.loads(data[ALLOWED_BRANCH])
else:
raise ValueError('Allowed Branch must be a subset of ' + str(BRANCHES))
opening.btech_allowed = data[BTECH_ALLOWED] == "true"
opening.mtech_allowed = data[MTECH_ALLOWED] == "true"
opening.ms_allowed = data[MS_ALLOWED] == "true"
opening.phd_allowed = data[PHD_ALLOWED] == "true"

if opening.btech_allowed:
opening.btech_allowed_branch = json.loads(data[BTECH_BRANCH])
if opening.mtech_allowed:
opening.mtech_allowed_branch = json.loads(data[MTECH_BRANCH])
if opening.ms_allowed:
opening.ms_allowed_branch = json.loads(data[MS_BRANCH])
if opening.phd_allowed:
opening.phd_allowed_branch = json.loads(data[PHD_BRANCH])

# Check if tentative_no_of_offers is integer
if data[TENTATIVE_NO_OF_OFFERS].isdigit():
Expand Down Expand Up @@ -352,17 +353,14 @@ def autoFillInf(request):
ALLOWED_BRANCH, SOPHOMORES_ELIIGIBLE, RS_ELIGIBLE, NUM_OFFERS, IS_STIPEND_DETAILS_PDF, STIPEND,
FACILITIES, OTHER_FACILITIES, SELECTION_PROCEDURE_ROUNDS, SELECTION_PROCEDURE_DETAILS, IS_SELECTION_PROCEDURE_DETAILS_PDF,
SELECTION_PROCEDURE_DETAILS, OTHER_REQUIREMENTS,
CONTACT_PERSON_NAME, PHONE_NUMBER, EMAIL, RECAPTCHA_VALUE])
CONTACT_PERSON_NAME, PHONE_NUMBER, EMAIL])
def addInternship(request):
logger.info("INF filled by " + str(request.data['email']))
logger.info(request.data)
try:
data = request.data
files = request.FILES
internship = Internship()
if not verify_recaptcha(data[RECAPTCHA_VALUE]):
raise Exception("Recaptcha Failed")

internship.id = generateRandomString()
# Add a company details in the internship
internship.company_name = data[COMPANY_NAME]
Expand Down
12 changes: 10 additions & 2 deletions CDC_Backend/APIs/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,15 @@
COMPENSATION_DETAILS_PDF_NAMES = 'compensation_details_pdf_names'
IS_COMPENSATION_DETAILS_PDF = 'is_compensation_details_pdf'
ALLOWED_BATCH = 'allowed_batch'
ALLOWED_BRANCH = 'allowed_branch'
BTECH_ALLOWED = 'btech_allowed'
MTECH_ALLOWED = 'mtech_allowed'
MS_ALLOWED = 'ms_allowed'
PHD_ALLOWED = 'phd_allowed'
BTECH_BRANCH = 'btech_branches'
MTECH_BRANCH = 'mtech_branches'
MS_BRANCH = 'ms_branches'
PHD_BRANCH = 'phd_branches'
ALLOWED_BRANCH = 'allowed_batch'
RS_ELIGIBLE = 'rs_eligible'
BOND_DETAILS = 'bond_details'
SELECTION_PROCEDURE_ROUNDS = 'selection_procedure_rounds'
Expand Down Expand Up @@ -208,7 +216,7 @@
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',
APPLICATION_CSV_COL_NAMES = ['Applied At', 'Roll No.', 'Name', 'Email', 'Phone Number', 'Branch', 'Batch', 'Degree', 'CPI',
'Resume', 'Selected', ]


Expand Down
Loading
Loading