from django import forms
from django.db import models

from .widgets import MarkdownTextarea


class MarkdownFormField(forms.fields.CharField):
    def __init__(self, *args, **kwargs):
        kwargs['widget'] = kwargs.pop('widget', MarkdownTextarea)
        super(MarkdownFormField, self).__init__(*args, **kwargs)


class MarkdownField(models.TextField):
    def formfield(self, form_class=MarkdownFormField, **kwargs):
        return super(MarkdownField, self).formfield(
            form_class=form_class, **kwargs)

from django import forms
from django.db import models

from .widgets import MarkdownTextarea


class MarkdownFormField(forms.fields.CharField):
    def __init__(self, *args, **kwargs):
        kwargs['widget'] = MarkdownTextarea
        super(MarkdownFormField, self).__init__(*args, **kwargs)


class MarkdownField(models.TextField):
    def formfield(self, form_class=MarkdownFormField, **kwargs):
        return super(MarkdownField, self).formfield(
            form_class=form_class, **kwargs)

Revert "Allow widget overwriting on form field"
Revert "Allow widget overwriting on form field"

This reverts commit 23a9aaae78cc4d9228f8d0705647fbcadcaf7975.

  from django import forms
  from django.db import models
  
  from .widgets import MarkdownTextarea
  
  
  class MarkdownFormField(forms.fields.CharField):
      def __init__(self, *args, **kwargs):
-         kwargs['widget'] = kwargs.pop('widget', MarkdownTextarea)
+         kwargs['widget'] = MarkdownTextarea
          super(MarkdownFormField, self).__init__(*args, **kwargs)
  
  
  class MarkdownField(models.TextField):
      def formfield(self, form_class=MarkdownFormField, **kwargs):
          return super(MarkdownField, self).formfield(
              form_class=form_class, **kwargs)
  
Revert "Allow widget overwriting on form field"
## Code Before:
from django import forms
from django.db import models

from .widgets import MarkdownTextarea


class MarkdownFormField(forms.fields.CharField):
    def __init__(self, *args, **kwargs):
        kwargs['widget'] = kwargs.pop('widget', MarkdownTextarea)
        super(MarkdownFormField, self).__init__(*args, **kwargs)


class MarkdownField(models.TextField):
    def formfield(self, form_class=MarkdownFormField, **kwargs):
        return super(MarkdownField, self).formfield(
            form_class=form_class, **kwargs)

## Instruction:
Revert "Allow widget overwriting on form field"
## Code After:
from django import forms
from django.db import models

from .widgets import MarkdownTextarea


class MarkdownFormField(forms.fields.CharField):
    def __init__(self, *args, **kwargs):
        kwargs['widget'] = MarkdownTextarea
        super(MarkdownFormField, self).__init__(*args, **kwargs)


class MarkdownField(models.TextField):
    def formfield(self, form_class=MarkdownFormField, **kwargs):
        return super(MarkdownField, self).formfield(
            form_class=form_class, **kwargs)
