mirror of
https://github.com/nikdoof/test-auth.git
synced 2025-12-14 06:42:16 +00:00
Shows if the recommendation is valid
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
from datetime import datetime
|
||||
from django.conf import settings
|
||||
from django.db import models
|
||||
from django.contrib.auth.models import User
|
||||
from eve_api.models import EVEPlayerCharacter, EVEPlayerCorporation
|
||||
@@ -115,6 +116,13 @@ class Recommendation(models.Model):
|
||||
def get_absolute_url(self):
|
||||
return ('hr.views.view_application', [self.application.id])
|
||||
|
||||
@property
|
||||
def is_valid(self):
|
||||
diff = datetime.utcnow() - self.user_character.corporation_date
|
||||
if diff.days > settings.HR_RECOMMENDATION_DAYS and self.user_character == application.corporation:
|
||||
return True
|
||||
return False
|
||||
|
||||
def __unicode__(self):
|
||||
return self.user_character.name
|
||||
|
||||
|
||||
@@ -148,6 +148,8 @@ REDDIT_PASSWORD = ''
|
||||
|
||||
HR_STAFF_GROUP = 'HR Staff'
|
||||
|
||||
HR_RECOMMENDATION_DAYS = 45
|
||||
|
||||
FULL_API_USER_ID = 415631
|
||||
FULL_API_CHARACTER_ID = 246102445
|
||||
|
||||
|
||||
@@ -66,8 +66,14 @@
|
||||
{% if app.recommendation_set.all %}
|
||||
<h3>Recommendations</h3>
|
||||
<ul>
|
||||
<table>
|
||||
<tr><th>User</th><th>Character</th><th>Corporation</th><th>Valid Recommendation</th></tr>
|
||||
{% for rec in app.recommendation_set.all %}
|
||||
<li><a href="{% url sso.views.user_view rec.user %}">{{ rec.user }}</a> / {{ rec.user_character }} - {{ rec.user_character.corporation }}</li>
|
||||
<tr><td><a href="{% url sso.views.user_view rec.user %}">{{ rec.user }}</a></td>
|
||||
<td><a href="{% sso.views.characters rec.user_character.id %}">{{ rec.user_character }}</a></td>
|
||||
<td><a href="http://evemaps.dotlan.net/corp/{{ rec.user_character.corporation.name }}">{{ rec.user_character.corporation }}</a></td>
|
||||
<td>{% if rec.is_valid %}<font color="green">Yes</font>{% else %}<font color="red">No</font>{% endif %}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
|
||||
Reference in New Issue
Block a user