1
0
Fork 0

notes field is now bigger, changed to Textfield analog. new entry url_of_pic, migrated, javascript to hide in businesscard if nopic is choice

This commit is contained in:
alpcentaur 2023-02-27 17:09:28 +00:00
parent f6ae9e640e
commit 28e1570bee
5 changed files with 94 additions and 5 deletions

View File

@ -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([

View File

@ -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:

View File

@ -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', '<a href="https://de.wikipedia.org/wiki/Wikipedia:Förderung/Zugang_zu_Fachliteratur#Bibliotheksstipendium" target="_blank" rel="noopener">Bibliotheksstipendium</a>'), ('ELIT', '<a href="https://de.wikipedia.org/wiki/Wikipedia:Förderung/Zugang_zu_Fachliteratur#eLiteraturstipendium" target="_blank" rel="noopener">eLiteraturstipendium</a>'), ('MAIL', '<a href="https://de.wikipedia.org/wiki/Wikipedia:Förderung/E-Mail-Adressen_und_Visitenkarten#E-Mail-Adressen" target="_blank" rel="noopener">E-Mail-Adresse</a>'), ('IFG', '<a href="https://de.wikipedia.org/wiki/Wikipedia:Förderung/Gebührenerstattungen_für_Behördenanfragen" target="_blank" rel="noopener">Kostenübernahme IFG-Anfrage</a>'), ('LIT', '<a href="https://de.wikipedia.org/wiki/Wikipedia:Förderung/Zugang_zu_Fachliteratur#Literaturstipendium" target="_blank" rel="noopener">Literaturstipendium</a>'), ('LIST', '<a href="https://de.wikipedia.org/wiki/Wikipedia:Förderung/E-Mail-Adressen_und_Visitenkarten#Mailinglisten" target="_blank" rel="noopener">Mailingliste</a>'), ('SOFT', '<a href="https://de.wikipedia.org/wiki/Wikipedia:Förderung/Software-Stipendien" target="_blank" rel="noopener">Softwarestipendium</a>'), ('VIS', '<a href="https://de.wikipedia.org/wiki/Wikipedia:Förderung/E-Mail-Adressen_und_Visitenkarten#Visitenkarten" target="_blank" rel="noopener">Visitenkarten</a>')], 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),
),
]

View File

@ -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: <a href="https://upload.wikimedia.org/wikipedia/commons/c/cd/Muster_Visitenkarten_WMDE_2018.jpg">\
mit Bild</a> <a href="https://upload.wikimedia.org/wikipedia/commons/d/d3/Muster_Visitenkarte_WMDE.png">ohne Bild</a>' ))
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.")

View File

@ -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);
});