diff --git a/input/admin.py b/input/admin.py
index 536c91a..dc83ea1 100644
--- a/input/admin.py
+++ b/input/admin.py
@@ -41,8 +41,11 @@ class BusinessCardAdmin(admin.ModelAdmin):
list_display = ('realname', 'service_id', 'granted', 'granted_date', 'project')
list_display_links = ('realname', 'service_id')
# action = ['export_as_csv']
- classes = ['collapse']
+ class Media:
+ js = ('dropdown/js/base.js',)
+
+
admin.site.register([
diff --git a/input/forms.py b/input/forms.py
index 9fb4ed9..9f12c31 100644
--- a/input/forms.py
+++ b/input/forms.py
@@ -96,7 +96,8 @@ class EmailForm(CheckForm):
class BusinessCardForm(CheckForm):
class Meta:
model = BusinessCard
- fields = ['project', 'data', 'variant', 'sent_to']
+
+ fields = ['project', 'data', 'variant', 'url_of_pic', 'sent_to']
class ListForm(CheckForm):
class Meta:
diff --git a/input/migrations/0063_businesscard_url_of_pic_alter_ifg_notes_and_more.py b/input/migrations/0063_businesscard_url_of_pic_alter_ifg_notes_and_more.py
new file mode 100644
index 0000000..0a2427f
--- /dev/null
+++ b/input/migrations/0063_businesscard_url_of_pic_alter_ifg_notes_and_more.py
@@ -0,0 +1,58 @@
+# Generated by Django 4.1.2 on 2022-11-11 07:28
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('input', '0062_auto_20211103_1155'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='businesscard',
+ name='url_of_pic',
+ field=models.TextField(default='', help_text='Bitte gib die Wikimedia-Commons-URL des Bildes an.', max_length=200, verbose_name='Url des Bildes'),
+ ),
+ migrations.AlterField(
+ model_name='ifg',
+ name='notes',
+ field=models.TextField(blank=True, help_text='Bitte gib an wofür Du das Stipendium verwenden willst.', max_length=1000, verbose_name='Anmerkungen'),
+ ),
+ migrations.AlterField(
+ model_name='library',
+ name='notes',
+ field=models.TextField(blank=True, help_text='Bitte gib an wofür Du das Stipendium verwenden willst.', max_length=1000, verbose_name='Anmerkungen'),
+ ),
+ migrations.AlterField(
+ model_name='library',
+ name='type',
+ field=models.CharField(choices=[('BIB', 'Bibliotheksstipendium'), ('ELIT', 'eLiteraturstipendium'), ('MAIL', 'E-Mail-Adresse'), ('IFG', 'Kostenübernahme IFG-Anfrage'), ('LIT', 'Literaturstipendium'), ('LIST', 'Mailingliste'), ('SOFT', 'Softwarestipendium'), ('VIS', 'Visitenkarten')], default='BIB', max_length=4),
+ ),
+ migrations.AlterField(
+ model_name='literature',
+ name='notes',
+ field=models.TextField(blank=True, help_text='Bitte gib an wofür Du das Stipendium verwenden willst.', max_length=1000, verbose_name='Anmerkungen'),
+ ),
+ migrations.AlterField(
+ model_name='project',
+ name='notes',
+ field=models.TextField(blank=True, max_length=1000, null=True, verbose_name='Anmerkungen'),
+ ),
+ migrations.AlterField(
+ model_name='project',
+ name='start',
+ field=models.DateField(null=True, verbose_name='Startdatum'),
+ ),
+ migrations.AlterField(
+ model_name='project',
+ name='status',
+ field=models.CharField(choices=[('RUN', 'läuft'), ('END', 'beendet'), ('NOT', 'nicht stattgefunden')], default='RUN', max_length=3),
+ ),
+ migrations.AlterField(
+ model_name='travel',
+ name='notes',
+ field=models.TextField(blank=True, max_length=1000),
+ ),
+ ]
diff --git a/input/models.py b/input/models.py
index dae00e3..a016742 100644
--- a/input/models.py
+++ b/input/models.py
@@ -78,7 +78,7 @@ class Project(Volunteer):
cost = models.IntegerField(blank=True, null=True)
account = models.ForeignKey('Account', on_delete=models.CASCADE, null=True, to_field='code', db_constraint = False)
granted_from = models.CharField(max_length=100,null=True,verbose_name='Bewilligt von')
- notes = models.CharField(max_length=1000,null=True,blank=True,verbose_name='Anmerkungen')
+ notes = models.TextField(max_length=1000,null=True,blank=True,verbose_name='Anmerkungen')
# the following Fields are not supposed to be edited by users
pid = models.CharField(max_length=15, null=True, blank=True)
@@ -152,14 +152,14 @@ class Travel(Intern):
checkout = models.DateField(blank=True, null=True, verbose_name='Check Out')
payed_for_hotel_by = models.CharField(max_length=4, choices=PAYEDBY_CHOICES.items(), blank=True, null=True, verbose_name='Kostenauslage Hotel durch')
payed_for_travel_by = models.CharField(max_length=4, choices=PAYEDBY_CHOICES.items(), blank=True, null=True, verbose_name='Kostenauslage Fahrt durch')
- notes = models.CharField(max_length=500, blank=True)
+ notes = models.TextField(max_length=1000, blank=True)
#abstract base class for Library and IFG
class Grant(Extern):
cost = models.CharField(max_length=10, verbose_name='Kosten',
help_text="Bitte gib die ungefähr zu erwartenden Kosten in Euro an.")
- notes = models.TextField(max_length=500, blank=True, verbose_name='Anmerkungen',
+ notes = models.TextField(max_length=1000, blank=True, verbose_name='Anmerkungen',
help_text="Bitte gib an wofür Du das Stipendium verwenden willst.")
class Meta:
@@ -265,5 +265,8 @@ class BusinessCard(Extern):
default='NOPIC', verbose_name='Variante',
help_text=format_html('so sehen die Varianten aus: \
mit Bild ohne Bild' ))
+
+ url_of_pic = models.CharField(max_length=200, verbose_name='Url des Bildes', default='', help_text="Bitte gib die Wikimedia-Commons-URL des Bildes an.")
+
sent_to = models.TextField(max_length=1000, verbose_name='Versandadresse',
default='', help_text="Bitte gib den Namen und die vollständige Adresse ein, an welche die Visitenkarten geschickt werden sollen.")
diff --git a/input/static/dropdown/js/base.js b/input/static/dropdown/js/base.js
new file mode 100644
index 0000000..d469bb5
--- /dev/null
+++ b/input/static/dropdown/js/base.js
@@ -0,0 +1,24 @@
+window.addEventListener("load", function() {
+(function($) {
+ $(function() {
+ var selectField = $('#id_variant'),
+ verified = $('.field-url_of_pic');
+
+ function toggleVerified(value) {
+ if (value === 'PIC') {
+ verified.show();
+ } else {
+ verified.hide();
+ }
+ }
+
+ // show/hide on load based on existing value of selectField
+ toggleVerified(selectField.val());
+
+ // show/hide on change
+ selectField.change(function() {
+ toggleVerified($(this).val());
+ });
+ });
+})(django.jQuery);
+});