allocate-button

parent 0d405535
.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-size: 100% 75%;
background-repeat: no-repeat;
background-attachment: fixed;
opacity: 0.60;
}
.content {
position: relative;
margin-top: 300px;
font-size: 60px;
opacity: 20;
}
.tool1 {
margin-top: 680px;
background-color: green;
}
.tool2 {
margin-top: 700px;
background-color: #5DBCD2;
}
.tool3 {
margin-top: 720px;
background-color: #5DBCD2;
}
.tool4 {
margin-top: 720px;
background-color: #5DBCD2;
}
\ No newline at end of file
from django import template
register = template.Library()
@register.assignment_tag
def hello_world(name):
value = name.split('/')[-4]
if value == "institute": return True; return False
\ No newline at end of file
...@@ -10,7 +10,7 @@ urlpatterns = [ ...@@ -10,7 +10,7 @@ urlpatterns = [
url(r'^admin$', views.admin1, name='admin1'), url(r'^admin$', views.admin1, name='admin1'),
url(r'^import_db$', views.import_db, name='import_db1'), url(r'^import_db$', views.import_db, name='import_db1'),
url(r'^applicant_make$', views.applicant_make, name='applicant_make'), url(r'^applicant_make$', views.applicant_make, name='applicant_make'),
url(r'^button_action$', views.button_action, name='button_action'),
#url(r'^admin/choices$', views.ChoiceListView.as_view(), name='choice_list'), #url(r'^admin/choices$', views.ChoiceListView.as_view(), name='choice_list'),
#url(r'^admin/applicants$', views.ApplicantListView.as_view(), name='applicant_list'), #url(r'^admin/applicants$', views.ApplicantListView.as_view(), name='applicant_list'),
#url(r'^login/$', auth_views.login,name='login'), #url(r'^login/$', auth_views.login,name='login'),
......
...@@ -7,7 +7,6 @@ from allocation.models import * ...@@ -7,7 +7,6 @@ from allocation.models import *
from django.forms import modelform_factory from django.forms import modelform_factory
from django.forms import modelformset_factory from django.forms import modelformset_factory
from django.views import generic from django.views import generic
from allocation.models import Choice from allocation.models import Choice
from allocation.models import Applicant from allocation.models import Applicant
from django.shortcuts import render, redirect from django.shortcuts import render, redirect
...@@ -15,6 +14,7 @@ from django.conf import settings ...@@ -15,6 +14,7 @@ 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
from alloc import *
import csv import csv
# @login_required(login_url='/admin/login') # @login_required(login_url='/admin/login')
# def index(request): #for /allocation # def index(request): #for /allocation
...@@ -25,16 +25,16 @@ import csv ...@@ -25,16 +25,16 @@ import csv
# form = ArticleForm(instance=applicant) # form = ArticleForm(instance=applicant)
# return render(request, 'allocation/index.html', {'applicant': applicant, 'form': form}) # return render(request, 'allocation/index.html', {'applicant': applicant, 'form': form})
def index(request):
return HttpResponse("Hello, world. You're at the allocation index.")
def index1(request): def index1(request):
return render(request,'core/home_page.html') return render(request,'core/home_page.html')
def home(request): def button_action(request):
documents = Document.objects.all() value = request.POST["prikey"]
return render(request, 'core/home.html', { 'documents': documents }) value = int(value.split('/')[-3])
return HttpResponse("On home") name = Institute.objects.get(pk=value).name
allocator(name)
return HttpResponse("success")
def import_db(request): def import_db(request):
if request.method == "POST": if request.method == "POST":
......
No preview for this file type
{% extends "admin/change_form.html" %}
{% load i18n %}
{% load tag %}
{% block object-tools-items %}
{{ block.super }}
{% hello_world request.get_full_path as name %}
{% if name == True %}
<li>
<form method="POST" action="/allocation/button_action" enctype="multipart/form-data">
{% csrf_token %}
<input type="hidden" name="prikey" value="{{ request.get_full_path }}">
<button type="submit"> Allocate</button>
</form>
</li>
{% endif %}
{% endblock %}
\ No newline at end of file
...@@ -26,4 +26,15 @@ ...@@ -26,4 +26,15 @@
{% endif %} {% endif %}
<!-- {% if request.get_full_path == "/admin/allocation/institute/1/change/" %}
<li>
<form method="POST" action="/allocation/button_action" enctype="multipart/form-data">
{% csrf_token %}
<button type="submit"> Allocate</button>
</form>
</li>
{% endif %} -->
{% endblock %} {% endblock %}
{% load static %}
<html> <html>
<head> <head>
<link rel="stylesheet" type="text/css" href="allocation/home_page.css"> <link rel="stylesheet" type="text/css" href="{% static 'allocation/home_page.css' %}" />
</head> </head>
<body> <body>
<table > <table >
<tr> <tr>
<td rowspan="2"><a class="logoText"><img src="logo.png" width="150" height="150" alt="logo"></a></td> <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> <td style="vertical-align: bottom; padding-left:5px; padding-bottom: 2px; font-size: 20px"><a class="logoText" ><B>codeMAFIA</B></a></td>
</tr> </tr>
<tr> <tr>
...@@ -17,7 +18,7 @@ ...@@ -17,7 +18,7 @@
<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: 570px; text-align: center; font-size: 30px;"> <div class="tool1" style="margin-top: 460px; 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; font-size: 50px; color: white">
......
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