mirror of
https://gitlab.com/allianceauth/allianceauth.git
synced 2025-07-09 12:30:15 +02:00
Added the task to auto update corp and alliance info
This commit is contained in:
parent
763b3c8230
commit
884d39c148
@ -65,6 +65,14 @@ urlpatterns = patterns('',
|
|||||||
name="auth_hrapplications_view"),
|
name="auth_hrapplications_view"),
|
||||||
url(r'^hr_application_create/', 'hrapplications.views.hr_application_create_view',
|
url(r'^hr_application_create/', 'hrapplications.views.hr_application_create_view',
|
||||||
name="auth_hrapplication_create_view"),
|
name="auth_hrapplication_create_view"),
|
||||||
|
url(r'^hr_application_remove/(\w+)', 'hrapplications.views.hr_application_remove',
|
||||||
|
name="auth_hrapplication_remove"),
|
||||||
|
url(r'hr_application_view/(\w+)', 'hrapplications.views.hr_application_view',
|
||||||
|
name="auth_hrapplication_view"),
|
||||||
|
url(r'hr_application_personal_view/', 'hrapplications.views.hr_application_personal_view',
|
||||||
|
name="auth_hrapplication_personal_view"),
|
||||||
|
url(r'hr_application_personal_removal/', 'hrapplications.views.hr_application_personal_removal',
|
||||||
|
name="auth_hrapplication_personal_removal"),
|
||||||
|
|
||||||
# Service Urls
|
# Service Urls
|
||||||
url(r'^services/', 'services.views.services_view', name='auth_services'),
|
url(r'^services/', 'services.views.services_view', name='auth_services'),
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
|
|
||||||
from models import HRApplications
|
from models import HRApplication
|
||||||
from models import HRApplicationComment
|
from models import HRApplicationComment
|
||||||
|
|
||||||
|
|
||||||
admin.site.register(HRApplications)
|
admin.site.register(HRApplication)
|
||||||
admin.site.register(HRApplicationComment)
|
admin.site.register(HRApplicationComment)
|
@ -1,11 +1,17 @@
|
|||||||
from django import forms
|
from django import forms
|
||||||
|
|
||||||
|
from eveonline.models import EveCorporationInfo
|
||||||
|
|
||||||
|
|
||||||
class HRApplicationForm(forms.Form):
|
class HRApplicationForm(forms.Form):
|
||||||
|
allchoices = []
|
||||||
|
for corp in EveCorporationInfo.objects.all():
|
||||||
|
allchoices.append((str(corp.corporation_id), str(corp.corporation_name)))
|
||||||
|
|
||||||
character_name = forms.CharField(max_length=254, required=True, label="Main Character Name")
|
character_name = forms.CharField(max_length=254, required=True, label="Main Character Name")
|
||||||
full_api_id = forms.CharField(max_length=254, required=True, label="API ID")
|
full_api_id = forms.CharField(max_length=254, required=True, label="API ID")
|
||||||
full_api_key = forms.CharField(max_length=254, required=True, label="API Verification Code")
|
full_api_key = forms.CharField(max_length=254, required=True, label="API Verification Code")
|
||||||
preferred_corp = forms.CharField(max_length=254, required=True, label="Preferred Corp")
|
corp = forms.ChoiceField(choices=allchoices, required=True, label="Corp")
|
||||||
is_a_spi = forms.ChoiceField(choices=[('Yes', 'Yes'), ('No', 'No')], required=True, label='Are you a spy?')
|
is_a_spi = forms.ChoiceField(choices=[('Yes', 'Yes'), ('No', 'No')], required=True, label='Are you a spy?')
|
||||||
about = forms.CharField(widget=forms.Textarea, required=False, label="About You")
|
about = forms.CharField(widget=forms.Textarea, required=False, label="About You")
|
||||||
extra = forms.CharField(widget=forms.Textarea, required=False, label="Extra Application Info")
|
extra = forms.CharField(widget=forms.Textarea, required=False, label="Extra Application Info")
|
@ -1,18 +1,23 @@
|
|||||||
from django.db import models
|
from django.db import models
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
|
|
||||||
|
from eveonline.models import EveCorporationInfo
|
||||||
|
|
||||||
class HRApplications(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_id = models.CharField(max_length=254, default="")
|
||||||
full_api_key = models.CharField(max_length=254, default="")
|
full_api_key = models.CharField(max_length=254, default="")
|
||||||
preferred_corp = 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="")
|
||||||
|
|
||||||
|
corp = models.ForeignKey(EveCorporationInfo)
|
||||||
user = models.ForeignKey(User)
|
user = models.ForeignKey(User)
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return self.character_name + " - Application"
|
||||||
|
|
||||||
|
|
||||||
class HRApplicationComment(models.Model):
|
class HRApplicationComment(models.Model):
|
||||||
date = models.DateTimeField(auto_now=True)
|
date = models.DateTimeField(auto_now=True)
|
||||||
|
@ -1,13 +1,36 @@
|
|||||||
from django.template import RequestContext
|
from django.template import RequestContext
|
||||||
from django.shortcuts import render_to_response
|
from django.shortcuts import render_to_response
|
||||||
|
from django.contrib.auth.decorators import permission_required
|
||||||
from django.contrib.auth.decorators import login_required
|
from django.contrib.auth.decorators import login_required
|
||||||
|
from django.shortcuts import HttpResponseRedirect
|
||||||
|
|
||||||
|
from models import HRApplication
|
||||||
from forms import HRApplicationForm
|
from forms import HRApplicationForm
|
||||||
|
from eveonline.models import EveCorporationInfo
|
||||||
|
from eveonline.models import EveCharacter
|
||||||
|
from authentication.models import AuthServicesInfo
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
def hr_application_management_view(request):
|
def hr_application_management_view(request):
|
||||||
context = {}
|
personal_app = None
|
||||||
|
corp_applications = None
|
||||||
|
|
||||||
|
if request.user.is_superuser:
|
||||||
|
corp_applications = HRApplication.objects.all()
|
||||||
|
else:
|
||||||
|
# Get the corp the member is in
|
||||||
|
auth_info = AuthServicesInfo.objects.get(user=request.user)
|
||||||
|
if auth_info.main_char_id != "":
|
||||||
|
main_char = EveCharacter.objects.get(character_id=auth_info.main_char_id)
|
||||||
|
corp = EveCorporationInfo.objects.get(corporation_id=main_char.corporation_id)
|
||||||
|
corp_applications = HRApplication.objects.filter(corp=corp)
|
||||||
|
|
||||||
|
if HRApplication.objects.filter(user=request.user).exists():
|
||||||
|
personal_app = HRApplication.objects.get(user=request.user)
|
||||||
|
|
||||||
|
context = {'personal_app': personal_app,
|
||||||
|
'applications': corp_applications}
|
||||||
|
|
||||||
return render_to_response('registered/hrapplicationmanagement.html',
|
return render_to_response('registered/hrapplicationmanagement.html',
|
||||||
context, context_instance=RequestContext(request))
|
context, context_instance=RequestContext(request))
|
||||||
@ -15,13 +38,68 @@ def hr_application_management_view(request):
|
|||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
def hr_application_create_view(request):
|
def hr_application_create_view(request):
|
||||||
|
success = False
|
||||||
|
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
form = HRApplicationForm(request.POST)
|
form = HRApplicationForm(request.POST)
|
||||||
if form.is_valid():
|
if form.is_valid():
|
||||||
pass
|
application = HRApplication()
|
||||||
|
application.user = request.user
|
||||||
|
application.character_name = form.cleaned_data['character_name']
|
||||||
|
application.full_api_id = form.cleaned_data['full_api_id']
|
||||||
|
application.full_api_key = form.cleaned_data['full_api_key']
|
||||||
|
application.corp = EveCorporationInfo.objects.get(corporation_id=form.cleaned_data['corp'])
|
||||||
|
application.is_a_spi = form.cleaned_data['is_a_spi']
|
||||||
|
application.about = form.cleaned_data['about']
|
||||||
|
application.extra = form.cleaned_data['extra']
|
||||||
|
application.save()
|
||||||
|
success = True
|
||||||
else:
|
else:
|
||||||
form = HRApplicationForm
|
form = HRApplicationForm()
|
||||||
|
|
||||||
context = {'form': form}
|
context = {'form': form, 'success': success}
|
||||||
return render_to_response('registered/hrcreateapplication.html',
|
return render_to_response('registered/hrcreateapplication.html',
|
||||||
context, context_instance=RequestContext(request))
|
context, context_instance=RequestContext(request))
|
||||||
|
|
||||||
|
|
||||||
|
@login_required
|
||||||
|
def hr_application_personal_view(request):
|
||||||
|
if HRApplication.objects.filter(user=request.user).exists():
|
||||||
|
application = HRApplication.objects.get(user=request.user)
|
||||||
|
|
||||||
|
context = {'application': application}
|
||||||
|
|
||||||
|
return render_to_response('registered/hrapplicationview.html',
|
||||||
|
context, context_instance=RequestContext(request))
|
||||||
|
|
||||||
|
|
||||||
|
@login_required
|
||||||
|
def hr_application_personal_removal(request):
|
||||||
|
if HRApplication.objects.filter(user=request.user).exists():
|
||||||
|
application = HRApplication.objects.get(user=request.user)
|
||||||
|
application.delete()
|
||||||
|
|
||||||
|
return HttpResponseRedirect("/hr_application_management/")
|
||||||
|
|
||||||
|
|
||||||
|
@login_required
|
||||||
|
@permission_required('auth.human_resources')
|
||||||
|
def hr_application_view(request, app_id):
|
||||||
|
if HRApplication.objects.filter(id=app_id).exists():
|
||||||
|
application = HRApplication.objects.get(id=app_id)
|
||||||
|
|
||||||
|
context = {'application': application}
|
||||||
|
|
||||||
|
return render_to_response('registered/hrapplicationview.html',
|
||||||
|
context, context_instance=RequestContext(request))
|
||||||
|
|
||||||
|
|
||||||
|
@login_required
|
||||||
|
@permission_required('auth.human_resources')
|
||||||
|
def hr_application_remove(request, app_id):
|
||||||
|
if HRApplication.objects.filter(id=app_id).exists():
|
||||||
|
application = HRApplication.objects.get(id=app_id)
|
||||||
|
if application:
|
||||||
|
application.delete()
|
||||||
|
|
||||||
|
return HttpResponseRedirect("/hr_application_management/")
|
@ -91,11 +91,14 @@
|
|||||||
href="{% url 'auth_help' %}"><i
|
href="{% url 'auth_help' %}"><i
|
||||||
class="fa fa-question fa-fw grayiconecolor"></i> Help</a>
|
class="fa fa-question fa-fw grayiconecolor"></i> Help</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
{% if not perms.auth.alliance_member or perms.auth.human_resources %}
|
||||||
<li>
|
<li>
|
||||||
<a {% ifequal request.path "/hr_application_management/" %} class="active" {% endifequal %}
|
<a {% ifequal request.path "/hr_application_management/" %} class="active" {% endifequal %}
|
||||||
href="{% url 'auth_hrapplications_view' %}"><i
|
href="{% url 'auth_hrapplications_view' %}"><i
|
||||||
class="fa fa-file-o fa-fw grayiconecolor"></i> Applications</a>
|
class="fa fa-file-o fa-fw grayiconecolor"></i> Applications</a>
|
||||||
</li>
|
</li>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
<li class="text-center divider-horizontal">
|
<li class="text-center divider-horizontal">
|
||||||
<h5>Util</h5>
|
<h5>Util</h5>
|
||||||
|
@ -9,15 +9,78 @@
|
|||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="col-lg-12">
|
<div class="col-lg-12">
|
||||||
<h1 class="page-header text-center">HR Applications
|
{% if not perms.auth.alliance_member %}
|
||||||
|
<h1 class="page-header text-center">Personal Applications
|
||||||
<div class="text-right">
|
<div class="text-right">
|
||||||
<a href="{% url 'auth_hrapplication_create_view' %}">
|
<a href="{% url 'auth_hrapplication_create_view' %}">
|
||||||
<button type="button" class="btn btn-success">Create Application</button>
|
{% if personal_app %}
|
||||||
|
<button type="button" class="btn btn-success" disabled>Create Application</button>
|
||||||
|
{% else %}
|
||||||
|
<button type="button" class="btn btn-success">Create Application</button>
|
||||||
|
{% endif %}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</h1>
|
</h1>
|
||||||
<div class="container-fluid">
|
<table class="table table-bordered">
|
||||||
</div>
|
<tr>
|
||||||
|
<th class="text-center">Application ID</th>
|
||||||
|
<th class="text-center">Username</th>
|
||||||
|
<th class="text-center">Main Character</th>
|
||||||
|
<th class="text-center">Corporation</th>
|
||||||
|
<th class="text-center">Actions</th>
|
||||||
|
</tr>
|
||||||
|
{% if personal_app %}
|
||||||
|
<tr>
|
||||||
|
<td class="text-center">{{ personal_app.id }}</td>
|
||||||
|
<td class="text-center">{{ personal_app.user.username }}</td>
|
||||||
|
<td class="text-center">{{ personal_app.character_name }}</td>
|
||||||
|
<td class="text-center">{{ personal_app.corp.corporation_name }}</td>
|
||||||
|
<td class="text-center">
|
||||||
|
<a href="/hr_application_personal_view/">
|
||||||
|
<button type="button" class="btn btn-primary"><span
|
||||||
|
class="glyphicon glyphicon-eye-open"></span></button>
|
||||||
|
</a>
|
||||||
|
<a href="/hr_application_personal_removal/">
|
||||||
|
<button type="button" class="btn btn-danger"><span
|
||||||
|
class="glyphicon glyphicon-remove"></span></button>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% endif %}
|
||||||
|
</table>
|
||||||
|
{% endif %}
|
||||||
|
{% if perms.auth.human_resources %}
|
||||||
|
<h1 class="page-header text-center">Application Management</h1>
|
||||||
|
<div class="container-fluid">
|
||||||
|
<table class="table table-bordered">
|
||||||
|
<tr>
|
||||||
|
<th class="text-center">Application ID</th>
|
||||||
|
<th class="text-center">Username</th>
|
||||||
|
<th class="text-center">Main Character</th>
|
||||||
|
<th class="text-center">Corporation</th>
|
||||||
|
<th class="text-center">Actions</th>
|
||||||
|
</tr>
|
||||||
|
{% for app in applications %}
|
||||||
|
<tr>
|
||||||
|
<td class="text-center">{{ app.id }}</td>
|
||||||
|
<td class="text-center">{{ app.user.username }}</td>
|
||||||
|
<td class="text-center">{{ app.character_name }}</td>
|
||||||
|
<td class="text-center">{{ app.corp.corporation_name }}</td>
|
||||||
|
<td class="text-center">
|
||||||
|
<a href="/hr_application_view/{{ app.id }}">
|
||||||
|
<button type="button" class="btn btn-primary"><span
|
||||||
|
class="glyphicon glyphicon-eye-open"></span></button>
|
||||||
|
</a>
|
||||||
|
<a href="/hr_application_remove/{{ app.id }}">
|
||||||
|
<button type="button" class="btn btn-danger"><span
|
||||||
|
class="glyphicon glyphicon-remove"></span></button>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% endblock content %}
|
{% endblock content %}
|
||||||
|
88
templates/registered/hrapplicationview.html
Normal file
88
templates/registered/hrapplicationview.html
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
{% extends "public/base.html" %}
|
||||||
|
{% load bootstrap %}
|
||||||
|
{% load staticfiles %}
|
||||||
|
|
||||||
|
{% block title %}Alliance Auth - View Application{% endblock %}
|
||||||
|
|
||||||
|
{% block page_title %}View Application{% endblock page_title %}
|
||||||
|
{% block extra_css %}{% endblock extra_css %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div class="col-lg-12">
|
||||||
|
<h1 class="page-header text-center">Create Application</h1>
|
||||||
|
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="col-md-4 col-md-offset-4">
|
||||||
|
<div class="row">
|
||||||
|
<form class="form-signin">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label" for="id_character_name">User Account</label>
|
||||||
|
|
||||||
|
<div class=" ">
|
||||||
|
<input class=" form-control" value="{{ application.user.username }}" disabled>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label" for="id_character_name">Main Character Name</label>
|
||||||
|
|
||||||
|
<div class=" ">
|
||||||
|
<input class=" form-control" value="{{ application.character_name }}" disabled>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label" for="id_full_api_id">API ID</label>
|
||||||
|
|
||||||
|
<div class=" ">
|
||||||
|
<input class=" form-control" value="{{ application.full_api_id }}" disabled>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label " for="id_full_api_key">API Verification Code</label>
|
||||||
|
|
||||||
|
<div class=" ">
|
||||||
|
<input class=" form-control" value="{{ application.full_api_key }}" disabled>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label " for="id_corp">Corp</label>
|
||||||
|
|
||||||
|
<div class=" ">
|
||||||
|
<select class=" form-control" id="id_corp" name="corp" disabled>
|
||||||
|
<option value="98076553">{{ application.corp.corporation_name }}</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label " for="id_is_a_spi">Is a spy</label>
|
||||||
|
|
||||||
|
<div class=" ">
|
||||||
|
<select class=" form-control" id="id_is_a_spi" name="is_a_spi" disabled>
|
||||||
|
<option value="">{{ application.is_a_spi }}</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label " for="id_about">About</label>
|
||||||
|
|
||||||
|
<div class=" ">
|
||||||
|
<textarea class=" form-control" cols="40" id="id_about" name="about" rows="10"
|
||||||
|
disabled>{{ application.about }}</textarea>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label " for="id_extra">Extra Application Info</label>
|
||||||
|
|
||||||
|
<div class=" ">
|
||||||
|
<textarea class=" form-control" cols="40" id="id_extra" name="extra" rows="10"
|
||||||
|
disabled>{{ application.extra }}</textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<br>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{% endblock content %}
|
@ -14,12 +14,16 @@
|
|||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<div class="col-md-4 col-md-offset-4">
|
<div class="col-md-4 col-md-offset-4">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<form class="form-signin" role="form" action="" method="POST">
|
{% if success %}
|
||||||
{% csrf_token %}
|
<div class="alert alert-success text-center" role="alert">Application Submitted</div>
|
||||||
{{ form|bootstrap }}
|
{% else %}
|
||||||
<br/>
|
<form class="form-signin" role="form" action="" method="POST">
|
||||||
<button class="btn btn-lg btn-primary btn-block" type="submit">Submit Application</button>
|
{% csrf_token %}
|
||||||
</form>
|
{{ form|bootstrap }}
|
||||||
|
<br/>
|
||||||
|
<button class="btn btn-lg btn-primary btn-block" type="submit">Submit Application</button>
|
||||||
|
</form>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -7,6 +7,7 @@ def bootstrap_permissions():
|
|||||||
ct = ContentType.objects.get_for_model(User)
|
ct = ContentType.objects.get_for_model(User)
|
||||||
Permission.objects.get_or_create(codename="group_management", content_type=ct, name="group_management")
|
Permission.objects.get_or_create(codename="group_management", content_type=ct, name="group_management")
|
||||||
Permission.objects.get_or_create(codename="jabber_broadcast", content_type=ct, name="jabber_broadcast")
|
Permission.objects.get_or_create(codename="jabber_broadcast", content_type=ct, name="jabber_broadcast")
|
||||||
|
Permission.objects.get_or_create(codename="human_resources", content_type=ct, name="human_resources")
|
||||||
|
|
||||||
|
|
||||||
def add_member_permission(user, permission):
|
def add_member_permission(user, permission):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user