Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Select config on QuillField #29

Open
rafaponieman opened this issue Dec 18, 2020 · 2 comments
Open

Select config on QuillField #29

rafaponieman opened this issue Dec 18, 2020 · 2 comments

Comments

@rafaponieman
Copy link

I couldn't find a way to specify the config_name directly on the field. I figure I can do it through specifying a custom form, though I didn't try it because I don't have enough time at this very moment. I think it would be great to be able to pass a config_name directly on QuillField.

Thank you!!

@LeeHanYeong
Copy link
Owner

Good idea. I have been very busy lately so I couldn't care about the project. I'll make that feature within this month. Thank you

@kudecock
Copy link

kudecock commented Jan 6, 2023

You can do it this way (in admin.py):

from django.conf import settings
from django.contrib import admin

from .models import Example

class ExampleAdminForm(forms.ModelForm):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        configs = getattr(settings, "QUILL_CONFIGS", None)
        config = configs['config_name']
        self.fields['field_name'].widget.config = config

class ExampleAdmin(admin.ModelAdmin):
    form = ExampleAdminForm

admin.site.register(Example, ExampleAdmin)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants