Skip to content

Instantly share code, notes, and snippets.

@umarhussain88
Created March 5, 2021 14:00
Show Gist options
  • Save umarhussain88/b36453adb21b9b752a387bf4e6205b8e to your computer and use it in GitHub Desktop.
Save umarhussain88/b36453adb21b9b752a387bf4e6205b8e to your computer and use it in GitHub Desktop.
from django.db import models
class Carbon(models.Model):
id = models.AutoField(
primary_key=True,
editable=False,
)
meter = models.BigIntegerField()
reading_date = models.DateField()
reading_time = models.TimeField()
reading = models.DecimalField(max_digits=6,decimal_places=2)
class Meta:
indexes = [
models.Index(fields=['id','reading_date','reading_time'])
]
ordering = ['reading_time']
def __str__(self) -> str:
return self.reading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment