mirror of
https://gitlab.com/allianceauth/allianceauth.git
synced 2025-07-15 15:30:16 +02:00
New models for application system
This commit is contained in:
parent
e342be4567
commit
99879e797b
@ -1,7 +1,13 @@
|
|||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
|
|
||||||
from models import HRApplication
|
from models import Application
|
||||||
from models import HRApplicationComment
|
from models import ApplicationQuestion
|
||||||
|
from models import ApplicationForm
|
||||||
|
from models import ApplicationResponse
|
||||||
|
from models import ApplicationComment
|
||||||
|
|
||||||
admin.site.register(HRApplication)
|
admin.site.register(Application)
|
||||||
admin.site.register(HRApplicationComment)
|
admin.site.register(ApplicationComment)
|
||||||
|
admin.site.register(ApplicationQuestion)
|
||||||
|
admin.site.register(ApplicationForm)
|
||||||
|
admin.site.register(ApplicationResponse)
|
||||||
|
@ -4,9 +4,61 @@ from django.contrib.auth.models import User
|
|||||||
from eveonline.models import EveCharacter
|
from eveonline.models import EveCharacter
|
||||||
from eveonline.models import EveCorporationInfo
|
from eveonline.models import EveCorporationInfo
|
||||||
|
|
||||||
|
class ApplicationQuestion(models.Model):
|
||||||
|
title = models.CharField(max_length=100)
|
||||||
|
help_text = models.CharField(max_length=254, blank=True, null=True)
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return "Question: " + self.title
|
||||||
|
|
||||||
|
class ApplicationForm(models.Model):
|
||||||
|
questions = models.ManyToManyField(ApplicationQuestion)
|
||||||
|
corp = models.OneToOneField(EveCorporationInfo)
|
||||||
|
|
||||||
|
class Application(models.Model):
|
||||||
|
form = models.OneToOneField(ApplicationForm, on_delete=models.CASCADE)
|
||||||
|
user = models.ForeignKey(User, on_delete=models.CASCADE, related_name='applications')
|
||||||
|
approved = models.NullBooleanField(blank=True, null=True, default=None)
|
||||||
|
reveiwer = models.ForeignKey(User, on_delete=models.SET_NULL, blank=True, null=True)
|
||||||
|
reveiwer_character = models.ForeignKey(EveCharacter, on_delete=models.SET_NULL, blank=True, null=True)
|
||||||
|
created = models.DateTimeField(auto_now_add=True)
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return self.user + " Application To " + self.corp
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
permissions = (('approve_application', 'Can approve applications'), ('reject_application', 'Can reject applications'), ('view_apis', 'Can view applicant APIs'),)
|
||||||
|
|
||||||
|
class ApplicationResponse(models.Model):
|
||||||
|
question = models.ForeignKey(ApplicationQuestion, on_delete=models.CASCADE)
|
||||||
|
application = models.ForeignKey(Application, on_delete=models.CASCADE)
|
||||||
|
answer = models.TextField()
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return self.form + " Answer To " + self.question
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
unique_together = ('question', 'application')
|
||||||
|
|
||||||
|
class ApplicationComment(models.Model):
|
||||||
|
application = models.ForeignKey(Application, on_delete=models.CASCADE, related_name='comments')
|
||||||
|
user = models.ForeignKey(User, on_delete=models.CASCADE)
|
||||||
|
text = models.TextField()
|
||||||
|
created = models.DateTimeField(auto_now_add=True)
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return self.user + " comment on " + self.application
|
||||||
|
|
||||||
|
################
|
||||||
|
# Legacy Models
|
||||||
|
################
|
||||||
|
# Can't delete or evolutions explodes.
|
||||||
|
# They do nothing.
|
||||||
|
################
|
||||||
class HRApplication(models.Model):
|
class HRApplication(models.Model):
|
||||||
character_name = models.CharField(max_length=254, default="")
|
character_name = models.CharField(max_length=254, default="")
|
||||||
|
full_api_id = models.CharField(max_length=254, default="")
|
||||||
|
full_api_key = models.CharField(max_length=254, default="")
|
||||||
is_a_spi = models.CharField(max_length=254, default="")
|
is_a_spi = models.CharField(max_length=254, default="")
|
||||||
about = models.TextField(default="")
|
about = models.TextField(default="")
|
||||||
extra = models.TextField(default="")
|
extra = models.TextField(default="")
|
||||||
@ -23,9 +75,6 @@ class HRApplication(models.Model):
|
|||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.character_name + " - Application"
|
return self.character_name + " - Application"
|
||||||
|
|
||||||
class Meta:
|
|
||||||
permissions = (('approve_hrapplication', 'Can approve applications'), ('reject_hrapplication', 'Can reject applications'), ('view_apis', 'Can view applicant APIs'),)
|
|
||||||
|
|
||||||
|
|
||||||
class HRApplicationComment(models.Model):
|
class HRApplicationComment(models.Model):
|
||||||
created_on = models.DateTimeField(auto_now_add=True, null=True)
|
created_on = models.DateTimeField(auto_now_add=True, null=True)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user