Giter Club home page Giter Club logo

tw2.dynforms's Introduction

ToscaWidgets

ToscaWidgets is a web widget toolkit for Python to aid in the creation, packaging and distribution of common view elements normally used in the web.

tw2.dynforms includes dynamic form building widgets that use JavaScript.

tw2.dynforms's People

Contributors

ralphbean avatar moschlar avatar cito avatar nphilipp avatar paj28 avatar

Stargazers

Lasha Gogua avatar Greg avatar  avatar

Watchers

James Cloos avatar

tw2.dynforms's Issues

Graceful degredation when JS is disabled

Christoph created a patch(93d8338) for GrowingGridLayout that would graceful degrade when javascript is not available.

See if there are other widgets in dynforms that need graceful degredation and implement it.

Fix HidingContainerMixin to validate HidingComponents that return lists as values.

Hiding Checkboxes return lists as values. HidingContainerMixin._validate needs to check if the value is a list and then update the "show" list with mapped controls for each independent value in the list. I propose the below code added to HidingContainerMixin._validate

line 150 if isinstance(c, TwdHidingComponentMixin):
if isinstance(data[c.id],list):
for val in data[c.id]:
show.update(c.mapping.get(val,[]))
else:
show.update(c.mapping.get(data[c.id], []))

Change HidingContainer Validation Behavior

I notice that when a field is in the hidden state (not displayed on the form), that HidingContainerMixin._validate automatically sets this value to None. I would think that if a field is hidden in a form it is because you don't want that data to even be considered by the server side. This has led to nasty errors like fields in the database being set to null when this wasn't actually specified in the form. Does it make sense to just not set data[c.id] if the field is hdden? Let me know if you there is a reson for doing this.

See line 142 in tw2.dynforms.widgets.py
if c.id in self.hiding_ctrls and c.id not in show:
data[c.id] = None

Fixes for HidingContainer to support Multi Select widgets.

Recommend the below changes to HidingContainer._validate() function. This will allow multi select widget support (show/ hide based on multiply selected items). This also has a fix to compare the mapping property keys with the original value rather than the validated value. The validated value has been, in many cases transformed and thus would not match up with the item in the mapping.

                    if isinstance(c, HidingComponentMixin):
            #Support Multiselect List widgets
            #Show widgets based on pre-validated value
                        if isinstance(data[c.id],list):
                            for i,item in enumerate(data[c.id]):
                                show.update(c.mapping.get(value.get(c.id)[i],[]))
                        else:
                            show.update(c.mapping.get(value.get(c.id), []))

item_validator property for GrowingGridLayout

tw2.forms.MultipleSelectionWidget has a property item_validator which validates the single entries in the widget.

I think it would be appropriate to have something similar for tw2.dynforms.GrowindGridLayout.

What do the others think?

tw2.core>=2.1.2 breaks tw2.dynforms.GrowingGridLayout validation

Since updating to tw2.core>=2.1.2, GrowingGridLayout's fields don't get validated correctly anmore...

An example is at https://github.com/moschlar/SAUCE/blob/feature/simpleusers/sauce/widgets/judgement.py#L17

request.POST:

MultiDict([('judgement:assignment_id', u''), ('judgement:submission_id', u''), ('line', u''), ('comment', u''), ('line', u''), ('comment', u''), ('judgement:comment', u''), ('judgement:corrected_source', u''), ('judgement:grade', u'')])

After validation:

 {'comment': u"[u'', u'2', u'']", 'submission_id': 1, 'assignment_id': 1, 'grade': None, 'corrected_source': u'', 'annotations': []}

The problem seems to be that id and name are not the same anymore.
@ralphbean confirmed the diversion between those in the rendered html.

Release schedule?

There are numerous changes in development branch.
Some of then are fixing breaking (on Python3) problems (for example: 1e77ae8).

When are you planning to merge development changes to master and to create a new version release to PYPI?
Last time release happened was 2012-05-03 (tw2.dynforms-2.0.1.tar.gz).

Did development/release stop, because there is a better alternative solution? In this case could you please advise?

Thanks,
Albert

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.