Created
February 8, 2017 16:23
-
-
Save aruseni/301b50bbc095a886eaa445252f812791 to your computer and use it in GitHub Desktop.
This is a TextField-based field with TextInput widget. This can be used instead of a CharField whenever you do not want to restrict the length of the content at the DB level (see http://stackoverflow.com/questions/4848964/postgresql-difference-between-text-and-varchar-character-varying for more info).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.db import models | |
from django import forms | |
class TextInputTextField(models.TextField): | |
def formfield(self, **kwargs): | |
kwargs.update({ | |
"widget": forms.TextInput | |
}) | |
return super(TextInputTextField, self).formfield(**kwargs) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment