Commit ecff3a93 authored by amanjain2898@gmail.com's avatar amanjain2898@gmail.com

Validation error particulars

parents a8ce99f2 570f1916
No preview for this file type
## File containing allocator function
from allocation.models import * from allocation.models import *
## Allocator Function
# @brief Function to allocate choices to applicants based on their preferences
# @param univ Name of the institute
# @return list of applicants which also store their newly allocated choices
def allocator(univ): def allocator(univ):
a=Applicant.objects.filter(institute__name=univ).order_by('rank') insti=Institute.objects.filter(name=univ)[0]
c=Choice.objects.filter(institute__name=univ) insti.is_allocated=True #< Sets that the institute has allocated atleast once
my_dict=dict([(x,0) for x in c]) insti.save() #< save changes to institute model instance
for x in a: a=Applicant.objects.filter(institute__name=univ).order_by('rank') #< variable \c a \ stores the list of applicants in order of their ranks
choices=x.ordered_choices() for x in a: #< loop over all applicants
temp=0 choices=x.ordered_choices() #< variable \c choices \ stores choices in order of priority of the applicant
i=0 i=0
while temp==0 and i<len(choices): flag=True
if(choices[i].capacity>my_dict[choices[i]]): while x.is_float and flag and i<len(choices): #< loop over all preferences till allocated
my_dict[choices[i]]=my_dict[choices[i]]+1 if choices[i].capacity>choices[i].seats_filled :
temp=1 given_choice=x.alloted_choice.all() #< \c given_choice\ stores already alloted choice
if given_choice:
g=given_choice[0]
g.seats_filled=g.seats_filled-1
x.alloted_choice.clear() x.alloted_choice.clear()
clalloc=Allocationcl(choice=choices[i],applicant=x) x.save()
g.save()
clalloc=Allocationcl(choice=choices[i],applicant=x) #< link Choice to Applicant using Application model
clalloc.save() clalloc.save()
# x.alloted_choice.clear() choices[i].seats_filled=choices[i].seats_filled+1
# x.alloted_choice.create(choices[i]) choices[i].save()
# if(temp!=1) flag=False
# x.alloted_choice.clear()
# x.alloted_choice.create(Null_choice)
# cll=Allocationcl(choice=Null_choice,applicant=x)
i=i+1 i=i+1
return a return a
\ No newline at end of file
## Admin Site View
# Used to modify the admin site
from django.contrib import admin from django.contrib import admin
from .models import * from .models import *
# class UnivAppInLine(admin.TabularInline):
# model=UnivApp
# extra=0
# class UnivChoiceInLine(admin.TabularInline):
# model=UnivChoice
# extra=0
class ChoiceInline(admin.TabularInline): class ChoiceInline(admin.TabularInline):
model = Application #https://stackoverflow.com/questions/5947843/django-how-does-manytomanyfield-with-through-appear-in-admin model = Application
extra = 2 extra = 2
class AllotedChoiceToAppInLine(admin.TabularInline): class AllotedChoiceToAppInLine(admin.TabularInline):
...@@ -19,13 +12,18 @@ class AllotedChoiceToAppInLine(admin.TabularInline): ...@@ -19,13 +12,18 @@ class AllotedChoiceToAppInLine(admin.TabularInline):
extra=0 extra=0
class ApplicantAdmin(admin.ModelAdmin): class ApplicantAdmin(admin.ModelAdmin):
fields = ['name', 'rank','institute'] fields = ['name', 'rank','institute', 'is_float']
list_display=['name','institute']
inlines = [ChoiceInline, AllotedChoiceToAppInLine] inlines = [ChoiceInline, AllotedChoiceToAppInLine]
# class ChoiceAdmin(admin.ModelAdmin): class InstituteAdmin(admin.ModelAdmin):
# fields=['choice_name', 'capacity'] fields=['name', 'is_allocated']
# inlines=[UnivChoiceInLine] list_display=['name','is_allocated']
class ChoiceAdmin(admin.ModelAdmin):
fields=['choice_name', 'capacity','institute', 'seats_filled']
list_display=['choice_name','institute', 'capacity', 'seats_filled' ]
admin.site.register(Institute) admin.site.register(Institute, InstituteAdmin)
admin.site.register(Choice) admin.site.register(Choice, ChoiceAdmin)
admin.site.register(Applicant, ApplicantAdmin) admin.site.register(Applicant, ApplicantAdmin)
\ No newline at end of file
from django.apps import AppConfig from django.apps import AppConfig
class AllocationConfig(AppConfig): class AllocationConfig(AppConfig):
name = 'allocation' name = 'allocation'
\ No newline at end of file
## Form Used for Registration
from django import forms from django import forms
from allocation.models import Applicant,Choice from allocation.models import *
from django.forms import ModelForm from django.forms import ModelForm
from django.contrib.auth.models import User
from django import forms
from django.contrib.auth.forms import UserCreationForm
# class PreferenceForm(forms.Form): ## Registration Form
# name = forms.CharField() # Registration form used to register new institutes to allow using our services
# rank = forms.IntegerField() class InstiForm(UserCreationForm):
# choices = forms.ModelMultipleChoiceField(queryset=Choice.objects.all()) ## Metadata
class Meta:
# class PreferenceForm(ModelForm): model = User #< Form to create new user model
# class Meta: fields = ['username', 'password1', 'password2', ] #< Fields to be taken input
# model = Applicant \ No newline at end of file
# fields = ['name', 'rank', 'choices']
\ No newline at end of file
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2017-10-21 10:18 # Generated by Django 1.11.5 on 2017-10-25 21:03
from __future__ import unicode_literals from __future__ import unicode_literals
import django.core.validators
from django.db import migrations, models from django.db import migrations, models
import django.db.models.deletion import django.db.models.deletion
...@@ -20,8 +21,8 @@ class Migration(migrations.Migration): ...@@ -20,8 +21,8 @@ class Migration(migrations.Migration):
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
], ],
options={ options={
'verbose_name': 'Allocated Choice',
'verbose_name_plural': 'Allocated Choice', 'verbose_name_plural': 'Allocated Choice',
'verbose_name': 'Allocated Choice',
'ordering': ['applicant__rank'], 'ordering': ['applicant__rank'],
}, },
), ),
...@@ -30,14 +31,15 @@ class Migration(migrations.Migration): ...@@ -30,14 +31,15 @@ class Migration(migrations.Migration):
fields=[ fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=200)), ('name', models.CharField(max_length=200)),
('rank', models.IntegerField()), ('rank', models.IntegerField(validators=[django.core.validators.MinValueValidator(1)])),
('is_float', models.BooleanField(default=True)),
], ],
), ),
migrations.CreateModel( migrations.CreateModel(
name='Application', name='Application',
fields=[ fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('priority', models.IntegerField()), ('priority', models.IntegerField(validators=[django.core.validators.MinValueValidator(1)])),
('applicant', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='allocation.Applicant')), ('applicant', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='allocation.Applicant')),
], ],
options={ options={
...@@ -50,6 +52,7 @@ class Migration(migrations.Migration): ...@@ -50,6 +52,7 @@ class Migration(migrations.Migration):
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('choice_name', models.CharField(max_length=200)), ('choice_name', models.CharField(max_length=200)),
('capacity', models.IntegerField()), ('capacity', models.IntegerField()),
('seats_filled', models.IntegerField(default=0)),
], ],
), ),
migrations.CreateModel( migrations.CreateModel(
...@@ -57,10 +60,11 @@ class Migration(migrations.Migration): ...@@ -57,10 +60,11 @@ class Migration(migrations.Migration):
fields=[ fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=200)), ('name', models.CharField(max_length=200)),
('is_allocated', models.BooleanField(default=False)),
], ],
options={ options={
'verbose_name': 'Institute',
'verbose_name_plural': 'Institutes', 'verbose_name_plural': 'Institutes',
'verbose_name': 'Institute',
}, },
), ),
migrations.AddField( migrations.AddField(
......
## Models file
# It contains all the models used to define the database
from __future__ import unicode_literals from __future__ import unicode_literals
from django.db import models from django.db import models
# import CsvModel from django.core.validators import MaxValueValidator, MinValueValidator
import csv import csv
import os import os
## Models file
# It contains all the models used to define the database
## Institute Model
# @brief Stores information about all institutes in a table
class Institute(models.Model): class Institute(models.Model):
name=models.CharField(max_length=200) name=models.CharField(max_length=200) #< name of the Institute
is_allocated=models.BooleanField(default=False) #< Stores if atleast \f$1^{st}\f$ round is over or not
## String Conversion
# @param self Pointer to itself
# @return name Name of institute
def __str__(self): def __str__(self):
return self.name return self.name
## Metadata
class Meta: class Meta:
verbose_name='Institute' verbose_name='Institute' #< Display name
verbose_name_plural='Institutes' verbose_name_plural='Institutes' #< Plural display name
## Choice Model
# @brief Stores various choices in a table
class Choice(models.Model): class Choice(models.Model):
choice_name = models.CharField(max_length=200) choice_name = models.CharField(max_length=200) #< object containing name of choice
institute=models.ForeignKey(Institute, on_delete=models.CASCADE, related_name='choices') institute=models.ForeignKey(Institute, on_delete=models.CASCADE, related_name='choices') #< Object containing related institute primary key
capacity = models.IntegerField() capacity = models.IntegerField() #< Object containing maximum number of applicants allowed
seats_filled=models.IntegerField(default=0) #< Object containing number of seats currently occupied
## String Conversion
# @param self Pointer to itself
# @return name Name of Choice
def __str__(self): def __str__(self):
return self.choice_name return self.choice_name
# Null_Choice=Choice.objects.create(choice_name="None",capacity=1000) ## Applicant Model
# Null_Choice.save() # @brief Stores various applicants in a table
class Applicant(models.Model): class Applicant(models.Model):
institute=models.ForeignKey(Institute,on_delete=models.CASCADE,related_name='applicants') institute=models.ForeignKey(Institute,on_delete=models.CASCADE,related_name='applicants') #< Object containing foreign key to relate Applicant and Institute
choices = models.ManyToManyField(Choice, through='Application', related_name='applicants') choices = models.ManyToManyField(Choice, through='Application', related_name='applicants') #< Foreign Keys relating Applicant to all the preferred choices
name = models.CharField(max_length=200) name = models.CharField(max_length=200) #< Object containing name of Applicant
alloted_choice = models.ManyToManyField(Choice, through='Allocationcl', related_name='alloted_applicant') alloted_choice = models.ManyToManyField(Choice, through='Allocationcl', related_name='alloted_applicant') # Foreign Key to relate Applicant to allocated choice
rank = models.IntegerField() rank = models.IntegerField(validators=[MinValueValidator(1)]) #< Integer object storing rank of Applicant
is_float=models.BooleanField(default=True) #< Boolean Field to store current status opted by the student to determine fereze, float and drop
## String Conversion
# @param self Pointer to itself
# @return name Name of Applicant
def __str__(self): def __str__(self):
return self.name return self.name
## Ordered Choices
# @brief Function to give all the choices as per preference of the Applicant
# @param self Pointer to itself
# @return list of choices in order of preference
def ordered_choices(self): def ordered_choices(self):
#https://stackoverflow.com/questions/934779/django-order-a-model-by-a-many-to-many-field
"Return a properly ordered set of choices"
return self.choices.all().order_by('application__priority') return self.choices.all().order_by('application__priority')
## Application Model
# @brief Links an Applicant to a Choice through a model
class Application(models.Model): class Application(models.Model):
applicant = models.ForeignKey(Applicant, on_delete=models.CASCADE) applicant = models.ForeignKey(Applicant, on_delete=models.CASCADE) #< Applicant to be linked
choice = models.ForeignKey(Choice, on_delete=models.CASCADE) choice = models.ForeignKey(Choice, on_delete=models.CASCADE) #< Choice chosen to be linked
priority = models.IntegerField() priority = models.IntegerField(validators=[MinValueValidator(1)]) #< Preference given to the choice by the Applicant
## Metadata
class Meta: class Meta:
# if you have an inline configured in the admin, this will
# make the roles order properly
ordering = ['priority'] ordering = ['priority']
## Application Model
# @brief Links allocated Choices to their Applicants through a model
class Allocationcl(models.Model): class Allocationcl(models.Model):
choice = models.ForeignKey(Choice, on_delete=models.CASCADE) choice = models.ForeignKey(Choice, on_delete=models.CASCADE) #< Foreign key to link the allocated choice
applicant = models.ForeignKey(Applicant, on_delete=models.CASCADE) applicant = models.ForeignKey(Applicant, on_delete=models.CASCADE) #< Foreign key to link the Applicants
# priority = models.IntegerField() ## Metadata
class Meta: class Meta:
# if you have an inline configured in the admin, this will verbose_name='Allocated Choice' #< Display Name
# make the roles order properly verbose_name_plural='Allocated Choice' #< Plural display name
verbose_name='Allocated Choice' ordering = ['applicant__rank'] #< used to return applicants in order of their ranks
verbose_name_plural='Allocated Choice' \ No newline at end of file
ordering = ['applicant__rank']
# class UnivChoice(models.Model):
# ,limit_choices_to={'institute':applicant.institute}
# choice=models.ForeignKey(Choice,on_delete=models.CASCADE)
# university=models.ForeignKey(University,on_delete=models.CASCADE)
# , limit_choices_to={'university__name':'applicant_university__name'}
# class UnivApp(models.Model):
# applicant=models.ForeignKey(Applicant,on_delete=models.CASCADE)
# university=models.ForeignKey(University,on_delete=models.CASCADE)
# class Meta:
# ordering=['applicant__rank']
\ No newline at end of file
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
z-index: -1; z-index: -1;
background-image: url('BG.png'); background-image: url('BG.png');
/*background-size: 2000px 700px;*/ /*background-size: 2000px 700px;*/
background-size: 100% 75%; background-size: 100% 100%;
background-repeat: no-repeat; background-repeat: no-repeat;
background-attachment: fixed; background-attachment: fixed;
opacity: 0.60; opacity: 0.60;
......
...@@ -34,14 +34,13 @@ ...@@ -34,14 +34,13 @@
<div style="float:right;"> <div style="float:right;">
<form method="POST" action="/allocation/button_action" enctype="multipart/form-data"> <form method="POST" action="/allocation/button_action" enctype="multipart/form-data">
{% csrf_token %} {% csrf_token %}
<!-- <input type="hidden" name="prikey" value="{{ request.get_full_path }}"> -->
<button type="submit" style="width: 180px; height: 40px; font-size: 25px"> Allocate</button> <button type="submit" style="width: 180px; height: 40px; font-size: 25px"> Allocate</button>
</form> </form>
</div> </div>
{% endif %} {% endif %}
<p style="font-size: 25px; text-align: left;"><a href="{% url 'allocation:applicant_list' %}">Applicants</a></p> <p style="font-size: 20px; text-align: left;"><a href="{% url 'allocation:applicant_list' %}">Applicants</a></p>
<p style="font-size: 25px; text-align: left"><a href="{% url 'allocation:choice_list' %}">Choices</a></p> <p style="font-size: 20px; text-align: left"><a href="{% url 'allocation:choice_list' %}">Choices</a></p>
<!-- {% if request.get_full_path == "/allocation/admin" %} <!-- {% if request.get_full_path == "/allocation/admin" %}
......
{% 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 %}
...@@ -11,7 +11,16 @@ ...@@ -11,7 +11,16 @@
{% if applicant.institute.name == request.user.username %} {% if applicant.institute.name == request.user.username %}
<p><b>Name:</b> {{ applicant.name }}</p> <p><b>Name:</b> {{ applicant.name }}</p>
<p><b>Rank:</b> {{ applicant.rank }}</p> <p><b>Rank:</b> {{ applicant.rank }}</p>
<p><b>Allotted Choice:</b> {{ applicant.alloted_choice }} <p><b>Allotted Choice:</b>
{% for choice in applicant.alloted_choice.all %}
{{choice}}
{% 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 %}
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
{% if choice.institute.name == request.user.username %} {% if choice.institute.name == request.user.username %}
<p><b>Choice name:</b> {{ choice.choice_name }}</p> <p><b>Choice name:</b> {{ choice.choice_name }}</p>
<p><b>Capacity:</b> {{ choice.capacity }}</p> <p><b>Capacity:</b> {{ choice.capacity }}</p>
<p><b>Seats Filled:</b> {{ choice.seats_filled }}</p>
<form action="{% url 'allocation:choice-update' choice.pk %}"> <form action="{% url 'allocation:choice-update' choice.pk %}">
<input type="submit" value="Update" /> <input type="submit" value="Update" />
</form> </form>
......
<html>
<head>
<link rel="stylesheet" type="text/css" href="core/home_page.css">
</head>
<body>
<table >
<tr>
<td rowspan="2"><a class="logoText"><img src="logo.png" width="150" height="150" alt="logo"></a></td>
<td style="vertical-align: bottom; padding-left:5px; padding-bottom: 2px; font-size: 20px"><a class="logoText" ><B>codeMAFIA</B></a></td>
</tr>
<tr>
<td style="vertical-align: top; padding-left:20px; font-size:20px"><a class="tagLine" ><B><I>the journey begins... </I></B></a></td>
</tr>
</table>
<div class="container">
<div class="content"><h1 align="center" style="color:black">General Allocation Portal</h1></div>
</div>
<div class="tool1" style="margin-top: 570px; text-align: center; font-size: 30px;">
</div>
<div class="tool2" style="margin-top: 10px; text-align: center; font-size: 50px; color: white">
Institute login
</div>
<div class="tool3" style="margin-top: 5px; text-align: center; font-size: 50px; color:white">
Applicant login
</div>
<div class="tool4" style="margin-top: 5px; text-align: center; font-size: 50px; color:white">
Admin login
</div>
</body>
</html>
\ No newline at end of file
...@@ -37,10 +37,25 @@ ...@@ -37,10 +37,25 @@
<!-- Content --> <!-- Content -->
<div id="content" class="{% block coltype %}colM{% endblock %}"> <div id="content" class="{% block coltype %}colM{% endblock %}">
{% block content %} {% block content %}
{% if form.errors %} {% if applicant.is_float %}
<p style="color: red;"> <form method="POST" action="/allocation/freeze" enctype="multipart/form-data">
Please correct the error{{ form.errors|pluralize }} below. {% csrf_token %}
</p> <input type="hidden" name="applicant" value="{{ applicant.pk }}">
<button type="submit" style="float: right; width: 180px; height: 30px; font-size: 20px"> Freeze</button>
</form>
<form method="POST" action="/allocation/float" enctype="multipart/form-data">
{% csrf_token %}
<input type="hidden" name="applicant" value="{{ applicant.pk }}">
<button type="submit" style="float: right; width: 180px; height: 30px; font-size: 20px"> Float</button>
</form>
<form method="POST" action="/allocation/drop" enctype="multipart/form-data">
{% csrf_token %}
<input type="hidden" name="applicant" value="{{ applicant.pk }}">
<button type="submit" style="float: right; width: 180px; height: 30px; font-size: 20px"> Drop</button>
</form>
{% endif %}
{% if success %}
<p style="color:green">update successfull</p>
{% endif %} {% endif %}
<p> <b>Name:</b> {{applicant.name}}<br> <p> <b>Name:</b> {{applicant.name}}<br>
<b>Rank:</b> {{applicant.rank}}<br> <b>Rank:</b> {{applicant.rank}}<br>
...@@ -49,21 +64,33 @@ ...@@ -49,21 +64,33 @@
{{choice}} {{choice}}
{% endfor %} {% endfor %}
</p> </p>
<form action="/allocation/submit" method="post">{% csrf_token %}
<form action="/allocation/" method="post">{% csrf_token %}
{{ formset.management_form }} {{ formset.management_form }}
{% for form in formset %} {% for form in formset %}
{{ form }}<br> {{ form.non_field_errors }}
{% for hidden in form.hidden_fields %}
{{ hidden }}
{% endfor %}
{% for field in form.visible_fields %}
<div class="fieldWrapper">
{{ field.errors }}
{{ field.label_tag }} {{ field }}
</div>
{% endfor %}
<!-- {{ form.applicant }} {{ form.choice }} {{ form.priority }}<br> --> <!-- {{ form.applicant }} {{ form.choice }} {{ form.priority }}<br> -->
<br>
{% endfor %} {% endfor %}
{% if not applicant.institute.is_allocated %}
<input type="submit" value="Submit"> <input type="submit" value="Submit">
{% endif %}
</form> </form>
{% endblock %} {% endblock %}
<br class="clear" /> <br class="clear" />
</div> </div>
<!-- END Content --> <!-- END Content -->
{% block footer %}<div id="footer"></div>{% endblock %}
</div> </div>
</body> </body>
......
.container { position: relative; }
.container{
content: "";
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
z-index: -1;
/*background-image: url('BG.png');*/
background-size: 2000px 700px;
background-repeat: no-repeat;
background-attachment: fixed;
opacity: 0.60;
}
.content {
position: relative;
margin-top: 300px;
font-size: 60px;
opacity: 20;
z-index: 1;
}
.tool1 {
margin-top: 680px;
background-color: green;
z-index: 1;
}
.tool2 {
margin-top: 700px;
background-color: #5DBCD2;
z-index: 2;
}
.tool3 {
margin-top: 720px;
background-color: #5DBCD2;
}
.tool4 {
margin-top: 720px;
background-color: #5DBCD2;
}
\ No newline at end of file
{% load static %}
<html>
<head>
<link rel="stylesheet" type="text/css" href="{% static 'allocation/home_page.css' %}" />
</head>
<body>
<table >
<tr>
<td rowspan="2"><a class="logoText"><img src="{% static 'allocation/logo.png' %}" width="100%" height="100%" alt="logo"></a></td>
<td style="vertical-align: bottom; padding-left:5px; padding-bottom: 2px; font-size: 20px"><a class="logoText" ><B>codeMAFIA</B></a></td>
</tr>
<tr>
<td style="vertical-align: top; padding-left:20px; font-size:20px"><a class="tagLine" ><B><I>the journey begins... </I></B></a></td>
</tr>
</table>
<div class="container">
<div class="content"><h1 align="center" style="color:black">General Allocation Portal</h1></div>
</div>
<div class="tool1" style="margin-top: 460px; text-align: center; font-size: 30px;">
</div>
<div class="tool2" style="margin-top: 10px; text-align: center; font-size: 50px; color: white">
<a href = "/allocation/admin">
Institute login
</a>
</div>
<div class="tool3" style="margin-top: 5px; text-align: center; font-size: 50px; color:white">
<a href="/allocation">
Applicant login
</a>
</div>
<div class="tool4" style="margin-top: 5px; text-align: center; font-size: 50px; color:white">
Register with us
</div>
</body>
</html>
\ No newline at end of file
{% extends 'base.html' %}
{% load static %}
{% block content %}
<form method="post" enctype="multipart/form-data">
{% csrf_token %}
<input type="file" name="myfile">
<button type="submit">Upload</button>
</form>
{% if uploaded_file_url %}
<p>File uploaded at: <a href="{{ uploaded_file_url }}">{{ uploaded_file_url }}</a></p>
{% endif %}
<p><a href="{% url 'home' %}">Return to home</a></p>
{% endblock %}
\ No newline at end of file
{% extends 'admin/base.html' %}
{% load i18n admin_urls static admin_list %}
{% load tag %}
<!-- -->
{% block branding %}
<h1 id="site-name">Institute Registration</h1>
{% endblock %}
{% block breadcrumbs %}
<div class="breadcrumbs">
<a href="{% url 'index1' %}">{% trans 'Home' %}</a>
</div>
{% endblock %}
{% block content %}
<form method="post">
{% csrf_token %}
{% for field in form %}
<div class="fieldWrapper">
{{ field.errors }}
{{ field.label_tag }} <br>{{ field }}
{% if field.help_text %}
<p class="help">{{ field.help_text|safe }}</p>
{% endif %}
</div>
{% endfor %}
<button type="submit" style="width: 180px; height: 30px; font-size: 20px">Sign up</button>
</form>
{% endblock %}
## URL File
# Contains Information about active urls of allocation app
from django.conf.urls import url, include from django.conf.urls import url, include
from . import views from . import views
from django.contrib.auth import urls from django.contrib.auth import urls
from django.contrib.auth import views as auth_views from django.contrib.auth import views as auth_views
app_name = 'allocation' app_name = 'allocation'
urlpatterns = [
url(r'^$', views.index, name='index'),
url(r'^submit$', views.submit, name='submit'),
url(r'^admin$', views.admin1, name='admin1'),
url(r'^admin/choices$', views.ChoiceListView.as_view(), name='choice_list'),
url(r'^admin/applicants$', views.ApplicantListView.as_view(), name='applicant_list'),
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'^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'^choice_make$', views.choice_make, name='choice_make'),
url(r'^applicant_make$', views.applicant_make, name='applicant_make'),
url(r'^button_action$', views.button_action, name='button_action'),
# url(r'^send_mail$', views.send_mail, name='mail_send'),
#url(r'^admin/choices$', views.ChoiceListView.as_view(), name='choice_list'),
#url(r'^admin/applicants$', views.ApplicantListView.as_view(), name='applicant_list'),
#url(r'^login/$', auth_views.login,name='login'), ## URL Patterns
#url(r'^logout/$', auth_views.logout, name='logout1'), # @brief Matches the URL and redirects accordingly
urlpatterns = [
url(r'^$', views.index, name='index'), #< creates URL for student login
url(r'^admin$', views.admin1, name='admin1'), #< creates URL for Institute login
url(r'^admin/choices$', views.ChoiceListView.as_view(), name='choice_list'), #< creates URL to display all choices in Institute Login
url(r'^admin/applicants$', views.ApplicantListView.as_view(), name='applicant_list'), #< creates URL to display all applicants in Institute Login
url(r'^choice/(?P<pk>\d+)$', views.ChoiceDetailView.as_view(), name='choice-detail'), #< creates URL to display a particular choice in Institute Login
url(r'^applicant/(?P<pk>\d+)$', views.ApplicantDetailView.as_view(), name='applicant-detail'), #< creates URL to display a particular applicant in Institute Login
url(r'^choice/create$', views.ChoiceCreateView.as_view(), name='choice-create'), #< creates URL to create a particular choice in Institute Login
url(r'^choice/(?P<pk>\d+)/update$', views.ChoiceUpdate.as_view(), name='choice-update'), #< creates URL to update a particular choice in Institute Login
url(r'^choice/(?P<pk>\d+)/delete$', views.ChoiceDelete.as_view(), name='choice-delete'), #< creates URL to deleten a particular choice in Institute Login
url(r'^applicant/(?P<pk>\d+)/update$', views.ApplicantUpdate.as_view(), name='applicant-update'), #< creates URL to update a particular applicant in Institute Login
url(r'^applicant/(?P<pk>\d+)/delete$', views.ApplicantDelete.as_view(), name='applicant-delete'), #< creates URL to delete a particular applicant in Institute Login
url(r'^choice_make$', views.choice_make, name='choice_make'), #< creates URL to create choices through csv file in Institute Login
url(r'^applicant_make$', views.applicant_make, name='applicant_make'), #< creates URL to create applicants through csv file in Institute Login
url(r'^button_action$', views.button_action, name='button_action'), #< Used to call the allocator function in Institute login
url(r'^register/$', views.signup), #< creates URL for registration of new Institutes
url(r'^freeze$', views.freeze, name='freeze'), #< URL for Freeze button in Applicant login
url(r'^float$', views.float, name='float'), #< URL for Float button in Applicant login
url(r'^drop$', views.drop, name='drop'), #< URL for Drop button in Applicant login
] ]
\ No newline at end of file
This diff is collapsed.
No preview for this file type
...@@ -31,7 +31,6 @@ ALLOWED_HOSTS = [] ...@@ -31,7 +31,6 @@ ALLOWED_HOSTS = []
# Application definition # Application definition
INSTALLED_APPS = [ INSTALLED_APPS = [
'guardian',
'allocation.apps.AllocationConfig', 'allocation.apps.AllocationConfig',
'django.contrib.admin', 'django.contrib.admin',
'django.contrib.auth', 'django.contrib.auth',
...@@ -125,3 +124,5 @@ AUTHENTICATION_BACKENDS = ( #django-guardian ...@@ -125,3 +124,5 @@ AUTHENTICATION_BACKENDS = ( #django-guardian
'django.contrib.auth.backends.ModelBackend', # this is default 'django.contrib.auth.backends.ModelBackend', # this is default
'guardian.backends.ObjectPermissionBackend', 'guardian.backends.ObjectPermissionBackend',
) )
LOGOUT_REDIRECT_URL = '/'
\ No newline at end of file
"""mysite URL Configuration ## URL File
# Contains Information about active urls of the project
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home')
Including another URLconf
1. Import the include() function: from django.conf.urls import url, include
2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls'))
"""
from django.conf.urls import url, include from django.conf.urls import url, include
from django.contrib import admin from django.contrib import admin
from django.contrib.auth import views from django.contrib.auth import views
from . import views from . import views
from allocation.models import *
from allocation.forms import *
## URL Patterns
# @brief Matches the URL and redirects accordingly
urlpatterns = [ urlpatterns = [
url(r'^allocation/', include('allocation.urls')), url(r'^allocation/', include('allocation.urls')), #< redirects to the allocation app
url(r'^admin/', admin.site.urls), url(r'^admin/', admin.site.urls), #< redirect to admin portal
url(r'^$',views.index1,name='index1'), url(r'^$',views.index1,name='index1'), #< redirect to home page view
] ]
## Contains the main views of the project
from django.contrib.auth.decorators import login_required from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User from django.contrib.auth.models import User
from django.shortcuts import render, redirect from django.shortcuts import render, redirect
from django.contrib.auth import authenticate, login from django.contrib.auth import authenticate, login
## Home Page
# @brief Home Page view of the project
# @param request
# @return Http response to show home page
def index1(request): def index1(request):
return render(request,'core/home_page.html') return render(request,'core/home_page.html')
\ No newline at end of file
.container { position: relative; }
.container{
content: "";
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
z-index: -1;
/*background-image: url('BG.png');*/
background-size: 100% 25%;
background-repeat: no-repeat;
background-attachment: fixed;
opacity: 0.60;
}
.content {
position: relative;
margin-top: 300px;
font-size: 60px;
opacity: 20;
z-index: 1;
}
.tool1 {
margin-top: 680px;
background-color: green;
z-index: 1;
}
.tool2 {
margin-top: 700px;
background-color: #5DBCD2;
z-index: 2;
}
.tool3 {
margin-top: 720px;
background-color: #5DBCD2;
}
.tool4 {
margin-top: 720px;
background-color: #5DBCD2;
}
\ No newline at end of file
...@@ -2,40 +2,56 @@ ...@@ -2,40 +2,56 @@
<html> <html>
<head> <head>
<link rel="stylesheet" type="text/css" href="{% static 'allocation/home_page.css' %}" /> <link rel="stylesheet" type="text/css" href="{% static 'allocation/home_page.css' %}" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script type="text/javascript">
$(window).scroll(function () {
if ($(window).scrollTop() > 226) {
$(".header").addClass("fixed");
} else {
$(".header").removeClass("fixed");
}
});
</script>
<style type="text/css">
.fixed {
position:fixed;
top:0;
left:0;
}
</style>
</head> </head>
<body> <body>
<table > <!-- <table >
<tr> <tr>
<td rowspan="2"><a class="logoText"><img src="{% static 'allocation/logo.png' %}" width="100%" height="100%" alt="logo"></a></td> <td rowspan="2" style="background-attachment: fixed"><img src="{% static 'allocation/logo.png' %}" width="30%" alt="logo"></td>
<td style="vertical-align: bottom; padding-left:5px; padding-bottom: 2px; font-size: 20px"><a class="logoText" ><B>codeMAFIA</B></a></td>
</tr>
<tr>
<td style="vertical-align: top; padding-left:20px; font-size:20px"><a class="tagLine" ><B><I>the journey begins... </I></B></a></td>
</tr> </tr>
</table> </table> -->
<img src ="{% static 'allocation/logo.png' %}" class="fixed" width="30%" height="30%" alt="logo" >
<div class="container"> <div class="container">
<div class="content"><h1 align="center" style="color:black">General Allocation Portal</h1></div> <div class="content"><h1 align="center" style="color:black">General Allocation Portal</h1></div>
</div> </div>
<div class="tool1" style="margin-top: 29%; text-align: center; font-size: 30px;"> <div class="tool1" style="margin-top: 45%; text-align: center; font-size: 30px;">
</div> </div>
<div class="tool2" style="margin-top: 10px; text-align: center; font-size: 50px; color: white"> <div class="tool2" style="margin-top: 10px; text-align: center; height: 60px; color: white">
<a href = "/allocation/admin"> <a href = "/allocation/admin" style="font-size: 40px;">
Institute login Institute login
</a> </a>
</div> </div>
<div class="tool3" style="margin-top: 5px; text-align: center; font-size: 50px; color:white"> <div class="tool3" style="margin-top: 5px; text-align: center; height: 60px; color:white">
<a href="/allocation"> <a href="/allocation" style="font-size: 40px">
Applicant login Applicant login
</a> </a>
</div> </div>
<div class="tool4" style="margin-top: 5px; text-align: center; font-size: 50px; color:white"> <div class="tool4" style="margin-top: 5px; text-align: center; height: 60px; color:white">
<a href="/allocation/register" style="font-size: 40px">
Register with us Register with us
</a>
</div> </div>
......
{% extends 'base.html' %}
{% load static %}
{% block content %}
<form method="post" enctype="multipart/form-data">
{% csrf_token %}
<input type="file" name="myfile">
<button type="submit">Upload</button>
</form>
{% if uploaded_file_url %}
<p>File uploaded at: <a href="{{ uploaded_file_url }}">{{ uploaded_file_url }}</a></p>
{% endif %}
<p><a href="{% url 'home' %}">Return to home</a></p>
{% endblock %}
\ No newline at end of file
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