fix webpack build system
This commit is contained in:
parent
032cd8d963
commit
c15be406ea
53 changed files with 498 additions and 19204 deletions
35
lenticular_cloud/form/admin.py
Normal file
35
lenticular_cloud/form/admin.py
Normal file
|
@ -0,0 +1,35 @@
|
|||
from flask_babel import gettext
|
||||
from flask_wtf import FlaskForm
|
||||
from wtforms import StringField, SubmitField, TextField, \
|
||||
TextAreaField, PasswordField, IntegerField, FloatField, \
|
||||
DateTimeField, DateField, FormField, BooleanField, \
|
||||
SelectField, Form as NoCsrfForm, SelectMultipleField
|
||||
|
||||
from wtforms.fields.html5 import URLField
|
||||
from wtforms.fields import FormField
|
||||
|
||||
from .base import FieldList
|
||||
|
||||
class OAuth2ClientForm(FlaskForm):
|
||||
client_id = StringField(gettext('client_id') )
|
||||
client_name = StringField(gettext('client_name'))
|
||||
client_uri = URLField(gettext('client_uri'))
|
||||
client_secret = PasswordField(gettext('client_secret'))
|
||||
logo_uri = URLField(gettext('logo_uri'))
|
||||
redirect_uris = FieldList(FormField(URLField(gettext('logo_uri'))))
|
||||
#contacts = List[str]
|
||||
#grant_types = List[str]
|
||||
#response_types = List[str]
|
||||
scope = StringField(gettext('scope'))
|
||||
subject_type = StringField(gettext('subject_type'))
|
||||
token_endpoint_auth_method = StringField(gettext('token_endpoint_auth_method'))
|
||||
userinfo_signed_response_alg = StringField(gettext('userinfo_signed_response_alg'))
|
||||
|
||||
client_secret_expires_at = IntegerField('client_secret_expires_at')
|
||||
|
||||
|
||||
#allowed_cross_origins = Array
|
||||
#audience = List[str]
|
||||
|
||||
|
||||
submit = SubmitField(gettext('Update'))
|
32
lenticular_cloud/form/base.py
Normal file
32
lenticular_cloud/form/base.py
Normal file
|
@ -0,0 +1,32 @@
|
|||
from wtforms import SelectField, FieldList as WTFFieldList, Form
|
||||
from wtforms.fields import Field
|
||||
from ..model import db
|
||||
|
||||
|
||||
class FieldList(WTFFieldList):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
def get_template(self) -> Field:
|
||||
class CustomForm(Form):
|
||||
custom = self.unbound_field
|
||||
return CustomForm().custom
|
||||
|
||||
|
||||
class ModelFieldList(FieldList):
|
||||
def __init__(self, *args, **kwargs):
|
||||
self.model = kwargs.pop("model", None)
|
||||
self.modify = kwargs.pop("modify", True)
|
||||
super(ModelFieldList, self).__init__(*args, **kwargs)
|
||||
if not self.model:
|
||||
raise ValueError("ModelFieldList requires model to be set")
|
||||
|
||||
def populate_obj(self, obj: object, name: str) -> None:
|
||||
while len(getattr(obj, name)) < len(self.entries):
|
||||
newModel = self.model()
|
||||
db.session.add(newModel)
|
||||
getattr(obj, name).append(newModel)
|
||||
while len(getattr(obj, name)) > len(self.entries):
|
||||
db.session.delete(getattr(obj, name).pop())
|
||||
super(ModelFieldList, self).populate_obj(obj, name)
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue