-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
App Toolbox: Integration LaTeX-Projekt
- Loading branch information
Showing
21 changed files
with
701 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<div id="confirm-export-modal" class="modal" tabindex="-1"> <!-- aria-labelledby?--> | ||
<div class="modal-dialog"> | ||
<div class="modal-content"> | ||
<div id="confirm-export-modal-header" class="modal-header"> | ||
<h5 id="confirmexport-modal-title" class="modal-title">alle Datensätze exportieren?</h5> | ||
</div> | ||
<div id="confirm-export-modal-body" class="modal-body"> | ||
<div class="text-center"> | ||
<p>Sie haben keinen Eintrag ausgewählt. Es werden also alle vorhandenen Datensätze dieses Datenthemas exportiert. Dies kann lange dauern und ungewollt große Dokumente erzeugen.</p> | ||
<p><strong>{{ objcount }} Datensätze werden exportiert.</strong></p> | ||
</div> | ||
</div> | ||
<div class="modal-footer"> | ||
<button type="button" class="btn btn-primary" id="confirm-export-modal-ok" data-bs-dismiss="modal">Export durchführen</button> | ||
<button type="button" class="btn btn-warning" id="confirm-export-modal-cancel" data-bs-dismiss="modal">abbrechen</button> | ||
</div> | ||
</div> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<!DOCTYPE html> | ||
<body> | ||
<head> | ||
</head> | ||
<html> | ||
<h1>405 Falsche Methode</h1> | ||
Sie haben eine GET-Anfrage gesendet (vermutlich, indem sie diese URL direkt mit dem Browser angewählt haben). Vorgesehen ist, dass in der App Datenmanagement aus ihren Eingaben in den Datenthemen-Ansichten ein POST-Request zusammengestellt wird, der hierhergesandt und mit einem PDF beantwortet wird. | ||
</html> | ||
</body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
from django.contrib import admin | ||
from .models import PdfTemplate, SuitableFor | ||
from django.db import models | ||
from django.forms import TextInput, ModelForm | ||
from django.core.exceptions import ValidationError | ||
|
||
|
||
class SuitableForInline(admin.StackedInline): | ||
model = SuitableFor | ||
fieldsets = [(None, {'fields': ['id', 'datenthema', 'bemerkungen', 'usedkeys', 'sortby']})] | ||
|
||
|
||
@admin.register(PdfTemplate) | ||
class PdfTemplateAdmin(admin.ModelAdmin): | ||
list_display = ('id', 'name', 'created_at', 'description') | ||
inlines = [SuitableForInline] | ||
formfield_overrides = { | ||
models.CharField: {'widget': TextInput(attrs={'size': '20'})} | ||
} | ||
|
||
|
||
class SuitableForm(ModelForm): | ||
|
||
def get_f_names(self): | ||
fields = self.cleaned_data['datenthema'].model_class()._meta.get_fields() | ||
return [f.name for f in fields] | ||
|
||
def clean_sortby(self): | ||
keylist = self.cleaned_data['sortby'] | ||
fieldnames = self.get_f_names() | ||
if keylist is not None: | ||
for key in keylist: | ||
if key not in fieldnames and not (key[0] == '-' and key[1:] in fieldnames): | ||
raise ValidationError(f"{key} ist kein Feld von {self.cleaned_data['datenthema']}!") | ||
return self.cleaned_data['sortby'] | ||
|
||
def clean_usedkeys(self): | ||
keylist = self.cleaned_data['usedkeys'] | ||
fieldnames = self.get_f_names() | ||
if keylist is not None: | ||
for key in keylist: | ||
if key[0] not in fieldnames: | ||
raise ValidationError(f"{key[0]} ist kein Feld von {self.cleaned_data['datenthema']}!") | ||
return keylist | ||
|
||
|
||
@admin.register(SuitableFor) | ||
class SuitableForAdmin(admin.ModelAdmin): | ||
ordering = ['datenthema'] | ||
list_display = ('id', 'datenthema', 'template__name', 'bemerkungen') | ||
form = SuitableForm |
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import os | ||
from django.conf import settings | ||
from django.core.management.base import BaseCommand | ||
|
||
|
||
class Command(BaseCommand): | ||
def handle(self, *args, **options): | ||
|
||
verbose = False | ||
if options.get('verbosity') > 1: | ||
verbose = True | ||
|
||
rmroot = os.path.join(settings.BASE_DIR, 'toolbox', 'mkpdf') | ||
os.chdir(rmroot) | ||
fs = os.listdir() | ||
deld = 0 | ||
skpd = 0 | ||
for f in fs: | ||
if f[:4] == 'tmp_': | ||
os.remove(f) | ||
if verbose: | ||
print(f'del {f}') | ||
deld += 1 | ||
else: | ||
if verbose: | ||
print(f'skip {f}') | ||
skpd += 1 | ||
print(f'{deld} Datei(en) gelöscht, {skpd} Datei(en) übersprungen in {rmroot}') |
Oops, something went wrong.