开发者

How do I have signed fields in Django?

开发者 https://www.devze.com 2022-12-25 03:25 出处:网络
class MyTable(models.Model): lat = models.FloatField(blank=True)开发者_JS百科 long = models.FloatField(blank=True)
class MyTable(models.Model):
    lat = models.FloatField(blank=True)开发者_JS百科
    long = models.FloatField(blank=True)

How do I make them signed? Able to accept negative .


FloatField can accept floating point numbers, negatives included.

If you need positive-only integers, there's PositiveIntegerField. Positive-only floats are a much rarer need, so I don't think they're natively supported - but you can, of course, implement this restriction programatically.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号