Commit a14355dd authored by KUNAL GOYAL's avatar KUNAL GOYAL

minor changes

parent 67cd18ef
......@@ -5,6 +5,7 @@
{% endblock %}
{% block usertools %}
<div id="user-tools">
{% block welcome-msg %}
{% trans 'Welcome,' %}
<strong> {{institute.name}}</strong>.
......@@ -15,6 +16,7 @@
{% endif %}
<a href="{% url 'admin:logout' %}">{% trans 'Log out' %}</a>
{% endblock %}
</div>
{% endblock %}
{% block breadcrumbs %}
......
......@@ -11,7 +11,7 @@ from django.views.generic.edit import *
from allocation.models import Choice
from allocation.models import Applicant
from django.shortcuts import render, redirect
from django.shortcuts import render, redirect, get_object_or_404
from django.conf import settings
from django.core.files.storage import FileSystemStorage
from django.contrib.auth import authenticate, login
......@@ -78,7 +78,7 @@ AppFormset = modelformset_factory(Application,fields=("choice", "priority" ), ex
@login_required(login_url='/admin/login')
def index(request): #for /allocation
applicant=Applicant.objects.filter(name=request.user.username)[0]
applicant=get_object_or_404(Applicant, name=request.user.username)[0]
# form1 = modelform_factory(Applicant, fields=("name", "rank" ))
formset = AppFormset(queryset=Application.objects.filter(applicant=applicant),)
return render(request, 'allocation/index.html', {'applicant': applicant, 'formset': formset,})
......@@ -107,36 +107,36 @@ def submit(request):
@login_required(login_url='/admin/login')
def admin1(request):
institute=Institute.objects.filter(name=request.user.username)[0]
institute=get_object_or_404(Institute,name=request.user.username)[0]
return render(request, 'allocation/admin1.html',{'institute': institute})
class ChoiceListView(generic.ListView):
model = Choice
def get_context_data(self, **kwargs):
institute=Institute.objects.filter(name=self.request.user.username)[0]
institute=get_object_or_404(Institute,name=request.user.username)[0]
context = super(ChoiceListView, self).get_context_data(**kwargs)
context['institute'] = institute
return context
def get_queryset(self):
institute=Institute.objects.filter(name=self.request.user.username)[0]
institute=get_object_or_404(Institute,name=request.user.username)[0]
return Choice.objects.filter(institute__name=institute.name)
class ApplicantListView(generic.ListView):
model = Applicant
def get_context_data(self, **kwargs):
institute=Institute.objects.filter(name=self.request.user.username)[0]
institute=get_object_or_404(Institute,name=request.user.username)[0]
context = super(ApplicantListView, self).get_context_data(**kwargs)
context['institute'] = institute
return context
def get_queryset(self):
institute=Institute.objects.filter(name=self.request.user.username)[0]
institute=get_object_or_404(Institute,name=request.user.username)[0]
return Applicant.objects.filter(institute__name=institute.name)
class ChoiceDetailView(generic.DetailView):
model = Choice
def get_context_data(self, **kwargs):
institute=Institute.objects.filter(name=self.request.user.username)[0]
institute=get_object_or_404(Institute,name=request.user.username)[0]
context = super(ChoiceDetailView, self).get_context_data(**kwargs)
context['institute'] = institute
return context
......@@ -144,7 +144,7 @@ class ChoiceDetailView(generic.DetailView):
class ApplicantDetailView(generic.DetailView):
model = Applicant
def get_context_data(self, **kwargs):
institute=Institute.objects.filter(name=self.request.user.username)[0]
institute=get_object_or_404(Institute,name=request.user.username)[0]
context = super(ApplicantDetailView, self).get_context_data(**kwargs)
context['institute'] = institute
return context
......
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