From 0cca2b32f1f85214f8168f2012ca22c5b6926365 Mon Sep 17 00:00:00 2001 From: Rushil Umaretiya Date: Sun, 13 Sep 2020 21:15:45 -0400 Subject: [PATCH] fixed models literals --- homepage/models.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/homepage/models.py b/homepage/models.py index adbe308..3c932fd 100755 --- a/homepage/models.py +++ b/homepage/models.py @@ -41,7 +41,7 @@ class Location (models.Model): self.slug = slugify(self.name) self.hero = f'heros/hero-{self.slug}.png' self.hero_mobile = f'heros/hero-{self.slug}-mobile.png' - if self.insta is not None and self.insta is not '' and self.insta[0] is not '@': + if self.insta != None and self.insta != '' and self.insta[0] != '@': self.insta = '@' + self.insta self.results = f'results/results-{self.slug}.png' @@ -59,7 +59,7 @@ class Location (models.Model): mobile_output = f'{settings.PROJECT_PATH}/media/results/results-{self.slug}-mobile.png' font = ImageFont.truetype(settings.PROJECT_PATH + static("css/fonts/FuturaPTMedium.otf"), 60) - if self.insta is not None and self.insta is not '': + if self.insta != None and self.insta != '': drawPic (settings.PROJECT_PATH + static("css/res/results.png"), output, font, 735, 805, self.insta) drawPic (settings.PROJECT_PATH + static("css/res/results-mobile.png"), mobile_output, font, 360, 1380, self.insta) else: @@ -120,26 +120,26 @@ class Answer (models.Model): def save(self, *args, **kwargs): self.time = timezone.now() - if self.hi is '': + if self.hi == '': self.hi = "Not stated" - if self.lo is '': + if self.lo == '': self.lo = "Not stated" - if self.name is '': + if self.name == '': self.name = "Anonymous" - if self.place is '': + if self.place == '': self.place = "Somewhere" - if self.question is '': + if self.question == '': self.question = "Not stated" - if self.current_question is '': + if self.current_question == '': self.current_question = self.poll.question_text super().save(self, *args, **kwargs) def __str__(self): - return f"{self.name}'s response on {self.poll.location.name} at {self.time.strftime('%m/%d/%Y, %H:%M:%S')}" \ No newline at end of file + return f"{self.name}'s response on {self.poll.location.name} at {self.time.strftime('%m/%d/%Y, %H:%M:%S')}"