add PD and GDFL to license choices; add pd-us

also all make list display facets for PD-US and GDFL; don't expose them
until we have content we like in them
pull/1/head
eric 2014-08-06 17:14:09 -04:00
parent a08fc4441c
commit 5a2a3e60b6
4 changed files with 16 additions and 5 deletions

View File

@ -11,6 +11,7 @@ INFO_CC = (
('CC0', 'cc0', 'No Rights Reserved (CC0)', 'http://creativecommons.org/about/cc0'),
)
INFO_PD = (
('GFDL', 'gdfl', 'GNU Free Documentaion License', 'http://www.gnu.org/licenses/fdl-1.3-standalone.html'),
('PD-US', 'pd-us', 'Public Domain, US', 'http://creativecommons.org/about/pdm'),
)
INFO_ALL = INFO_CC + INFO_PD
@ -27,7 +28,7 @@ GRANTS = tuple([(item[0],item[3]) for item in INFO_ALL])
LICENSE_LIST = [item[0] for item in INFO_CC]
LICENSE_LIST_ALL = [item[0] for item in INFO_ALL]
FACET_LIST = [item[1] for item in INFO_CC]
FACET_LIST = [item[1] for item in INFO_ALL]
class CCLicense():
@staticmethod
@ -55,6 +56,8 @@ class CCLicense():
return 'https://i.creativecommons.org/l/by-sa/3.0/88x31.png'
elif license == 'CC BY-ND':
return 'https://i.creativecommons.org/l/by-nd/3.0/88x31.png'
elif license == 'GFDL':
return 'https://www.gnu.org/graphics/gfdl-logo-tiny.png'
else:
return ''
@ -75,6 +78,8 @@ def description(license):
return 'You are free to: copy and redistribute the material in any medium or format; remix, transform, and build upon the material; for any purpose, even commercially. Under the following terms: You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use. If you remix, transform, or build upon the material, you must distribute your contributions under the same license as the original.'
elif license == 'CC BY-ND':
return 'You are free to: copy and redistribute the material in any medium or format; for any purpose, even commercially. Under the following terms: You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use. If you remix, transform, or build upon the material, you may not distribute the modified material.'
elif license == 'GFDL':
return 'The purpose of this License is to make a manual, textbook, or other functional and useful document "free" in the sense of freedom: to assure everyone the effective freedom to copy and redistribute it, with or without modifying it, either commercially or noncommercially. Secondarily, this License preserves for the author and publisher a way to get credit for their work, while not being considered responsible for modifications made by others.'
else:
return ''
@ -97,4 +102,10 @@ class ccinfo():
return INFO_ALL[LICENSE_LIST_ALL.index(license)][2]
else:
return ''
@property
def is_cc(self):
return self.license in LICENSE_LIST
@property
def is_pd(self):
return self.license == 'PD-US'

View File

@ -1583,7 +1583,7 @@ class EbookFile(models.Model):
class Ebook(models.Model):
FORMAT_CHOICES = settings.FORMATS
RIGHTS_CHOICES = cc.CCCHOICES
RIGHTS_CHOICES = cc.CHOICES
url = models.URLField(max_length=1024)
created = models.DateTimeField(auto_now_add=True, db_index=True,)
format = models.CharField(max_length=25, choices = FORMAT_CHOICES)

View File

@ -29,7 +29,7 @@
<div id="user-block1">
<div id="block-intro-text"><br /><span class="special-user-name">Ready to Read</span></div>
</div>
<div class="user-block24"><p style="font-size: larger;"><span class="user-short-info">These {% if pub_lang %}{{ pub_lang|ez_lang_name }} language {% endif %}<a href="http://creativecommons.org/">Creative Commons</a> {% if license %}<a href="{{cc.url}}">{{ license }}</a>{% endif %} licensed ebooks are ready to read - the people who created them want you to read and share them.</span></p>
<div class="user-block24"><p style="font-size: larger;"><span class="user-short-info">These {% if pub_lang %}{{ pub_lang|ez_lang_name }} language {% endif %}{% if cc.is_cc %}<a href="http://creativecommons.org/">Creative Commons</a>{% endif %} {% if license %}<a href="{{cc.url}}">{{ license }}</a>{% endif %} {%if cc.is_pd %}ebooks are ready to read - they belong to all of us!{% else %}licensed ebooks are ready to read - the people who created them want you to read and share them.{% endif %}</span></p>
{% if license %}<p style="font-size: smaller;"><a href="{{cc.url}}"><img src="{{cc.badge}}" alt="badge for {{license}}" style="float:left;padding:0.5em" /></a> {{cc.description}}
</p>{% endif %}
</div>
@ -74,7 +74,7 @@
<div id="content-block-content">
<div id="books-go-here">
{% ifequal work_list.count 0 %}
There aren't any {{ pub_lang|ez_lang_name }} Creative Commons {{ license }} works in this list. Why don't you add some? Use the "More" tab on a work, there are links there for adding CC ebooks.
There aren't any {{ pub_lang|ez_lang_name }} {% if cc.is_cc %}Creative Commons{% endif %} {{ license }} works in this list. Why don't you add some? Use the "More" tab on a work, there are links there for adding ebooks.
{% else %}
{% lazy_paginate 20 work_list using "work_list" %}
{% for work in work_list %}

View File

@ -886,7 +886,7 @@ class ByPubListView(ByPubView):
class CCListView(FilterableListView):
template_name = "cc_list.html"
context_object_name = "work_list"
licenses = cc.LICENSE_LIST
licenses = cc.LICENSE_LIST_ALL
facets = cc.FACET_LIST
def get_queryset_all(self):