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
... | |
class ArticleAddForm(ModelForm): | |
""" | |
Form for creating a new article. | |
""" | |
content = forms.CharField(widget=forms.Textarea(attrs={'class': 'content_textarea'})) | |
project = forms.ModelChoiceField(queryset=Project.objects.all(), required=False) | |
class Meta: |
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
""" | |
Custom tag library to test group membership. | |
""" | |
from django import template | |
from django.contrib.auth.models import Group | |
from apps.contacts.models import Contact | |
register = template.Library() |
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.core.mail import send_mail | |
... | |
send_mail( | |
NEW_CASE_EMAIL_SUBJECT.format(case.title), | |
NEW_CASE_EMAIL_MESSAGE.format( | |
case.title, | |
case.description, | |
case.id |
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
... | |
severity_level = models.ForeignKey( | |
'business.SeverityLevel', null=True, blank=True, | |
on_delete=models.SET( | |
None | |
) | |
) | |
status = models.ForeignKey( | |
'CaseStatus', null=True, blank=True, |
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
... | |
class ArticleAttachment(models.Model): | |
""" | |
Attached files for articles | |
""" | |
att_file = models.FileField( | |
upload_to='content/uploads/articles/%Y/%m/%d/%H/%M/%S') | |
class Meta: |
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
... | |
# Logging settings | |
LOGGING = { | |
'disable_existing_loggers': False, | |
'formatters': { | |
'verbose': { | |
'format' : "[%(asctime)s] %(levelname)s [%(name)s:%(lineno)s] %(message)s", | |
'datefmt' : "%d-%m-%Y %H:%M:%S" | |
}, |
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
... | |
# Static files (CSS, JavaScript, Images) | |
# https://docs.djangoproject.com/en/1.10/howto/static-files/ | |
STATICFILES_DIRS = ( | |
os.path.join(BASE_DIR, 'static'), | |
) | |
STATIC_URL = '/static/' |
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
... | |
# for Postgresql: | |
DATABASES = { | |
'default': { | |
'ENGINE': 'django.db.backends.postgresql', | |
'NAME': 'activotrack', | |
'USER': 'admin', | |
'PASSWORD': 'admin', | |
'HOST': '127.0.0.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
#!/usr/bin/env bash | |
clear; reset; | |
./clear-pyc.sh | |
#sudo service mysql start | |
sudo service postgresql start | |
echo "Clearing database ..." |
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
#!/usr/bin/env bash | |
clear; reset; | |
~/.pyenv/versions/activolabs/bin/pylint --load-plugins \ | |
pylint_django activotrack apps scripts |