Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
General_Allocation_Portal
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
codemafia
General_Allocation_Portal
Commits
a14355dd
Commit
a14355dd
authored
Oct 23, 2017
by
KUNAL GOYAL
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
minor changes
parent
67cd18ef
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
9 deletions
+11
-9
project/allocation/__pycache__/views.cpython-36.pyc
project/allocation/__pycache__/views.cpython-36.pyc
+0
-0
project/allocation/templates/allocation/admin1.html
project/allocation/templates/allocation/admin1.html
+2
-0
project/allocation/views.py
project/allocation/views.py
+9
-9
project/db.sqlite3
project/db.sqlite3
+0
-0
No files found.
project/allocation/__pycache__/views.cpython-36.pyc
View file @
a14355dd
No preview for this file type
project/allocation/templates/allocation/admin1.html
View file @
a14355dd
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +5,7 @@
{% endblock %}
{% endblock %}
{% block usertools %}
{% block usertools %}
<div
id=
"user-tools"
>
{% block welcome-msg %}
{% block welcome-msg %}
{% trans 'Welcome,' %}
{% trans 'Welcome,' %}
<strong>
{{institute.name}}
</strong>
.
<strong>
{{institute.name}}
</strong>
.
...
@@ -15,6 +16,7 @@
...
@@ -15,6 +16,7 @@
{% endif %}
{% endif %}
<a
href=
"{% url 'admin:logout' %}"
>
{% trans 'Log out' %}
</a>
<a
href=
"{% url 'admin:logout' %}"
>
{% trans 'Log out' %}
</a>
{% endblock %}
{% endblock %}
</div>
{% endblock %}
{% endblock %}
{% block breadcrumbs %}
{% block breadcrumbs %}
...
...
project/allocation/views.py
View file @
a14355dd
...
@@ -11,7 +11,7 @@ from django.views.generic.edit import *
...
@@ -11,7 +11,7 @@ from django.views.generic.edit import *
from
allocation.models
import
Choice
from
allocation.models
import
Choice
from
allocation.models
import
Applicant
from
allocation.models
import
Applicant
from
django.shortcuts
import
render
,
redirect
from
django.shortcuts
import
render
,
redirect
,
get_object_or_404
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
...
@@ -78,7 +78,7 @@ AppFormset = modelformset_factory(Application,fields=("choice", "priority" ), ex
...
@@ -78,7 +78,7 @@ AppFormset = modelformset_factory(Application,fields=("choice", "priority" ), ex
@
login_required
(
login_url
=
'/admin/login'
)
@
login_required
(
login_url
=
'/admin/login'
)
def
index
(
request
):
#for /allocation
def
index
(
request
):
#for /allocation
applicant
=
Applicant
.
objects
.
filter
(
name
=
request
.
user
.
username
)[
0
]
applicant
=
get_object_or_404
(
Applicant
,
name
=
request
.
user
.
username
)[
0
]
# form1 = modelform_factory(Applicant, fields=("name", "rank" ))
# form1 = modelform_factory(Applicant, fields=("name", "rank" ))
formset
=
AppFormset
(
queryset
=
Application
.
objects
.
filter
(
applicant
=
applicant
),)
formset
=
AppFormset
(
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
,})
...
@@ -107,36 +107,36 @@ def submit(request):
...
@@ -107,36 +107,36 @@ def submit(request):
@
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
)[
0
]
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
=
request
.
user
.
username
)[
0
]
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
=
request
.
user
.
username
)[
0
]
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
=
request
.
user
.
username
)[
0
]
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
=
request
.
user
.
username
)[
0
]
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
=
request
.
user
.
username
)[
0
]
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
...
@@ -144,7 +144,7 @@ class ChoiceDetailView(generic.DetailView):
...
@@ -144,7 +144,7 @@ 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
=
request
.
user
.
username
)[
0
]
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
...
...
project/db.sqlite3
View file @
a14355dd
No preview for this file type
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment