Withdraw application (#142)

* Prod Changes (#135)

* bug fixes

* merge conlicts resolve

* minor bug fixes

* Send email to cdc on new opening.

* added email option while  jnf submission error

* Send alert email to cdc when error while submitting jnf by company

* fixing debug issue in setting

* setting offerAccepted to only superAdmins

* remove dev.env from git

* changed role to su

-cant give a person 3 roles (student,super_admin,admin) because of varchar(10) given earlier

* changing to s_admin

* added admin view for User modal

* withDraw Application api

Co-authored-by: karthik mv <karthik.murakonda14@gmail.com>
This commit is contained in:
Gowtham Sai 2022-09-12 11:26:09 +05:30 committed by GitHub
parent 898539cde2
commit 290639c032
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 42 additions and 0 deletions

View File

@ -60,6 +60,7 @@ def model_admin_url(obj, name=None) -> str:
class StudentAdmin(ImportExportMixin, SimpleHistoryAdmin):
pass
@admin.register(Student)
class Student(StudentAdmin):
list_display = ("roll_no", "name", "batch", "branch", "phone_number", 'can_apply')
@ -98,6 +99,17 @@ class AdminAdmin(ExportMixin, SimpleHistoryAdmin):
resource_class = PlacementResources
class PlacementResources(resources.ModelResource):
class Meta:
model = Placement
exclude = ('id', 'changed_by', 'is_company_details_pdf', 'is_description_pdf',
'is_compensation_details_pdf', 'is_selection_procedure_details_pdf')
class AdminAdmin(ExportMixin, SimpleHistoryAdmin):
resource_class = PlacementResources
@admin.register(Placement)
class Placement(AdminAdmin):
list_display = (COMPANY_NAME, CONTACT_PERSON_NAME, PHONE_NUMBER, 'tier', 'compensation_CTC')
@ -111,6 +123,7 @@ class PlacementApplicationResources(resources.ModelResource):
model = PlacementApplication
exclude = ('id', 'changed_by')
class PlacementAdmin(ExportMixin, SimpleHistoryAdmin):
resource_class = PlacementApplicationResources
@ -134,6 +147,7 @@ class PrePlacementResources(resources.ModelResource):
model = PrePlacementOffer
exclude = ('id', 'changed_by')
class PrePlacementOfferAdmin(ExportMixin, SimpleHistoryAdmin):
resource_class = PrePlacementResources

View File

@ -9,4 +9,5 @@ urlpatterns = [
path("addResume/", studentViews.addResume, name="Upload Resume"),
path("deleteResume/", studentViews.deleteResume, name="Upload Resume"),
path("submitApplication/", studentViews.submitApplication, name="Submit Application"),
path("deleteApplication/", studentViews.deleteApplication, name="Delete Application"),
]

View File

@ -204,3 +204,30 @@ def submitApplication(request, id, email, user_type):
return Response({'action': "Submit Application", 'message': "Something Went Wrong"},
status=status.HTTP_400_BAD_REQUEST)
@api_view(['POST'])
@isAuthorized(allowed_users=[STUDENT])
@precheck(required_data=[APPLICATION_ID])
def deleteApplication(request, id, email, user_type):
try:
data = request.data
application = get_object_or_404(PlacementApplication, id=data[APPLICATION_ID],
student_id=id)
if application.placement.deadline_datetime < timezone.now():
raise PermissionError("Deadline Passed")
application.delete()
return Response({'action': "Delete Application", 'message': "Application Deleted"},
status=status.HTTP_200_OK)
except Http404 as e:
return Response({'action': "Delete Application", 'message': str(e)},
status=status.HTTP_404_NOT_FOUND)
except PermissionError as e:
return Response({'action': "Delete Application", 'message': str(e)},
status=status.HTTP_403_FORBIDDEN)
except:
logger.warning("Delete Application: " + str(sys.exc_info()))
return Response({'action': "Delete Application", 'message': "Something Went Wrong"},
status=status.HTTP_400_BAD_REQUEST)