Compare commits
3 Commits
master
...
chloesBran
Author | SHA1 | Date |
---|---|---|
Chloe Oltramari | b0d1aa1b00 | |
Chloe Oltramari | f5f10c5414 | |
Chloe Oltramari | b184564c83 |
140
README.md
140
README.md
|
@ -1,79 +1,61 @@
|
|||
# eva
|
||||
|
||||
A simple tool for on- and offboarding people in a mid sized organisation.
|
||||
|
||||
"EVA" is an german acronym for "Eintritt, Veränderung, Austritt",
|
||||
meaning "Onboarding, Change, Offboarding"
|
||||
|
||||
# development
|
||||
|
||||
- install gettext for instance via `apt install gettext` for translations
|
||||
- set up a virtual environment with virtualenvwrapper or some other environment managing tool
|
||||
- use this environment and do
|
||||
```
|
||||
pip install django django-multiselectfield django-formtools django-allauth
|
||||
```
|
||||
- clone this repository
|
||||
- `ln -sr eva/settings_development.py eva/settings.py`
|
||||
- initialise your database with `python manage.py migrate`
|
||||
- start your development server with `python manage.py runserver`
|
||||
|
||||
# oauth
|
||||
|
||||
- You need to add oauth information in the django backend via .../admin in "Social Accounts"
|
||||
|
||||
# production
|
||||
|
||||
- you can use gunicorn as server for example instead of the django development server.
|
||||
- we use whitenoise for serving static files
|
||||
- we still use the development SQLITE database from django
|
||||
|
||||
do the following in the project main directory:
|
||||
```
|
||||
ln -sr eva/settings_production.py eva/settings.py
|
||||
```
|
||||
edit /secrets.json to contain something similar to
|
||||
```
|
||||
{
|
||||
"SECRET_KEY": "THIS IS ANOTHER SECRET!"
|
||||
}
|
||||
```
|
||||
run the following commands:
|
||||
```
|
||||
python3 manage.py migrate
|
||||
python3 manage.py collectstatic
|
||||
django-admin compilemessages
|
||||
```
|
||||
|
||||
As root create a file `/etc/systemd/system` (it's already deployed by puppet when the corresponding manifest is applied):
|
||||
|
||||
```
|
||||
# /etc/systemd/system/eva.service
|
||||
#
|
||||
|
||||
[Unit]
|
||||
Description=gunicorn EVA daemon
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=eva
|
||||
Group=eva
|
||||
RuntimeDirectory=eva
|
||||
WorkingDirectory=/home/eva/eva
|
||||
Environment=PYTHONUNBUFFERED=TRUE
|
||||
ExecStart=/usr/bin/gunicorn --forwarded-allow-ips='*' -b '0:8000' eva.wsgi
|
||||
ExecReload=/bin/kill -s HUP $MAINPID
|
||||
KillMode=mixed
|
||||
TimeoutStopSec=5
|
||||
PrivateTmp=true
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
```
|
||||
|
||||
Adapt the paths in the file accordingly. Then, still as root, run:
|
||||
```
|
||||
systemctl enable --now eva.service
|
||||
```
|
||||
This enables the service to start at boot time and starts it immediately now. The daemon logs to the journal. You can see the last 10 lines by running `systemctl status eva.service` or the whole log by running `journalctl -u eva.service`. The usual switches to manipulate that output are available.
|
||||
# eva
|
||||
|
||||
A simple tool for on- and offboarding people in a mid sized organisation.
|
||||
|
||||
"EVA" is an german acronym for "Eintritt, Veränderung, Austritt",
|
||||
meaning "Onboarding, Change, Offboarding"
|
||||
|
||||
# development
|
||||
|
||||
- install gettext for instance via "apt install gettext" for translations
|
||||
|
||||
- set up a virtual environment with virtualenvwrapper or some other
|
||||
environment managing tool
|
||||
|
||||
- use this environment and do
|
||||
|
||||
pip install django django-multiselectfield django-formtools django-allauth
|
||||
|
||||
- clone this repository
|
||||
|
||||
- ln -sr eva/settings_development.py eva/settings.py
|
||||
|
||||
- initialise your database with
|
||||
|
||||
python manage.py migrate
|
||||
|
||||
- start your development server with
|
||||
|
||||
python manage.py runserver
|
||||
|
||||
# oauth
|
||||
|
||||
- You need to add oauth information in the django backend via .../admin in "Social Accounts"
|
||||
|
||||
# production
|
||||
|
||||
- you can use gunicorn as server for example instead of the django development server.
|
||||
|
||||
- we use whitenoise for serving static files
|
||||
|
||||
- we still use the development SQLITE database from django
|
||||
|
||||
do the following in the project main directory:
|
||||
|
||||
ln -sr eva/settings_production.py eva/settings.py
|
||||
|
||||
edit /secrets.json to contain something similar to
|
||||
|
||||
{
|
||||
"SECRET_KEY": "THIS IS ANOTHER SECRET!"
|
||||
}
|
||||
|
||||
run the following commands:
|
||||
|
||||
python3 manage.py migrate
|
||||
python3 manage.py collectstatic
|
||||
django-admin compilemessages
|
||||
|
||||
server starts with
|
||||
|
||||
export PYTHONUNBUFFERED=TRUE; nohup gunicorn --forwarded-allow-ips="*" -b '0:8000' eva.wsgi &> logfile &
|
||||
|
|
|
@ -65,7 +65,8 @@ MIDDLEWARE = [
|
|||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||
'django.contrib.messages.middleware.MessageMiddleware',
|
||||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||
]
|
||||
'allauth.account.middleware.AccountMiddleware'
|
||||
]
|
||||
|
||||
ROOT_URLCONF = 'eva.urls'
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ class PersonalForm(EvaForm):
|
|||
|
||||
class Meta:
|
||||
model = Employee
|
||||
fields = ['firstname', 'lastname', 'department', 'team', ]
|
||||
fields = ['firstname', 'lastname', 'department', 'team', 'add_to_wikimediade',]
|
||||
|
||||
class WorkingForm(EvaForm):
|
||||
|
||||
|
@ -57,8 +57,8 @@ class ITForm(EvaForm):
|
|||
class Meta:
|
||||
model = Employee
|
||||
fields = [
|
||||
'vendor', 'os', 'keyboard', 'screen', 'mobile', 'comment',
|
||||
'language', 'accounts', 'lists', 'rebu2go' ]
|
||||
'vendor', 'os', 'keyboard', 'screen', 'mobile', 'landline',
|
||||
'comment', 'language', 'accounts', 'lists', 'rebu2go' ]
|
||||
|
||||
class OfficeForm(EvaForm):
|
||||
class Meta:
|
||||
|
|
|
@ -20,6 +20,7 @@ class Migration(migrations.Migration):
|
|||
('lastname', models.CharField(max_length=50, verbose_name='Nachname')),
|
||||
('department', models.CharField(choices=[('PROG', 'Programme'), ('SOFT', 'Softwareentwicklung'), ('CENT', 'Central'), ('VOR', 'Vorstand')], max_length=5, verbose_name='Bereich')),
|
||||
('team', models.CharField(blank=True, max_length=20, null=True)),
|
||||
('add_to_wikimediade', models.BooleanField(default=False, verbose_name='Soll auf wikimedia.de irgendwo stehen?')),
|
||||
('firstdate_employment', models.DateField(null=True, verbose_name='Erster Arbeitstag')),
|
||||
('firstdate_presence', models.DateField(null=True, verbose_name='Erster Tag der Anwesenheit in der Geschäftsstelle')),
|
||||
('jobdescription_german', models.CharField(max_length=100, null=True, verbose_name='Stellenbezeichnung(deutsch)')),
|
||||
|
@ -30,6 +31,7 @@ class Migration(migrations.Migration):
|
|||
('os', models.CharField(choices=[('UBU', 'Ubuntu (Standard)'), ('WIN', 'Windows (bitte Begründung angeben)'), ('MOS', 'Mac OS (nur wenn Mac gewählt)')], default='UBU', max_length=3, verbose_name='Betriebssystem')),
|
||||
('screen', models.BooleanField(default=False, verbose_name='Zusätzlicher Monitor? Einer ist standard.')),
|
||||
('mobile', models.BooleanField(default=False, max_length=6, verbose_name='Diensttelefon (Handy)')),
|
||||
('landline', models.BooleanField(default=False, verbose_name='Festnetznummer (Sipgate)')),
|
||||
('keyboard', models.CharField(choices=[('DE', 'Deutsch'), ('US', 'USA'), ('OT', 'Anderes (Bitte unten angeben)')], default='DE', max_length=2, verbose_name='Tastaturlayout')),
|
||||
('comment', models.TextField(blank=True, max_length=500, null=True, verbose_name='zusätzliche IT-Anforderungen')),
|
||||
('language', models.CharField(choices=[('GER', 'Deutsch'), ('ENG', 'English')], default='GER', max_length=3, verbose_name='Sprache')),
|
||||
|
|
|
@ -52,6 +52,7 @@ class Employee(models.Model):
|
|||
# intern = models.BooleanField(verbose_name='Interne_r Mitarbeiter_in?', default=True)
|
||||
department = models.CharField(max_length=5, choices=DEPARTMENT_CHOICES.items(), verbose_name=_('Bereich'))
|
||||
team = models.CharField(max_length=50, null=True, blank=True) # TODO? better with choices?
|
||||
add_to_wikimediade = models.BooleanField(default = False, verbose_name=_('Soll auf wikimedia.de irgendwo stehen?'))
|
||||
|
||||
# general work related stuff
|
||||
firstdate_employment = models.DateField(null=True, verbose_name=_("Erster Arbeitstag"))
|
||||
|
@ -66,6 +67,7 @@ class Employee(models.Model):
|
|||
os = models.CharField(max_length=3, choices=OS_CHOICES.items(), default='UBU', verbose_name=_('Betriebssystem'))
|
||||
screen = models.BooleanField(default=False, verbose_name=_('Zusätzlicher Monitor? Einer ist standard.'))
|
||||
mobile = models.BooleanField(max_length=6, default=False, verbose_name=_('Diensttelefon (Handy)'))
|
||||
landline = models.BooleanField(default = False, verbose_name=_('Festnetznummer (Sipgate)'))
|
||||
# sim = models.BooleanField(default=False, verbose_name="Mobilfunkvertrag")
|
||||
keyboard = models.CharField(max_length=2, choices=KEYBOARD_CHOICES.items(), default='DE', verbose_name=_("Tastaturlayout"))
|
||||
comment = models.TextField(max_length=500, null=True, blank=True, verbose_name=_("zusätzliche IT-Anforderungen"))
|
||||
|
|
|
@ -9,6 +9,7 @@ BASIC_DATA = ['firstname', 'lastname', 'firstdate_employment', 'firstdate_presen
|
|||
'jobdescription_german', 'jobdescription_english',]
|
||||
|
||||
# for every department: 'MAIL' => mail adress, 'DATA': additional fields to include
|
||||
# also one copy with all fields to the person filling the form.
|
||||
MAILS = {
|
||||
'IT': {
|
||||
'MAIL': 'wmde-it@wikimedia.de',
|
||||
|
@ -28,7 +29,7 @@ MAILS = {
|
|||
'KOMM': {
|
||||
'MAIL': 'presse@wikimedia.de',
|
||||
'DATA': [
|
||||
'department', 'team',
|
||||
'department', 'team', 'add_to_wikimediade'
|
||||
],
|
||||
},
|
||||
'CENTRAL': {
|
||||
|
@ -54,5 +55,13 @@ MAILS = {
|
|||
'DATA': [
|
||||
'rebu2go'
|
||||
]
|
||||
},
|
||||
'SUBMITTER': {
|
||||
'MAIL': 'submitter@wikimedia.de',
|
||||
'DATA': [
|
||||
'department', 'team', 'add_to_wikimediade', 'remote', 'desk', 'vendor',
|
||||
'os', 'screen', 'mobile', 'landline', 'keyboard', 'comment', 'language',
|
||||
'accounts', 'lists', 'rebu2go', 'transponder', 'special', 'post_office_box'
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -148,14 +148,21 @@ class EvaFormView(LoginRequiredMixin, CookieWizardView):
|
|||
f'EVA: Neuzugang {firstname} {lastname} (MAILTEST)',
|
||||
mail_template.render(context),
|
||||
EVA_MAIL,
|
||||
[EVA_MAIL, contact],
|
||||
[EVA_MAIL],
|
||||
fail_silently=False)
|
||||
elif department != "SUBMITTER":
|
||||
send_mail(
|
||||
f'EVA: Neuzugang {firstname} {lastname}',
|
||||
mail_template.render(context),
|
||||
EVA_MAIL,
|
||||
[MAILS[department]['MAIL']],
|
||||
fail_silently=False)
|
||||
else:
|
||||
send_mail(
|
||||
f'EVA: Neuzugang {firstname} {lastname}',
|
||||
mail_template.render(context),
|
||||
EVA_MAIL,
|
||||
[MAILS[department]['MAIL'], contact],
|
||||
[contact],
|
||||
fail_silently=False)
|
||||
except BadHeaderError as error:
|
||||
print(error)
|
||||
|
|
Loading…
Reference in New Issue