Commit 67cd18ef authored by KUNAL GOYAL's avatar KUNAL GOYAL

institute login changes

parent d98cf560
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
<<<<<<< HEAD # Generated by Django 1.11.5 on 2017-10-21 10:18
# Generated by Django 1.11.5 on 2017-10-21 06:24
=======
# Generated by Django 1.11.5 on 2017-10-17 06:12
>>>>>>> 0d4055356852c072dfd6fd78966f4318a0d032bd
from __future__ import unicode_literals from __future__ import unicode_literals
from django.db import migrations, models from django.db import migrations, models
......
...@@ -9,9 +9,9 @@ ...@@ -9,9 +9,9 @@
{% endblock %} {% endblock %}
{% block content %} {% block content %}
{% if applicant.institute.name == request.user.username %} {% if applicant.institute.name == request.user.username %}
<p>Name: {{ applicant.name }}</p> <p><b>Name:</b> {{ applicant.name }}</p>
<p>Rank: {{ applicant.rank }}</p> <p><b>Rank:</b> {{ applicant.rank }}</p>
<p>Alloted Choice: {{ applicant.alloted_choice }} <p><b>Allotted Choice:</b> {{ applicant.alloted_choice }}
{% 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:choice_list' %}">{% trans 'Choices' %}</a>
&rsaquo; {{ choice.choice_name }}
</div>
{% endblock %}
{% block content %}
{% if choice.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 %}
...@@ -9,8 +9,14 @@ ...@@ -9,8 +9,14 @@
{% endblock %} {% endblock %}
{% block content %} {% block content %}
{% if choice.institute.name == request.user.username %} {% if choice.institute.name == request.user.username %}
<p>{{ choice.choice_name }}</p> <p><b>Choice name:</b> {{ choice.choice_name }}</p>
<p>Capacity: {{ choice.capacity }}</p> <p><b>Capacity:</b> {{ choice.capacity }}</p>
<form action="{% url 'allocation:choice-update' choice.pk %}">
<input type="submit" value="Update" />
</form>
<form action="{% url 'allocation:choice-delete' choice.pk %}">
<input style="background-color: red;" type="submit" value="Delete" />
</form>
{% else %} {% else %}
Unauthorised access Unauthorised access
{% endif %} {% endif %}
......
<form action="" method="post">{% csrf_token %}
{{ form.as_p }}
<input type="submit" value="Save" />
</form>
\ No newline at end of file
{% 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:choice_list' %}">{% trans 'Choices' %}</a>
&rsaquo; {{ choice.choice_name }}
</div>
{% endblock %}
{% block content %}
{% if choice.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 %}
...@@ -13,7 +13,8 @@ urlpatterns = [ ...@@ -13,7 +13,8 @@ urlpatterns = [
url(r'^choice/(?P<pk>\d+)$', views.ChoiceDetailView.as_view(), name='choice-detail'), url(r'^choice/(?P<pk>\d+)$', views.ChoiceDetailView.as_view(), name='choice-detail'),
url(r'^applicant/(?P<pk>\d+)$', views.ApplicantDetailView.as_view(), name='applicant-detail'), url(r'^applicant/(?P<pk>\d+)$', views.ApplicantDetailView.as_view(), name='applicant-detail'),
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+)/delete$', views.ChoiceDelete.as_view(), name='choice-delete'),
url(r'^import_db$', views.import_db, name='import_db1'), url(r'^import_db$', views.import_db, name='import_db1'),
url(r'^applicant_make$', views.applicant_make, name='applicant_make'), url(r'^applicant_make$', views.applicant_make, name='applicant_make'),
......
...@@ -7,7 +7,7 @@ from allocation.models import * ...@@ -7,7 +7,7 @@ from allocation.models import *
from django.forms import modelform_factory from django.forms import modelform_factory
from django.forms import modelformset_factory from django.forms import modelformset_factory
from django.views import generic from django.views import generic
from django.views.generic.edit import CreateView from django.views.generic.edit import *
from allocation.models import Choice from allocation.models import Choice
from allocation.models import Applicant from allocation.models import Applicant
...@@ -17,6 +17,8 @@ from django.core.files.storage import FileSystemStorage ...@@ -17,6 +17,8 @@ from django.core.files.storage import FileSystemStorage
from django.contrib.auth import authenticate, login from django.contrib.auth import authenticate, login
from django import forms from django import forms
import csv import csv
from django.urls import reverse_lazy
# @login_required(login_url='/admin/login') # @login_required(login_url='/admin/login')
# def index(request): #for /allocation # def index(request): #for /allocation
# applicant=Applicant.objects.filter(name=request.user.username)[0] # applicant=Applicant.objects.filter(name=request.user.username)[0]
...@@ -109,7 +111,6 @@ def admin1(request): ...@@ -109,7 +111,6 @@ def admin1(request):
return render(request, 'allocation/admin1.html',{'institute': institute}) return render(request, 'allocation/admin1.html',{'institute': institute})
<<<<<<< HEAD
class ChoiceListView(generic.ListView): class ChoiceListView(generic.ListView):
model = Choice model = Choice
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
...@@ -151,19 +152,16 @@ class ApplicantDetailView(generic.DetailView): ...@@ -151,19 +152,16 @@ class ApplicantDetailView(generic.DetailView):
class ChoiceCreateView(CreateView): class ChoiceCreateView(CreateView):
model = Choice model = Choice
fields = ['choice_name', 'capacity', 'institute'] fields = ['choice_name', 'capacity', 'institute']
=======
# class ChoiceListView(generic.ListView):
# model = Choice
# queryset = Choice.objects.filter(institute='IITB')
# class ApplicantListView(generic.ListView):
# model = Applicant
# queryset = Applicant.objects.filter(institute_name='IITB')
>>>>>>> 0d4055356852c072dfd6fd78966f4318a0d032bd
class ChoiceUpdate(UpdateView):
model = Choice
fields = ['choice_name','capacity']
template_name_suffix = '_update'
success_url = 'allocation:choice_list'
class ChoiceDelete(DeleteView):
model = Choice
success_url = reverse_lazy('allocation:choice_list')
No preview for this file type
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