1👍
I can create my own model class and use it to return a TextInput
instead of FormField
, I don’t really like that answer, I notice that CharField width is longer than my custom textField so it doesn’t act exactly the same.
So this is MyCITextField
that I defined:
class MyCITextField(CITextField):
def formfield(self, **kwargs):
kwargs.update({"widget": forms.TextInput})
return super(MyCITextField, self).formfield(**kwargs)
And while having this as my model:
class Country(models.Model):
class Meta:
verbose_name_plural = "Countries"
name_en = MyCITextField(unique=True, verbose_name="English Country Name", max_length=100)
name_fr = models.CharField(unique=True, verbose_name="French Country Name", max_length=100)
name_he = models.CharField(unique=True, verbose_name="Hebrew Country Name", max_length=100)
the result is:
so as you can see that don’t share the same with, i want the visuality to be the same.
👤ufk
Source:stackexchange.com