Skip to content

Commit

Permalink
Fix linting
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinEtchells committed Sep 6, 2024
1 parent 1d8dd58 commit f023746
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
9 changes: 5 additions & 4 deletions django_app/redbox_app/redbox_core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,9 @@ class AIExperienceLevel(models.TextChoices):
ai_experience = models.CharField(null=True, blank=True, max_length=25, choices=AIExperienceLevel)
profession = models.CharField(null=True, blank=True, max_length=4, choices=Profession)
info_about_user = models.CharField(null=True, blank=True, help_text="user entered info from profile overlay")
redbox_response_preferences = models.CharField(null=True, blank=True, help_text="user entered info from profile overlay, to be used in custom prompt")
redbox_response_preferences = models.CharField(
null=True, blank=True, help_text="user entered info from profile overlay, to be used in custom prompt"
)
ai_settings = models.ForeignKey(AISettings, on_delete=models.SET_DEFAULT, default="default", to_field="label")
is_developer = models.BooleanField(null=True, blank=True, default=False, help_text="is this user a developer?")
objects = BaseUserManager()
Expand All @@ -259,7 +261,7 @@ def get_bearer_token(self) -> str:
user_uuid = str(self.id)
bearer_token = jwt.encode({"user_uuid": user_uuid}, key=settings.SECRET_KEY)
return f"Bearer {bearer_token}"

def get_initials(self) -> str:
try:
if self.name:
Expand All @@ -271,8 +273,7 @@ def get_initials(self) -> str:
else:
name_part = self.email.split("@")[0]
first_name, last_name = name_part.split(".")
initials = first_name[0].upper() + last_name[0].upper()
return initials
return first_name[0].upper() + last_name[0].upper()
except (IndexError, AttributeError, ValueError):
return ""

Expand Down
6 changes: 2 additions & 4 deletions django_app/redbox_app/redbox_core/views/demographics_views.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import logging
import json
from http import HTTPStatus

from django.contrib.auth.decorators import login_required
from django.contrib.auth.mixins import LoginRequiredMixin
from django.http import HttpRequest, HttpResponse
from django.shortcuts import redirect
from django.utils.decorators import method_decorator
from django.views import View
from django.views.generic import UpdateView
from http import HTTPStatus

from redbox_app.redbox_core.forms import DemographicsForm
from redbox_app.redbox_core.models import User
Expand Down Expand Up @@ -36,4 +34,4 @@ def post(self, request: HttpRequest) -> HttpResponse:
user.redbox_response_preferences = request.POST.get("redbox_response_preferences")
user.save()

return HttpResponse(status=HTTPStatus.NO_CONTENT)
return HttpResponse(status=HTTPStatus.NO_CONTENT)

0 comments on commit f023746

Please sign in to comment.