django-cards 0.11.6__tar.gz → 0.11.8__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. {django-cards-0.11.6/django_cards.egg-info → django_cards-0.11.8}/PKG-INFO +1 -1
  2. {django-cards-0.11.6 → django_cards-0.11.8}/cards/base.py +17 -7
  3. {django-cards-0.11.6 → django_cards-0.11.8/django_cards.egg-info}/PKG-INFO +1 -1
  4. {django-cards-0.11.6 → django_cards-0.11.8}/setup.py +1 -1
  5. {django-cards-0.11.6 → django_cards-0.11.8}/LICENSE +0 -0
  6. {django-cards-0.11.6 → django_cards-0.11.8}/MANIFEST.in +0 -0
  7. {django-cards-0.11.6 → django_cards-0.11.8}/README.md +0 -0
  8. {django-cards-0.11.6 → django_cards-0.11.8}/cards/__init__.py +0 -0
  9. {django-cards-0.11.6 → django_cards-0.11.8}/cards/apps.py +0 -0
  10. {django-cards-0.11.6 → django_cards-0.11.8}/cards/card_list/__init__.py +0 -0
  11. {django-cards-0.11.6 → django_cards-0.11.8}/cards/card_list/base.py +0 -0
  12. {django-cards-0.11.6 → django_cards-0.11.8}/cards/card_list/main.py +0 -0
  13. {django-cards-0.11.6 → django_cards-0.11.8}/cards/card_list/tree.py +0 -0
  14. {django-cards-0.11.6 → django_cards-0.11.8}/cards/includes.py +0 -0
  15. {django-cards-0.11.6 → django_cards-0.11.8}/cards/standard.py +0 -0
  16. {django-cards-0.11.6 → django_cards-0.11.8}/cards/static/cards/jstree/css/themes/default/32px.png +0 -0
  17. {django-cards-0.11.6 → django_cards-0.11.8}/cards/static/cards/jstree/css/themes/default/40px.png +0 -0
  18. {django-cards-0.11.6 → django_cards-0.11.8}/cards/static/cards/jstree/css/themes/default/style.css +0 -0
  19. {django-cards-0.11.6 → django_cards-0.11.8}/cards/static/cards/jstree/css/themes/default/style.min.css +0 -0
  20. {django-cards-0.11.6 → django_cards-0.11.8}/cards/static/cards/jstree/css/themes/default/throbber.gif +0 -0
  21. {django-cards-0.11.6 → django_cards-0.11.8}/cards/static/cards/jstree/css/themes/default-dark/32px.png +0 -0
  22. {django-cards-0.11.6 → django_cards-0.11.8}/cards/static/cards/jstree/css/themes/default-dark/40px.png +0 -0
  23. {django-cards-0.11.6 → django_cards-0.11.8}/cards/static/cards/jstree/css/themes/default-dark/style.css +0 -0
  24. {django-cards-0.11.6 → django_cards-0.11.8}/cards/static/cards/jstree/css/themes/default-dark/style.min.css +0 -0
  25. {django-cards-0.11.6 → django_cards-0.11.8}/cards/static/cards/jstree/css/themes/default-dark/throbber.gif +0 -0
  26. {django-cards-0.11.6 → django_cards-0.11.8}/cards/static/cards/jstree/css/themes/proton/30px.png +0 -0
  27. {django-cards-0.11.6 → django_cards-0.11.8}/cards/static/cards/jstree/css/themes/proton/32px.png +0 -0
  28. {django-cards-0.11.6 → django_cards-0.11.8}/cards/static/cards/jstree/css/themes/proton/fonts/titillium/titilliumweb-bold-webfont.eot +0 -0
  29. {django-cards-0.11.6 → django_cards-0.11.8}/cards/static/cards/jstree/css/themes/proton/fonts/titillium/titilliumweb-bold-webfont.svg +0 -0
  30. {django-cards-0.11.6 → django_cards-0.11.8}/cards/static/cards/jstree/css/themes/proton/fonts/titillium/titilliumweb-bold-webfont.ttf +0 -0
  31. {django-cards-0.11.6 → django_cards-0.11.8}/cards/static/cards/jstree/css/themes/proton/fonts/titillium/titilliumweb-bold-webfont.woff +0 -0
  32. {django-cards-0.11.6 → django_cards-0.11.8}/cards/static/cards/jstree/css/themes/proton/fonts/titillium/titilliumweb-extralight-webfont.eot +0 -0
  33. {django-cards-0.11.6 → django_cards-0.11.8}/cards/static/cards/jstree/css/themes/proton/fonts/titillium/titilliumweb-extralight-webfont.svg +0 -0
  34. {django-cards-0.11.6 → django_cards-0.11.8}/cards/static/cards/jstree/css/themes/proton/fonts/titillium/titilliumweb-extralight-webfont.ttf +0 -0
  35. {django-cards-0.11.6 → django_cards-0.11.8}/cards/static/cards/jstree/css/themes/proton/fonts/titillium/titilliumweb-extralight-webfont.woff +0 -0
  36. {django-cards-0.11.6 → django_cards-0.11.8}/cards/static/cards/jstree/css/themes/proton/fonts/titillium/titilliumweb-regular-webfont.eot +0 -0
  37. {django-cards-0.11.6 → django_cards-0.11.8}/cards/static/cards/jstree/css/themes/proton/fonts/titillium/titilliumweb-regular-webfont.svg +0 -0
  38. {django-cards-0.11.6 → django_cards-0.11.8}/cards/static/cards/jstree/css/themes/proton/fonts/titillium/titilliumweb-regular-webfont.ttf +0 -0
  39. {django-cards-0.11.6 → django_cards-0.11.8}/cards/static/cards/jstree/css/themes/proton/fonts/titillium/titilliumweb-regular-webfont.woff +0 -0
  40. {django-cards-0.11.6 → django_cards-0.11.8}/cards/static/cards/jstree/css/themes/proton/style.css +0 -0
  41. {django-cards-0.11.6 → django_cards-0.11.8}/cards/static/cards/jstree/css/themes/proton/style.min.css +0 -0
  42. {django-cards-0.11.6 → django_cards-0.11.8}/cards/static/cards/jstree/css/themes/proton/throbber.gif +0 -0
  43. {django-cards-0.11.6 → django_cards-0.11.8}/cards/static/cards/jstree/js/jstree.js +0 -0
  44. {django-cards-0.11.6 → django_cards-0.11.8}/cards/static/cards/jstree/js/jstree.min.js +0 -0
  45. {django-cards-0.11.6 → django_cards-0.11.8}/cards/templates/cards/groups/groups.html +0 -0
  46. {django-cards-0.11.6 → django_cards-0.11.8}/cards/templates/cards/standard/blank.html +0 -0
  47. {django-cards-0.11.6 → django_cards-0.11.8}/cards/templates/cards/standard/card_group.html +0 -0
  48. {django-cards-0.11.6 → django_cards-0.11.8}/cards/templates/cards/standard/datatable.html +0 -0
  49. {django-cards-0.11.6 → django_cards-0.11.8}/cards/templates/cards/standard/default.html +0 -0
  50. {django-cards-0.11.6 → django_cards-0.11.8}/cards/templates/cards/standard/default_body.html +0 -0
  51. {django-cards-0.11.6 → django_cards-0.11.8}/cards/templates/cards/standard/html.html +0 -0
  52. {django-cards-0.11.6 → django_cards-0.11.8}/cards/templates/cards/standard/list_selection.html +0 -0
  53. {django-cards-0.11.6 → django_cards-0.11.8}/cards/templates/cards/standard/message.html +0 -0
  54. {django-cards-0.11.6 → django_cards-0.11.8}/cards/templates/cards/standard/table.html +0 -0
  55. {django-cards-0.11.6 → django_cards-0.11.8}/cards/templates/cards/standard/table_body.html +0 -0
  56. {django-cards-0.11.6 → django_cards-0.11.8}/cards/templates/cards/standard/tree_selection.html +0 -0
  57. {django-cards-0.11.6 → django_cards-0.11.8}/cards/templatetags/__init__.py +0 -0
  58. {django-cards-0.11.6 → django_cards-0.11.8}/cards/templatetags/django_cards_tags.py +0 -0
  59. {django-cards-0.11.6 → django_cards-0.11.8}/cards/url_converters.py +0 -0
  60. {django-cards-0.11.6 → django_cards-0.11.8}/django_cards.egg-info/SOURCES.txt +0 -0
  61. {django-cards-0.11.6 → django_cards-0.11.8}/django_cards.egg-info/dependency_links.txt +0 -0
  62. {django-cards-0.11.6 → django_cards-0.11.8}/django_cards.egg-info/top_level.txt +0 -0
  63. {django-cards-0.11.6 → django_cards-0.11.8}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: django-cards
3
- Version: 0.11.6
3
+ Version: 0.11.8
4
4
  Summary: Django app that allows you make cards
5
5
  Home-page: https://github.com/django-advance-utils/django-cards
6
6
  Author: Thomas Turner
@@ -6,6 +6,7 @@ from ajax_helpers.utils import random_string
6
6
  from django.core.exceptions import FieldDoesNotExist
7
7
  from django.template.loader import render_to_string
8
8
  from django.utils.safestring import mark_safe
9
+ from django.utils.text import slugify
9
10
  from django_datatables.datatables import DatatableTable
10
11
  from django_datatables.plugins.reorder import Reorder
11
12
  from django_datatables.reorder_datatable import OrderedDatatable
@@ -83,10 +84,13 @@ class CardBase:
83
84
  group_type=CARD_TYPE_STANDARD, show_created_modified_dates=False,
84
85
  footer=None, extra_card_context=None,
85
86
  is_empty=False, empty_template_name=None, empty_message='N/A',
86
- collapsed=None, hidden_if_blank_or_none=None, **kwargs):
87
+ collapsed=None, hidden_if_blank_or_none=None, hidden_if_zero=None, **kwargs):
87
88
 
88
89
  if code is None:
89
- code = random_string()
90
+ if title is not None:
91
+ code = slugify(title).replace('-', '_') + '_card'
92
+ else:
93
+ code = random_string()
90
94
 
91
95
  self.code = code
92
96
  self.view = view
@@ -114,6 +118,7 @@ class CardBase:
114
118
  self.enable_collapse = collapsed is not None
115
119
  self.collapsed = collapsed
116
120
  self.hidden_if_blank_or_none = hidden_if_blank_or_none
121
+ self.hidden_if_zero = hidden_if_zero
117
122
 
118
123
  if is_empty:
119
124
  self.group_type = CARD_TYPE_STANDARD
@@ -133,7 +138,7 @@ class CardBase:
133
138
  self.child_card_groups = []
134
139
 
135
140
  # noinspection PyMethodMayBeStatic
136
- def add_extra_card_info(self, extra_info, group_type, **kwargs):
141
+ def add_extra_card_info(self, extra_info, group_type, **kwargs):
137
142
  if group_type in (CARD_TYPE_DATATABLE, CARD_TYPE_ORDERED_DATATABLE):
138
143
  extra_info['datatable_id'] = kwargs.get('datatable_id', self.code)
139
144
  extra_info['datatable'] = kwargs.get('datatable')
@@ -216,7 +221,7 @@ class CardBase:
216
221
  self.rows.append(row)
217
222
 
218
223
  def add_entry(self, value=None, field=None, label=None, entry_css_class=None, css_class=None,
219
- default='N/A', link=None, hidden=False, hidden_if_blank_or_none=None,
224
+ default='N/A', link=None, hidden=False, hidden_if_blank_or_none=None, hidden_if_zero=None,
220
225
  html_override=None, value_method=None, value_type=None, default_if=None, row_style=None, **kwargs):
221
226
 
222
227
  entry = self._add_entry_internal(value=value,
@@ -228,6 +233,7 @@ class CardBase:
228
233
  link=link,
229
234
  hidden=hidden,
230
235
  hidden_if_blank_or_none=hidden_if_blank_or_none,
236
+ hidden_if_zero=hidden_if_zero,
231
237
  html_override=html_override,
232
238
  value_method=value_method,
233
239
  value_type=value_type,
@@ -319,7 +325,7 @@ class CardBase:
319
325
  if callable(value):
320
326
  value = value()
321
327
  html += html_barge.replace('%1%', str(value))
322
-
328
+
323
329
  return self._add_entry_internal(label=label,
324
330
  value=html,
325
331
  default=default,
@@ -333,7 +339,7 @@ class CardBase:
333
339
  **kwargs)
334
340
 
335
341
  def _add_entry_internal(self, value=None, field=None, label=None, default='N/A', link=None,
336
- hidden=False, hidden_if_blank_or_none=None, html_override=None,
342
+ hidden=False, hidden_if_blank_or_none=None, hidden_if_zero=None, html_override=None,
337
343
  value_method=None, value_type=None,
338
344
  entry_css_class=None, css_class=None, menu=None, default_if=None, row_style=None,
339
345
  **kwargs):
@@ -343,7 +349,11 @@ class CardBase:
343
349
  if hidden_if_blank_or_none is None:
344
350
  hidden_if_blank_or_none = self.hidden_if_blank_or_none
345
351
 
346
- if hidden or (hidden_if_blank_or_none and (value is None or value == '')):
352
+ if hidden_if_zero is None:
353
+ hidden_if_zero = self.hidden_if_zero
354
+
355
+ if hidden or (hidden_if_blank_or_none and (value is None or value == '') or
356
+ (hidden_if_zero and isinstance(value, (float, int)) and value == 0)):
347
357
  return None
348
358
  if isinstance(value, bool):
349
359
  return self.add_boolean_entry(value=value,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: django-cards
3
- Version: 0.11.6
3
+ Version: 0.11.8
4
4
  Summary: Django app that allows you make cards
5
5
  Home-page: https://github.com/django-advance-utils/django-cards
6
6
  Author: Thomas Turner
@@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
5
5
 
6
6
  setuptools.setup(
7
7
  name="django-cards",
8
- version="0.11.6",
8
+ version="0.11.8",
9
9
  author="Thomas Turner",
10
10
  description="Django app that allows you make cards",
11
11
  long_description=long_description,
File without changes
File without changes
File without changes
File without changes