Skip to content
This repository has been archived by the owner on Jun 24, 2024. It is now read-only.

Commit

Permalink
wip: fix drag & drop
Browse files Browse the repository at this point in the history
  • Loading branch information
monodo committed May 28, 2024
1 parent 85936ea commit 5cbd615
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
7 changes: 3 additions & 4 deletions geocity/apps/forms/admin.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import string

import django.db.models
from adminsortable2.admin import SortableAdminMixin, SortableInlineAdminMixin
from adminsortable2.admin import SortableAdminMixin, SortableTabularInline
from constance import config
from django import forms
from django.contrib import admin
Expand Down Expand Up @@ -178,8 +178,7 @@ def save(self, *args, **kwargs):
return super().save(*args, **kwargs)


# TODO: enable drag and drop for inline reorder
class FormFieldInline(admin.TabularInline, SortableInlineAdminMixin):
class FormFieldInline(SortableTabularInline):
model = models.FormField
extra = 2
verbose_name = _("Champ")
Expand All @@ -198,7 +197,7 @@ class Media:
css = {"all": ("css/admin/admin.css",)}


class FormPricesInline(admin.TabularInline, SortableInlineAdminMixin):
class FormPricesInline(admin.TabularInline):
model = models.Form.prices.through
extra = 1
verbose_name = _("Tarif")
Expand Down
3 changes: 3 additions & 0 deletions geocity/apps/forms/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -820,6 +820,9 @@ class Meta:
verbose_name_plural = _("Champs du formulaire")
ordering = ("order",)

def __str__(self):
return str(self.order)


# Input types
INPUT_TYPE_ADDRESS = "address"
Expand Down

0 comments on commit 5cbd615

Please sign in to comment.