BrendanMyers88 / EverFresh

EverFresh
https://www.myeverfresh.com
0 stars 0 forks source link

Create isNew @decorator for "newly added" category #5

Closed BrendanMyers88 closed 5 years ago

BrendanMyers88 commented 5 years ago

Create a boolean check for an item that's newly added based on time since it was added to the fresh sheet. This should be True for 1 week, and then automatically become False when the time since adding it expires.

On Freshsheet creation, Newly added items should be automatically checked.

ckcollab commented 5 years ago

Should look something like this, for reference:

class SomeModel(models.Model):
    # this makes it so you can call some_model.is_new instead of 
    # some_model.is_new()
    @property
    def is_new(self):
        return self.date_added > (now() - two_weeks)