mirror of
https://github.com/nikdoof/test-auth.git
synced 2025-12-14 06:42:16 +00:00
Added view application
This commit is contained in:
15
hr/views.py
15
hr/views.py
@@ -9,7 +9,8 @@ from django.template import RequestContext
|
||||
|
||||
import settings
|
||||
|
||||
from eve_api.models import EVEPlayerCorporation
|
||||
from eve_api.models import EVEAccount, EVEPlayerCorporation
|
||||
from reddit.models import RedditAccount
|
||||
|
||||
from hr.forms import CreateRecommendationForm, CreateApplicationForm
|
||||
from hr.models import Recommendation, Application
|
||||
@@ -34,6 +35,18 @@ def view_application(request, applicationid):
|
||||
app = Application.objects.get(id=applicationid)
|
||||
except Application.DoesNotExist:
|
||||
return HttpResponseRedirect(reverse('hr.views.index'))
|
||||
|
||||
if not app.user == request.user and not (request.user.is_staff or settings.HR_STAFF_GROUP in request.user.groups.all()):
|
||||
return HttpResponseRedirect(reverse('hr.views.index'))
|
||||
|
||||
eveacc = EVEAccount.objects.filter(user=app.user)
|
||||
redditacc = RedditAccount.objects.filter(user=app.user)
|
||||
recs = Recommendation.objects.filter(application=app)
|
||||
|
||||
posts = []
|
||||
for acc in redditacc:
|
||||
posts.extend(acc.recent_posts())
|
||||
|
||||
return render_to_response('hr/applications/view.html', locals(), context_instance=RequestContext(request))
|
||||
|
||||
@login_required
|
||||
|
||||
43
templates/hr/applications/view.html
Normal file
43
templates/hr/applications/view.html
Normal file
@@ -0,0 +1,43 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}View Application{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h3>Application Details</h3>
|
||||
|
||||
<ul>
|
||||
<li>Applying Auth User: <a href="/users/{{ app.user }}">{{ app.user }}</a></li>
|
||||
<li>Applying Character: {{ app.character }} <button type="button" onclick="CCPEVE.showInfo('1377//{{ app.character.id }}')">Show In Eve</button></li>
|
||||
<li>Application Status: <b>{{ app.status_description }}</b></li>
|
||||
</ul>
|
||||
|
||||
{% if recs %}
|
||||
<h3>Recommendations</h3>
|
||||
<ul>
|
||||
{% for rec in recs %}
|
||||
<li><a href="/users/{{ rec.user }}/">{{ rec.user }}</a> / {{ rec.user_character }} - {{ rec.user_character.corporation }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
|
||||
<h3>EVE Characters</h3>
|
||||
<ul>
|
||||
{% for acc in eveacc %}
|
||||
{% for char in acc.characters.all %}
|
||||
<li><a href="/profile/characters/{{ char.id }}/">{{ char.name }}</a> - {{ char.corporation }}/{{ char.corporation.alliance }} <button type="button" onclick="CCPEVE.showInfo('1377//{{ char.id }}')">Show In Eve</button></li>
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
||||
<h3>Reddit Posts</h3>
|
||||
<ul>
|
||||
{% for post in posts %}
|
||||
{% if post.permalink %}
|
||||
<p><b><a href="http://reddit.com{{ post.permalink }}">{{ post.title }}</a></b> - /r/{{ post.subreddit }}</p>
|
||||
{% else %}
|
||||
<p>{{ post.body }} - <a href="http://reddit.com/comments/{{ post.link_id }}/">Permalink</a></p>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user