GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — rcvis/visualizer/forms.py at main · artoonie/rcvis Expand file tree/ Copy pathforms.pyMore file actions 44 lines (33 loc) · 1.45 KB / Copy pathforms.pyFile metadata and controls44 lines (33 loc) · 1.45 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 """ Forms enable users to create Models """ import json from django import forms from django.core.exceptions import ValidationError from django.core.files.base import ContentFile from visualizer.graph import readDataTablesResult from visualizer.models import JsonConfig # pylint: disable=too-few-public-methods class UploadForm(forms.ModelForm): """ Used by the upload form """ colorTheme = forms.IntegerField(required=False) eliminationBarColor = forms.IntegerField(required=False) textForWinner = forms.IntegerField(required=False) class Meta: """ Metadata is all we need here """ model = JsonConfig fields = JsonConfig.get_all_non_auto_fields() class UploadByDataTableForm(UploadForm): """ Used by the upload form using the DataTables entry""" jsonFile = forms.FileField(required=False) class Meta(UploadForm.Meta): """ Metadata is all we need here """ fields = [f for f in UploadForm.Meta.fields if f != 'jsonFile'] # pylint: disable=invalid-name def clean_jsonFile(self): """ Converts the datatables json to URCVT json """ try: reader = readDataTablesResult.ReadDataTableJSON(self.data) urcvtData = reader.convert_to_urcvt() except BaseException as exc: # pylint:disable-broad-except raise ValidationError(str(exc)) from exc contentFile = ContentFile(json.dumps(urcvtData).encode('utf-8')) return contentFile |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |