Any way to use CRUD in Wagtail(Django) without reload page?

16 views
Skip to first unread message

alex2729 alex

unread,
Aug 9, 2023, 8:45:36 AM8/9/23
to Wagtail support
0

Hi, all! Want to ask about a table with data from a model (like Django). So that the visitor can make changes to the table fields without reloading the page. The description of the framework shows several options for developing such a solution in WAGTAIL

  1. make a snippet and link it to a table. There will be a filter option. But I still could not understand whether it is possible to make changes to the table cells without reloading. In that case, I suppose to use something like that:
@register_snippet class Mapping(models.Model): map_code = models.OneToOneField('Map', models.DO_NOTHING, db_column='curr_map_code', primary_key=True) date_begin = models.DateField() class Meta: managed = True db_table = 'MAPPING'
  1. Using the STREAMFIELD add a TABLEBLOCK. the documentation says that it is based on handsontable 6.2.2 and it has the ability to make changes without rebooting page with table. handsontable 6.2.2 can edit But I cant achive managed to generate table data based on the Django model and possibility for user edit. That is, I can manually enter values in the cells in the admin panel. But in the custom view, there is no such possibility at all.

Try to use something like that:

class Mapping(models.Model): map_code = models.OneToOneField('Map', models.DO_NOTHING, db_column='curr_map_code', primary_key=True) date_begin = models.DateField() class Meta: managed = True db_table = 'MAPPING' class HomePage(Page): body = StreamField( [ ('Mapping',TableBlock(table_options=new_table_options) ], null=True, blank = True, use_json_field=True, ) content_panels = Page.content_panels + [ FieldPanel('body'), ]

Please let me know which option is possible or may be something else. Thanks in advance!

Reply all
Reply to author
Forward
0 new messages