Commit b4193374 authored by KUNAL GOYAL's avatar KUNAL GOYAL

update, delete applicant

parent 787c83d5
{% extends "allocation/admin1.html" %}
{% load i18n admin_urls static admin_list %}
{% block breadcrumbs %}
<div class="breadcrumbs">
<a href="{% url 'allocation:admin1' %}">{% trans 'Home' %}</a>
&rsaquo; <a href="{% url 'allocation:applicant_list' %}">{% trans 'Applicants' %}</a>
&rsaquo; {{ applicant.name }}
</div>
{% endblock %}
{% block content %}
{% if applicant.institute.name == request.user.username %}
<form action="" method="post">{% csrf_token %}
<p>Are you sure you want to delete "{{ object }}"?</p>
<input type="submit" value="Confirm" />
</form>
{% else %}
Unauthorised access
{% endif %}
{% endblock %}
...@@ -15,6 +15,12 @@ ...@@ -15,6 +15,12 @@
{% for choice in applicant.alloted_choice.all %} {% for choice in applicant.alloted_choice.all %}
{{choice}} {{choice}}
{% endfor %} {% endfor %}
<form action="{% url 'allocation:applicant-update' applicant.pk %}">
<input type="submit" value="Update" />
</form>
<form action="{% url 'allocation:applicant-delete' applicant.pk %}">
<input style="background-color: red;" type="submit" value="Delete" />
</form>
{% else %} {% else %}
Unauthorised access Unauthorised access
{% endif %} {% endif %}
......
{% extends "allocation/admin1.html" %}
{% load i18n admin_urls static admin_list %}
{% block breadcrumbs %}
<div class="breadcrumbs">
<a href="{% url 'allocation:admin1' %}">{% trans 'Home' %}</a>
&rsaquo; <a href="{% url 'allocation:applicant_list' %}">{% trans 'Applicants' %}</a>
&rsaquo; {{ applicant.name }}
</div>
{% endblock %}
{% block content %}
{% if applicant.institute.name == request.user.username %}
<form action="" method="post">{% csrf_token %}
{{ form.as_p }}
<input type="submit" value="Update" />
</form>
{% else %}
Unauthorised access
{% endif %}
{% endblock %}
...@@ -15,6 +15,8 @@ urlpatterns = [ ...@@ -15,6 +15,8 @@ urlpatterns = [
url(r'^choice/create$', views.ChoiceCreateView.as_view(), name='choice-create'), url(r'^choice/create$', views.ChoiceCreateView.as_view(), name='choice-create'),
url(r'^choice/(?P<pk>\d+)/update$', views.ChoiceUpdate.as_view(), name='choice-update'), url(r'^choice/(?P<pk>\d+)/update$', views.ChoiceUpdate.as_view(), name='choice-update'),
url(r'^choice/(?P<pk>\d+)/delete$', views.ChoiceDelete.as_view(), name='choice-delete'), url(r'^choice/(?P<pk>\d+)/delete$', views.ChoiceDelete.as_view(), name='choice-delete'),
url(r'^applicant/(?P<pk>\d+)/update$', views.ApplicantUpdate.as_view(), name='applicant-update'),
url(r'^applicant/(?P<pk>\d+)/delete$', views.ApplicantDelete.as_view(), name='applicant-delete'),
url(r'^choice_make$', views.choice_make, name='choice_make'), url(r'^choice_make$', views.choice_make, name='choice_make'),
url(r'^applicant_make$', views.applicant_make, name='applicant_make'), url(r'^applicant_make$', views.applicant_make, name='applicant_make'),
url(r'^button_action$', views.button_action, name='button_action'), url(r'^button_action$', views.button_action, name='button_action'),
......
...@@ -191,5 +191,15 @@ class ChoiceDelete(DeleteView): ...@@ -191,5 +191,15 @@ class ChoiceDelete(DeleteView):
model = Choice model = Choice
success_url = reverse_lazy('allocation:choice_list') success_url = reverse_lazy('allocation:choice_list')
class ApplicantUpdate(UpdateView):
model = Applicant
fields = ['name','rank']
template_name_suffix = '_update'
success_url = reverse_lazy('allocation:applicant_list')
class ApplicantDelete(DeleteView):
model = Applicant
success_url = reverse_lazy('allocation:applicant_list')
No preview for this file type
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment