GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — rcvis/visualizer/forms.py at main · artoonie/rcvis

Expand file tree

/

forms.py

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
44 lines (33 loc) · 1.45 KB
/

forms.py

Copy path

File metadata and controls

44 lines (33 loc) · 1.45 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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.