This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.db import models | |
class Train(models.Model): | |
name = models.CharField(max_length=128) | |
class Car(models.Model): | |
seats_range = models.PositiveSmallIntegerField() | |
next = models.OneToOneField( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ( | |
foo[0] <= bar[0] and f] and foo[1] >= bar[0] | |
or foo[0] >= bar[0oo[0] <= bar[1] | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MESSAGE_STORAGE = 'PROJECT_NAME.storage.CustomAjaxStorage' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Writing custom template tags: | |
# https://docs.djangoproject.com/en/3.0/howto/custom-template-tags/#writing-custom-template-tags | |
# | |
# Usage: | |
# {% link_unless_current 'target_path_name' 'optional_link_text' %} | |
# returns | |
# if not current: <a href="{ reverse(target_path_name) }">{ link_text }</a> | |
# if current: <strong>{ link_text }</strong> | |
from django.template import Library |