-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closed
Labels
Description
Details
- OS (Operating System) version: Ubuntu 20.04
- Browser and browser version: Chromium 90.0
- Django version: 3.2
- Martor version & theme: 1.6.2, default theme
Steps to reproduce
- Configure and activate a virtualenv (here, with poetry)
$ cat pyproject.toml
[tool.poetry]
name = "tmp"
version = "0.1.0"
description = ""
authors = ["immerrr <immerrr@gmail.com>"]
[tool.poetry.dependencies]
python = "^3.8"
Django = "^3.2"
martor = "^1.6.2"
[tool.poetry.dev-dependencies]
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
$ poetry env use python
$ poetry install
$ poetry shell
$ django-admin startproject martorbug .
./manage.py startapp core
- add 'core' and 'martor' to
INSTALLED_APPS
inmartorbug/settings.py
- add two models
$ cat core/models.py
from django.db import models
from martor.models import MartorField
# Create your models here.
class Foobar(models.Model):
name = models.TextField()
class ModelWithFK(models.Model):
name = models.TextField()
description = MartorField()
foobar = models.ForeignKey(Foobar, on_delete=models.CASCADE)
- register models with admin
$ cat core/admin.py
from django.contrib import admin
from .models import Foobar, ModelWithFK
# Register your models here.
@admin.register(Foobar)
class FoobarAdmin(admin.ModelAdmin):
fields = ['name']
@admin.register(ModelWithFK)
class ModelWithFKAdmin(admin.ModelAdmin):
fields = ['name', 'foobar', 'description']
./manage.py createsuperuser --username user --email user@example.org
(with some password)- add 'STATIC_ROOT' to settings, run
./manage.py collectstatic
./manage.py runserver
- create a foobar via admin
- try creating a "model with fk"
- observe how a FK dropdown shows the label on the right hand side:
- disable the
display
property forfieldset .form-row div>label
selector (that comes from martor.min.css) and notice how the labels are displayed correctly now: