diff --git a/hr/models.py b/hr/models.py index b990bee..cfa4748 100644 --- a/hr/models.py +++ b/hr/models.py @@ -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 diff --git a/settings.py b/settings.py index b2c7cfb..05d7975 100755 --- a/settings.py +++ b/settings.py @@ -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 diff --git a/templates/hr/applications/view.html b/templates/hr/applications/view.html index 044ff55..1aab136 100644 --- a/templates/hr/applications/view.html +++ b/templates/hr/applications/view.html @@ -66,8 +66,14 @@ {% if app.recommendation_set.all %}

Recommendations