Skip to content

Commit

Permalink
Merge 4a0414f into f1a7851
Browse files Browse the repository at this point in the history
  • Loading branch information
GregoryAveryWeir committed Jan 13, 2020
2 parents f1a7851 + 4a0414f commit 05adf1a
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 30 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ language: python
env:
PYTHONPATH: .
python:
- "2.7"
- "3.6.8"
install:
- pip install -r requirements.txt
- pip install coverage coveralls
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@ A port of Rami Ismail's [presskit()/dopresskit](https://github.com/ramiismail/do
## Installing

### Requirements:
Requirements:

* Django < 2
* django-filer
* easy_thumbnails
* Markdown
* Pillow
* django-admin-sortable2
* future

## Configuring

Expand Down
29 changes: 15 additions & 14 deletions django_presskit/models.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from builtins import object
from django.db import models
from filer.fields.file import FilerFileField
from filer.fields.image import FilerImageField
Expand All @@ -18,13 +19,13 @@ class AdditionalLink(models.Model):
class Meta(object):
ordering = ['my_order', 'datetime_updated']

def __unicode__(self):
def __str__(self):
return self.title + ' ' + self.website

class Attachment(models.Model):
content = FilerImageField()

def __unicode__(self):
def __str__(self):
return self.content.url

class Award(models.Model):
Expand All @@ -37,7 +38,7 @@ class Award(models.Model):
class Meta(object):
ordering = ['my_order', 'datetime_updated']

def __unicode__(self):
def __str__(self):
return self.description


Expand Down Expand Up @@ -75,14 +76,14 @@ class Company(models.Model):
datetime_updated = models.DateTimeField(auto_now=True)
asset_archive = FilerFileField(blank=True,null=True)

def __unicode__(self):
def __str__(self):
return self.title

def get_absolute_url(self):
from django.urls import reverse
return reverse('django_presskit:company', kwargs={'company_slug': self.slug})

class Meta:
class Meta(object):
verbose_name_plural = 'companies'


Expand Down Expand Up @@ -135,7 +136,7 @@ class Contact(models.Model):
class Meta(object):
ordering = ['my_order', 'datetime_updated']

def __unicode__(self):
def __str__(self):
return self.name


Expand All @@ -150,7 +151,7 @@ class Credit(models.Model):
class Meta(object):
ordering = ['my_order', 'datetime_updated']

def __unicode__(self):
def __str__(self):
return self.person + ', ' + self.role


Expand All @@ -164,7 +165,7 @@ class Feature(models.Model):
class Meta(object):
ordering = ['my_order', 'datetime_updated']

def __unicode__(self):
def __str__(self):
return self.description


Expand All @@ -174,7 +175,7 @@ class MonetizationPermission(models.Model):
datetime_created = models.DateTimeField(auto_now_add=True)
datetime_updated = models.DateTimeField(auto_now=True)

def __unicode__(self):
def __str__(self):
return self.option


Expand All @@ -189,7 +190,7 @@ class Platform(models.Model):
class Meta(object):
ordering = ['my_order', 'datetime_updated']

def __unicode__(self):
def __str__(self):
return self.project.title + ' - ' + self.name


Expand All @@ -203,7 +204,7 @@ class Price(models.Model):
class Meta(object):
ordering = ['my_order', 'datetime_updated']

def __unicode__(self):
def __str__(self):
return self.project.title + ' - ' + self.price


Expand Down Expand Up @@ -249,7 +250,7 @@ def get_absolute_url(self):
from django.urls import reverse
return reverse('django_presskit:project', kwargs={'project_slug': self.slug})

def __unicode__(self):
def __str__(self):
return self.title


Expand Down Expand Up @@ -289,7 +290,7 @@ class Quote(models.Model):
class Meta(object):
ordering = ['my_order', 'datetime_updated']

def __unicode__(self):
def __str__(self):
return self.reviewer + ', ' + self.website + ', ' + self.description


Expand All @@ -304,7 +305,7 @@ class Social(models.Model):
class Meta(object):
ordering = ['my_order', 'datetime_updated']

def __unicode__(self):
def __str__(self):
return self.company.title + ' ' + self.name


Expand Down
4 changes: 3 additions & 1 deletion django_presskit/templatetags/dpk_util.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from future import standard_library
standard_library.install_aliases()
import markdown
import re
from urlparse import urlparse
from urllib.parse import urlparse
from django import template
from django.utils.html import conditional_escape
from django.utils.safestring import mark_safe
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ django-filer==1.4.0
easy_thumbnails==2.5
Markdown==2.6.11
Pillow==4.3.0
future==0.18.2
django-admin-sortable2==0.7
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
packages=setuptools.find_packages(),
include_package_data=True,
classifiers=[
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3.7",
"Framework :: Django :: 1.11",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Operating System :: OS Independent",
Expand Down
25 changes: 13 additions & 12 deletions tests/test_models.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from builtins import str
from django.test import TestCase

from django_presskit.models import Company, Project, AdditionalLink,\
Expand All @@ -12,14 +13,14 @@ class AdditionalLinkModelTests(TestCase):

def test_unicode(self):
link = AdditionalLink(title='Test Link', website='https://test.com')
self.assertEqual(unicode(link), 'Test Link https://test.com')
self.assertEqual(str(link), 'Test Link https://test.com')


class AwardModelTests(TestCase):

def test_unicode(self):
award = Award(description='Test Award')
self.assertEqual(unicode(award), 'Test Award')
self.assertEqual(str(award), 'Test Award')


class CompanyModelTests(TestCase):
Expand All @@ -30,51 +31,51 @@ def test_company_url(self):

def test_unicode(self):
comp = Company(title='Test Company', slug='test-company')
self.assertEqual(unicode(comp), 'Test Company')
self.assertEqual(str(comp), 'Test Company')


class ContactModelTests(TestCase):

def test_unicode(self):
contact = Contact(name='Test Contact')
self.assertEqual(unicode(contact), 'Test Contact')
self.assertEqual(str(contact), 'Test Contact')


class CreditModelTests(TestCase):

def test_unicode(self):
credit = Credit(person='Test Person', role='Test Role')
self.assertEqual(unicode(credit), 'Test Person, Test Role')
self.assertEqual(str(credit), 'Test Person, Test Role')


class FeatureModelTests(TestCase):

def test_unicode(self):
feature = Feature(description='Test Feature')
self.assertEqual(unicode(feature), 'Test Feature')
self.assertEqual(str(feature), 'Test Feature')


class MonetizationPermissionModelTests(TestCase):

def test_unicode(self):
perms = MonetizationPermission(option='Test Permission')
self.assertEqual(unicode(perms), 'Test Permission')
self.assertEqual(str(perms), 'Test Permission')


class PlatformModelTests(TestCase):

def test_unicode(self):
project = Project(title='Test Project')
plat = Platform(project=project, name='Test Platform')
self.assertEqual(unicode(plat), 'Test Project - Test Platform')
self.assertEqual(str(plat), 'Test Project - Test Platform')


class PriceModelTests(TestCase):

def test_unicode(self):
project = Project(title='Test Project')
price = Price(project=project, price='Test Price')
self.assertEqual(unicode(price), 'Test Project - Test Price')
self.assertEqual(str(price), 'Test Project - Test Price')


class ProjectModelTests(TestCase):
Expand All @@ -86,20 +87,20 @@ def test_project_url(self):

def test_unicode(self):
proj = Project(title='Test Project')
self.assertEqual(unicode(proj), 'Test Project')
self.assertEqual(str(proj), 'Test Project')


class QuoteModelTests(TestCase):

def test_unicode(self):
quote = Quote(reviewer='Test Person', description='Test Description',
website='https://test.com')
self.assertEqual(unicode(quote), 'Test Person, https://test.com, Test Description')
self.assertEqual(str(quote), 'Test Person, https://test.com, Test Description')


class SocialModelTests(TestCase):

def test_unicode(self):
comp = Company(title='Test Company', slug='test-company')
social = Social(company=comp, name='Test Social')
self.assertEqual(unicode(social), 'Test Company Test Social')
self.assertEqual(str(social), 'Test Company Test Social')

0 comments on commit 05adf1a

Please sign in to comment.