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
...@@ -3,22 +3,16 @@ from django.contrib.auth import authenticate ...@@ -3,22 +3,16 @@ from django.contrib.auth import authenticate
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 allocation.models import * from allocation.models import *
#from allocation.forms import PreferenceForm from django.forms import modelformset_factory, formset_factory, modelform_factory, ModelForm
from django.forms import modelform_factory
from django.forms import modelformset_factory
from django.views import generic from django.views import generic
from django.views.generic.edit import * from django.views.generic.edit import *
from django.shortcuts import render, redirect, get_object_or_404
from allocation.models import Choice
from allocation.models import Applicant
from django.shortcuts import render, redirect
from django.conf import settings from django.conf import settings
from django.core.files.storage import FileSystemStorage 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 from django.urls import reverse_lazy
from django.utils import lru_cache from django.utils import lru_cache
from django.utils._os import upath from django.utils._os import upath
from django.utils.encoding import force_text from django.utils.encoding import force_text
...@@ -28,6 +22,7 @@ from django.utils.module_loading import import_string ...@@ -28,6 +22,7 @@ from django.utils.module_loading import import_string
from django.utils.six import string_types, text_type from django.utils.six import string_types, text_type
from django.utils.translation import ugettext as _, ungettext from django.utils.translation import ugettext as _, ungettext
from django.contrib.auth import * from django.contrib.auth import *
from allocation.forms import *
from alloc import * from alloc import *
from difflib import SequenceMatcher from difflib import SequenceMatcher
...@@ -57,21 +52,24 @@ from django.core.exceptions import ( ...@@ -57,21 +52,24 @@ from django.core.exceptions import (
# ['codemafia123@gmail.com'],) # ['codemafia123@gmail.com'],)
# email.send() # email.send()
# return HttpResponse("success") # return HttpResponse("success")
def signup(request):
if request.method == 'POST':
form = InstiForm(request.POST)
if form.is_valid():
user = form.save()
user.is_staff=True
user.save()
new_insti=Institute(name=user.username)
new_insti.save()
return HttpResponseRedirect('/allocation/admin')
else:
form = InstiForm()
return render(request, 'registration/register.html', {'form': form})
def button_action(request): def button_action(request):
# value = request.POST["prikey"]
# value = int(value.split('/')[-3])
# name = Institute.objects.get(pk=value).name
# allocator(name)
# return HttpResponse("success")
institute=request.user.username institute=request.user.username
allocator(institute) allocator(institute)
return HttpResponse("success") return HttpResponseRedirect("/allocation/admin")
def home(request):
documents = Document.objects.all()
return render(request, 'core/home.html', { 'documents': documents })
return HttpResponse("On home")
def choice_make(request): def choice_make(request):
if request.method == "POST": if request.method == "POST":
...@@ -79,7 +77,8 @@ def choice_make(request): ...@@ -79,7 +77,8 @@ def choice_make(request):
file_data = csvfile.read().decode("utf-8") file_data = csvfile.read().decode("utf-8")
lines = file_data.split("\n") lines = file_data.split("\n")
user_name = request.user.username user_name = request.user.username
institute = Institute.objects.filter(name=user_name)[0] institute = get_object_or_404(Institute, name=user_name)
repeated = []
for line in lines: for line in lines:
line = line.split(',') line = line.split(',')
number = len(line) number = len(line)
...@@ -87,13 +86,18 @@ def choice_make(request): ...@@ -87,13 +86,18 @@ def choice_make(request):
return HttpResponse("Incorrect data format in uploaded .csv file.") return HttpResponse("Incorrect data format in uploaded .csv file.")
existing_no = institute.choices.filter(choice_name=line[0]) existing_no = institute.choices.filter(choice_name=line[0])
if existing_no.count() != 0: if existing_no.count() != 0:
return HttpResponse(".csv file has choices that already exists") repeated.append(line[0])
# return HttpResponse(".csv file choice: '"+ line[0] + "' already exists")
if len(repeated) != 0:
str = ""
for rep in repeated:
str += rep + ","
return HttpResponse(".csv file has choices: '"+ str + "' that already exists")
for line in lines: for line in lines:
line = line.split(',') line = line.split(',')
tmp = institute.choices.create(choice_name=line[0],capacity=line[1]) tmp = institute.choices.create(choice_name=line[0],capacity=line[1])
tmp.save() tmp.save()
# tmp = Choice.objects.create(choice_name=line[0],capacity=line[1]) return HttpResponseRedirect("/allocation/admin/choices")
return HttpResponse("successful")
return HttpResponse("Error") return HttpResponse("Error")
...@@ -119,28 +123,50 @@ def applicant_make(request): ...@@ -119,28 +123,50 @@ def applicant_make(request):
csvfile = request.FILES['myfile'] csvfile = request.FILES['myfile']
file_data = csvfile.read().decode("utf-8") file_data = csvfile.read().decode("utf-8")
user_name = request.user.username user_name = request.user.username
institute = Institute.objects.filter(name=user_name)[0] institute = get_object_or_404(Institute, name=user_name)
lines = file_data.split("\n") lines = file_data.split("\n")
rep_users = []
rep_applicant = []
errors = []
for line in lines: for line in lines:
line = line.split(',') line = line.split(',')
number = len(line) number = len(line)
if number != 4: if number != 4:
return HttpResponse("Incorrect data format in uploaded .csv file") return HttpResponse("Incorrect data format in uploaded .csv file")
existing_no_app = institute.applicants.filter(name = line[0],rank = line[1]) existing_no_app = institute.applicants.filter(name = line[0])
existing_no_user = User.objects.filter(username=line[0],email=line[2],password=line[3]) existing_no_user = User.objects.filter(username=line[0])
if existing_no_app.count() != 0: if existing_no_app.count() != 0:
return HttpResponse(".csv files has applicants that already exists") rep_applicant.append(line[0])
# return HttpResponse(".csv files has applicants that already exists")
if existing_no_user.count() != 0: if existing_no_user.count() != 0:
return HttpResponse("user with same username,password and email-id already exists") rep_users.append(line[0])
errors = [] # return HttpResponse("user with same username already exists")
password_validators = get_default_password_validators() password_validators = get_default_password_validators()
for validator in password_validators: for validator in password_validators:
try: try:
validator.validate(line[3]) validator.validate(line[3])
except ValidationError as error: except ValidationError as error:
errors.append(error) errors.append(line[0])
if errors: if len(rep_applicant) != 0:
return HttpResponse("Invalid password given in .csv file") str = ""
for appl in rep_applicant:
str += appl + ","
return HttpResponse(".csv file has applicants: '"+ str + "' that already exists")
if len(rep_users) != 0:
str = ""
for appl in rep_users:
str += appl + ","
return HttpResponse(".csv file has user with usernames : '"+ str + "' that already exists")
if len(errors) != 0:
str = ""
for appl in errors:
str += appl + ","
return HttpResponse(".csv file usernames : '"+ str + "' have incorrect format of password")
# return HttpResponse("Invalid password given in .csv file")
# if validate_password(line[4]) != None: # if validate_password(line[4]) != None:
# return HttpResponse("Invalid password given in .csv file") # return HttpResponse("Invalid password given in .csv file")
for line in lines: for line in lines:
...@@ -150,73 +176,66 @@ def applicant_make(request): ...@@ -150,73 +176,66 @@ def applicant_make(request):
user = User.objects.create_user(username=line[0],email=line[2],password=line[3]) user = User.objects.create_user(username=line[0],email=line[2],password=line[3])
user.is_staff = True user.is_staff = True
user.save() user.save()
return HttpResponse("successful") return HttpResponseRedirect("/allocation/admin/applicants")
return HttpResponse("Error") return HttpResponse("Error")
def make_application_form(applicant1):
AppFormset = modelformset_factory(Application,fields=("choice", "priority" ), extra=5) class ApplicationForm(forms.ModelForm):
choice = forms.ModelChoiceField(queryset=Choice.objects.filter(institute=applicant1.institute))
applicant = forms.ModelChoiceField(widget=forms.HiddenInput(), initial=applicant1, queryset=Applicant.objects.all() )
class Meta:
model = Application
fields = ['applicant','choice', 'priority']
return ApplicationForm
@login_required(login_url='/admin/login') @login_required(login_url='/admin/login')
def index(request): #for /allocation def index(request):
applicant=Applicant.objects.filter(name=request.user.username)[0] applicant=get_object_or_404(Applicant,name=request.user.username)
# form1 = modelform_factory(Applicant, fields=("name", "rank" )) ApplicationForm = make_application_form(applicant)
formset = AppFormset(queryset=Application.objects.filter(applicant=applicant),) ApplicationFormSet = modelformset_factory(Application, form=ApplicationForm, extra=5)
if request.method == "POST":
formset = ApplicationFormSet(request.POST, queryset=Application.objects.filter(applicant=applicant))
if formset.is_valid():
formset.save()
return render(request, 'allocation/index.html', {'applicant': applicant, 'formset': formset, 'success':True,})
else:
form_errors = formset.errors
return render(request, 'allocation/index.html', {'applicant': applicant, 'formset': formset,'form_errors': form_errors})
else:
formset = ApplicationFormSet(queryset=Application.objects.filter(applicant=applicant),)
return render(request, 'allocation/index.html', {'applicant': applicant, 'formset': formset,}) return render(request, 'allocation/index.html', {'applicant': applicant, 'formset': formset,})
# def submit(request):
# if request.method == 'POST':
# formset = AppFormset(request.POST)
# if formset.is_valid():
# for form in formset:
# if form.is_valid():
# cd = f.cleaned_data
# application.applicant=cd.get('applicant')
# application.choice=cd.get('choice')
# application.priority=cd.get('priority')
# application.save()
# else:
# return HttpResponse('error')
def submit(request):
if request.method == 'POST':
formset = AppFormset(request.POST)
instances = formset.save()
return HttpResponse("successful")
@login_required(login_url='/admin/login') @login_required(login_url='/admin/login')
def admin1(request): def admin1(request):
institute=Institute.objects.filter(name=request.user.username)[0] institute=get_object_or_404(Institute,name=request.user.username)
return render(request, 'allocation/admin1.html',{'institute': institute}) return render(request, 'allocation/admin1.html',{'institute': institute})
class ChoiceListView(generic.ListView): class ChoiceListView(generic.ListView):
model = Choice model = Choice
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
institute=Institute.objects.filter(name=self.request.user.username)[0] institute=get_object_or_404(Institute,name=self.request.user.username)
context = super(ChoiceListView, self).get_context_data(**kwargs) context = super(ChoiceListView, self).get_context_data(**kwargs)
context['institute'] = institute context['institute'] = institute
return context return context
def get_queryset(self): def get_queryset(self):
institute=Institute.objects.filter(name=self.request.user.username)[0] institute=get_object_or_404(Institute,name=self.request.user.username)
return Choice.objects.filter(institute__name=institute.name) return Choice.objects.filter(institute__name=institute.name)
class ApplicantListView(generic.ListView): class ApplicantListView(generic.ListView):
model = Applicant model = Applicant
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
institute=Institute.objects.filter(name=self.request.user.username)[0] institute=get_object_or_404(Institute,name=self.request.user.username)
context = super(ApplicantListView, self).get_context_data(**kwargs) context = super(ApplicantListView, self).get_context_data(**kwargs)
context['institute'] = institute context['institute'] = institute
return context return context
def get_queryset(self): def get_queryset(self):
institute=Institute.objects.filter(name=self.request.user.username)[0] institute=get_object_or_404(Institute,name=self.request.user.username)
return Applicant.objects.filter(institute__name=institute.name) return Applicant.objects.filter(institute__name=institute.name)
class ChoiceDetailView(generic.DetailView): class ChoiceDetailView(generic.DetailView):
model = Choice model = Choice
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
institute=Institute.objects.filter(name=self.request.user.username)[0] institute=get_object_or_404(Institute,name=self.request.user.username)
context = super(ChoiceDetailView, self).get_context_data(**kwargs) context = super(ChoiceDetailView, self).get_context_data(**kwargs)
context['institute'] = institute context['institute'] = institute
return context return context
...@@ -224,11 +243,12 @@ class ChoiceDetailView(generic.DetailView): ...@@ -224,11 +243,12 @@ class ChoiceDetailView(generic.DetailView):
class ApplicantDetailView(generic.DetailView): class ApplicantDetailView(generic.DetailView):
model = Applicant model = Applicant
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
institute=Institute.objects.filter(name=self.request.user.username)[0] institute=get_object_or_404(Institute,name=self.request.user.username)
context = super(ApplicantDetailView, self).get_context_data(**kwargs) context = super(ApplicantDetailView, self).get_context_data(**kwargs)
context['institute'] = institute context['institute'] = institute
return context return context
class ChoiceCreateView(CreateView): class ChoiceCreateView(CreateView):
model = Choice model = Choice
fields = ['choice_name', 'capacity', 'institute'] fields = ['choice_name', 'capacity', 'institute']
...@@ -237,11 +257,45 @@ class ChoiceUpdate(UpdateView): ...@@ -237,11 +257,45 @@ class ChoiceUpdate(UpdateView):
model = Choice model = Choice
fields = ['choice_name','capacity'] fields = ['choice_name','capacity']
template_name_suffix = '_update' template_name_suffix = '_update'
success_url = 'allocation:choice_list' success_url = reverse_lazy('allocation:choice_list')
class ChoiceDelete(DeleteView): 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')
def freeze(request):
if request.method == "POST":
applicant=Applicant.objects.get(pk=request.POST["applicant"])
applicant.is_float=False
applicant.save()
return HttpResponseRedirect('/allocation')
else:
return HttpResponseRedirect('/allocation')
def drop(request):
if request.method == "POST":
applicant=Applicant.objects.get(pk=request.POST["applicant"])
applicant.is_float=False
given_choice=applicant.alloted_choice.all()
if given_choice:
g=given_choice[0]
g.seats_filled=g.seats_filled-1
applicant.alloted_choice.clear()
g.save()
applicant.save()
return HttpResponseRedirect('/allocation')
else:
return HttpResponseRedirect('/allocation')
def float(request):
return HttpResponseRedirect('/allocation')
\ No newline at end of file
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