oscarmlage / django-cruds-adminlte

django-cruds is simple drop-in django app that creates CRUD for faster prototyping
BSD 3-Clause "New" or "Revised" License
424 stars 82 forks source link

Template for GenericIPAddressField column #72

Open mbourqui opened 6 years ago

mbourqui commented 6 years ago

The template for the column representing a GenericIPAddressField is missing.

As I need it in one of my projects anyway, I will soon submit a PR.

oscarmlage commented 6 years ago

@mbourqui sure! would be nice to have a template column for GenericIPAddressField type, I'll check the PR (once it arrives). Thanks in advance!

luisza commented 6 years ago

Well we can try to improve in our code, because new fields will be added, so maybe in templatetag when field is get, we can use a try catch and if fail then use a generic template as django do.

mbourqui commented 6 years ago

I agree with @luisza, a fallback template would be ideal. For example, in this case, I simply copied the textfield template, which is actually the same as most of the templates (and thus lots of code duplication). I do not have much time right now, but if you'd like, I can have a look in a few weeks (2 or 3). By quickly checking the code, it looks like it would be easier by having a tag or filter to handle the fallback.