model travel is now based on extern instead of intern, service id is displayed and a readonly field

This commit is contained in:
alpcentaur 2023-02-27 17:09:29 +00:00
parent 08dd961cbe
commit 6d3888172f
4 changed files with 27 additions and 3 deletions

Binary file not shown.

View file

@ -90,12 +90,13 @@ class IFGAdmin(admin.ModelAdmin):
@admin.register(Travel)
class TravelAdmin(admin.ModelAdmin):
save_as = True
search_fields = ['realname', 'granted_date']
list_display = ('realname', 'granted', 'granted_date', 'project_end', 'project', 'project_end_quartal')
search_fields = ['realname', 'service_id', 'granted_date']
list_display = ('realname', 'service_id', 'granted', 'granted_date', 'project_end', 'project', 'project_end_quartal')
list_display_links = ('realname', 'project')
date_hierarchy = 'project_end'
readonly_fields = ('project_end_quartal', 'project_end')
autocomplete_fields = ['project']
readonly_fields = ['service_id']
@admin.register(Email)
class EmailAdmin(admin.ModelAdmin):

View file

@ -0,0 +1,23 @@
# Generated by Django 3.1.2 on 2022-12-09 16:48
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('input', '0088_auto_20221208_2128'),
]
operations = [
migrations.AddField(
model_name='travel',
name='service_id',
field=models.CharField(blank=True, max_length=15, null=True),
),
migrations.AddField(
model_name='travel',
name='username',
field=models.CharField(help_text='Bitte gib den Namen ein, mit dem du dich<br>in den Wikimedia-Projekten registriert hast.', max_length=200, null=True, verbose_name='Benutzer_innenname'),
),
]

View file

@ -179,7 +179,7 @@ HOTEL_CHOICES = {'TRUE': format_html('Hotelzimmer benötigt'),
from django.contrib.contenttypes.models import ContentType
class Travel(Volunteer):
class Travel(Extern):
# project variable is now null true and blank true, which means it can be saved without project id to be later on filled out by admins
project = models.ForeignKey(Project, on_delete=models.CASCADE, null=True, blank=True)
project_name = models.CharField(max_length=50, null=True, blank=True, verbose_name='Projektname:')