mjtamlyn / django-adapters

Constructible, introspectable serializers and forms
BSD 3-Clause "New" or "Revised" License
69 stars 7 forks source link

Research input/output prior art #19

Open LilyFoote opened 8 years ago

LilyFoote commented 8 years ago

One goal of this project is to improve the interface to models and other data sources.

These were mentioned in #17:

artcz commented 8 years ago

Two more things for inspiration:

https://github.com/Mechrophile/schemagic -- more schemas. https://github.com/TriOptima/tri.form -- more forms, worth checking out.

jpic commented 6 years ago

In schematics http://schematics.readthedocs.io/en/latest/usage/importing.html http://schematics.readthedocs.io/en/latest/usage/exporting.html

jpic commented 6 years ago

Another snippet found when closing old prs:

+
+class MagicApp(AppConfig):
+    name = 'dal_select2'
+
+    def ready(self):
+        MagicFormMetaclass.register_formfield_for_modelfield(
+            model_field=models.ForeignKey,
+            form_field=Select2ModelChoiceField,
+        )
+
+        MagicFormMetaclass.register_formfield_for_modelfield(
+            model_field=models.OneToOneField,
+            form_field=Select2ModelChoiceField,
+        )
+
+        MagicFormMetaclass.register_formfield_for_modelfield(
+            model_field=models.ManyToManyField,
+            form_field=Select2ModelMultipleChoiceField,
+        )

https://github.com/yourlabs/django-autocomplete-light/pull/579/files

Maybe working maybe not working example :joy: