Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
kbrey committed Oct 30, 2024
1 parent f64c983 commit 2376ed0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
8 changes: 6 additions & 2 deletions programs/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,12 @@ def create_instance(cls, external_name: str, Model: type["Document"]) -> "Docume
class Document(models.Model):
external_name = models.CharField(max_length=120, blank=True, null=True, unique=True)
text = models.ForeignKey(Translation, related_name="documents", blank=False, null=False, on_delete=models.PROTECT)
link_url = models.ForeignKey(Translation, related_name="document_link", blank=True, null=True, on_delete=models.PROTECT)
link_text = models.ForeignKey(Translation, related_name="document_link_text", blank=True, null=True, on_delete=models.PROTECT)
link_url = models.ForeignKey(
Translation, related_name="document_link", blank=True, null=True, on_delete=models.PROTECT
)
link_text = models.ForeignKey(
Translation, related_name="document_link_text", blank=True, null=True, on_delete=models.PROTECT
)

objects = DocumentManager()

Expand Down
5 changes: 3 additions & 2 deletions screener/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -438,8 +438,8 @@ def get_translation(self, field: str):


def default_message(translation):
if(translation == None):
return None
if translation == None:
return None
translation.set_current_language(settings.LANGUAGE_CODE)
d = {"default_message": translation.text, "label": translation.label}
return d
Expand All @@ -458,6 +458,7 @@ def serialized_navigator(navigator):
"languages": langs,
}


def serialized_document(document):
return {
"text": default_message(document.text),
Expand Down

0 comments on commit 2376ed0

Please sign in to comment.