Metadata-Version: 2.1
Name: djhacker
Version: 0.1.2
Summary: Django-Hacker: customize default django forms
Home-page: https://yourlabs.io/oss/django-djhacker
Author: James Pic
Author-email: jamespic@gmail.com
License: MIT
Description: Django-Hacker: customize default django forms
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        
        Basic usage
        ===========
        
        Install with ``pip install djhacker`` and then:
        
        .. code-block:: py
        
            import djhacker
        
            djhacker.formfield(
                YourModel.your_field,
                YourFormField,
                custom_form_field_kwarg='something',
            )
        
        This will make any Django ModelForm render a
        ``YourFormField(custom_form_field_kwarg='something')`` by default, plus
        whatever other kwargs it wants to add, you won't have to use any specific model
        form, this will work natively in the admin for instance.
        
        Custom formfield callback
        =========================
        
        You can register custom form field for model field types:
        
        .. code-block:: py
        
            @djhacker.register(models.ForeignKey)
            def custom_fk_formfield(model_field, **kwargs):
                return YourFormField, {
                    'custom_form_field_kwarg': 'something',
                    **kwargs,
                )
        
            # you don't need to pass extra arguments anymore for ForeignKey fields:
            djhacker.formfield(YourModel.some_fk, queryset=Some.objects.all())
Keywords: django forms
Platform: UNKNOWN
Requires-Python: >=3.7
Description-Content-Type: text/x-rst
Provides-Extra: test
