Closed yevheniidehtiar closed 6 years ago
Hi @yevheniidehtiar You can see in the documentation
http://www.weppy.org/docs/1.2/validations -> Inclusion in database sets I believe that is what you are needed
Thank you. And what's about multiple select for many2many fields. For example, I must to pick many groups to user on User's model form?
@yevheniidehtiar, I'm not sure, but I think with 'multiple': True it could work
@yevheniidehtiar you might want to add the format
attribute to your model:
class Category(Model):
format = "%(name)s"
How about multiple select fields for relation. Can you give example, if it's possible?
@yevheniidehtiar I'm sorry, but weppy doesn't provide any "ready to go" form for many to many relations. You should create a custom form and consequent logics for that.
@gi0baro I understand, but I found multiple
option in weppy/forms.py - widget_multiple
I tried to use @josejachuf way with multiple: True , but it's return error. I hardcore it, but working only widget_select.
Do you have some example with hand-coded form with many2many widget default rw logic?
I think that weppy must to have "ready to go" widgets with customization in model.form_widgets.
For example, to o2m we can choose: 'radiobutton', 'select', 'select_auto` (with autocomplete). To m2m - 'multiselect', 'multiselect_auto'. Bootstrap has it.
@yevheniidehtiar No, multiple is used for list fields.
As of today, weppy forms interacts with the referred model only, which means you can have widgets for belongs_to
and refers_to
because those are fields on the model, while has_many
and has_one
are relations that involve separated models, not the one you're editing.
I'm sorry, but it's totally unplanned right now to have such functionality in weppy. If you want such functions you should implements all the logics to save related models in the route, and if you manage to do it with some "reusable logic", I'm open to pull requests and further discussions :)
Hi! It's not good in view, when I see IDs instead names on relation fields in form. ` class Category(Model):
` Field parent in form is select widget and values looking like with 1,2. But I want to see the name of category. I found 'representation' feature in docs, but example in docs is not fully understandably. Can you help me with it. Please