Awesome optional features
- Optional integration with django_filter:
To enable this awesome feature, add filterset_class
to your Django admin:
from semantic_forms.filters import SemanticFilterSet
class DemoFilter(SemanticFilterSet):
class Meta:
model = Demo
fields = ("demo_field",)
class DemoAdmin(SemanticModelAdmin):
filterset_class = DemoFilter
- HTML preview in Django `autocomplete_fields`:
To enable this awesome feature, add the semantic_autocomplete
property to your Django model:
class DemoModel(models.Model):
@property
def semantic_autocomplete(self):
html = self.get_img()
return format_html(html)
- Optional integration with django-import-export:
To enable this awesome feature, instead of ImportExportModelAdmin
, etc:
from import_export.admin import ImportExportModelAdmin
class ExampleImportExportAdmin(ImportExportModelAdmin):
pass
Inherit from their Semantic
equivalents:
from semantic_admin.contrib.import_export.admin import SemanticImportExportModelAdmin
class ExampleImportExportAdmin(SemanticImportExportModelAdmin):
pass