Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use IntegerRangeField in Django template

I'm using Django with PostgreSQL. I have a model with a IntegerRangeField.

When using {{ field }} in template the result is (for example) NumericRange(2, 8, '[)')

How can I get the range numbers in my template?

I tried {{ field.0 }} and {{ field.1 }} but got no output (I expected 2 and 8 respectively).

like image 743
intelis Avatar asked Jan 18 '26 05:01

intelis


1 Answers

Try out {{ field.upper }} and {{ field.lower}}.

like image 172
rajkris Avatar answered Jan 19 '26 18:01

rajkris



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!