django-cards 0.10.3__tar.gz → 0.11.1__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.10.3/django_cards.egg-info → django-cards-0.11.1}/PKG-INFO +1 -1
  2. {django-cards-0.10.3 → django-cards-0.11.1}/cards/base.py +43 -5
  3. {django-cards-0.10.3 → django-cards-0.11.1}/cards/templates/cards/standard/default_body.html +3 -1
  4. {django-cards-0.10.3 → django-cards-0.11.1/django_cards.egg-info}/PKG-INFO +1 -1
  5. {django-cards-0.10.3 → django-cards-0.11.1}/setup.py +1 -1
  6. {django-cards-0.10.3 → django-cards-0.11.1}/LICENSE +0 -0
  7. {django-cards-0.10.3 → django-cards-0.11.1}/MANIFEST.in +0 -0
  8. {django-cards-0.10.3 → django-cards-0.11.1}/README.md +0 -0
  9. {django-cards-0.10.3 → django-cards-0.11.1}/cards/__init__.py +0 -0
  10. {django-cards-0.10.3 → django-cards-0.11.1}/cards/apps.py +0 -0
  11. {django-cards-0.10.3 → django-cards-0.11.1}/cards/card_list/__init__.py +0 -0
  12. {django-cards-0.10.3 → django-cards-0.11.1}/cards/card_list/base.py +0 -0
  13. {django-cards-0.10.3 → django-cards-0.11.1}/cards/card_list/main.py +0 -0
  14. {django-cards-0.10.3 → django-cards-0.11.1}/cards/card_list/tree.py +0 -0
  15. {django-cards-0.10.3 → django-cards-0.11.1}/cards/includes.py +0 -0
  16. {django-cards-0.10.3 → django-cards-0.11.1}/cards/standard.py +0 -0
  17. {django-cards-0.10.3 → django-cards-0.11.1}/cards/static/cards/jstree/css/themes/default/32px.png +0 -0
  18. {django-cards-0.10.3 → django-cards-0.11.1}/cards/static/cards/jstree/css/themes/default/40px.png +0 -0
  19. {django-cards-0.10.3 → django-cards-0.11.1}/cards/static/cards/jstree/css/themes/default/style.css +0 -0
  20. {django-cards-0.10.3 → django-cards-0.11.1}/cards/static/cards/jstree/css/themes/default/style.min.css +0 -0
  21. {django-cards-0.10.3 → django-cards-0.11.1}/cards/static/cards/jstree/css/themes/default/throbber.gif +0 -0
  22. {django-cards-0.10.3 → django-cards-0.11.1}/cards/static/cards/jstree/css/themes/default-dark/32px.png +0 -0
  23. {django-cards-0.10.3 → django-cards-0.11.1}/cards/static/cards/jstree/css/themes/default-dark/40px.png +0 -0
  24. {django-cards-0.10.3 → django-cards-0.11.1}/cards/static/cards/jstree/css/themes/default-dark/style.css +0 -0
  25. {django-cards-0.10.3 → django-cards-0.11.1}/cards/static/cards/jstree/css/themes/default-dark/style.min.css +0 -0
  26. {django-cards-0.10.3 → django-cards-0.11.1}/cards/static/cards/jstree/css/themes/default-dark/throbber.gif +0 -0
  27. {django-cards-0.10.3 → django-cards-0.11.1}/cards/static/cards/jstree/css/themes/proton/30px.png +0 -0
  28. {django-cards-0.10.3 → django-cards-0.11.1}/cards/static/cards/jstree/css/themes/proton/32px.png +0 -0
  29. {django-cards-0.10.3 → django-cards-0.11.1}/cards/static/cards/jstree/css/themes/proton/fonts/titillium/titilliumweb-bold-webfont.eot +0 -0
  30. {django-cards-0.10.3 → django-cards-0.11.1}/cards/static/cards/jstree/css/themes/proton/fonts/titillium/titilliumweb-bold-webfont.svg +0 -0
  31. {django-cards-0.10.3 → django-cards-0.11.1}/cards/static/cards/jstree/css/themes/proton/fonts/titillium/titilliumweb-bold-webfont.ttf +0 -0
  32. {django-cards-0.10.3 → django-cards-0.11.1}/cards/static/cards/jstree/css/themes/proton/fonts/titillium/titilliumweb-bold-webfont.woff +0 -0
  33. {django-cards-0.10.3 → django-cards-0.11.1}/cards/static/cards/jstree/css/themes/proton/fonts/titillium/titilliumweb-extralight-webfont.eot +0 -0
  34. {django-cards-0.10.3 → django-cards-0.11.1}/cards/static/cards/jstree/css/themes/proton/fonts/titillium/titilliumweb-extralight-webfont.svg +0 -0
  35. {django-cards-0.10.3 → django-cards-0.11.1}/cards/static/cards/jstree/css/themes/proton/fonts/titillium/titilliumweb-extralight-webfont.ttf +0 -0
  36. {django-cards-0.10.3 → django-cards-0.11.1}/cards/static/cards/jstree/css/themes/proton/fonts/titillium/titilliumweb-extralight-webfont.woff +0 -0
  37. {django-cards-0.10.3 → django-cards-0.11.1}/cards/static/cards/jstree/css/themes/proton/fonts/titillium/titilliumweb-regular-webfont.eot +0 -0
  38. {django-cards-0.10.3 → django-cards-0.11.1}/cards/static/cards/jstree/css/themes/proton/fonts/titillium/titilliumweb-regular-webfont.svg +0 -0
  39. {django-cards-0.10.3 → django-cards-0.11.1}/cards/static/cards/jstree/css/themes/proton/fonts/titillium/titilliumweb-regular-webfont.ttf +0 -0
  40. {django-cards-0.10.3 → django-cards-0.11.1}/cards/static/cards/jstree/css/themes/proton/fonts/titillium/titilliumweb-regular-webfont.woff +0 -0
  41. {django-cards-0.10.3 → django-cards-0.11.1}/cards/static/cards/jstree/css/themes/proton/style.css +0 -0
  42. {django-cards-0.10.3 → django-cards-0.11.1}/cards/static/cards/jstree/css/themes/proton/style.min.css +0 -0
  43. {django-cards-0.10.3 → django-cards-0.11.1}/cards/static/cards/jstree/css/themes/proton/throbber.gif +0 -0
  44. {django-cards-0.10.3 → django-cards-0.11.1}/cards/static/cards/jstree/js/jstree.js +0 -0
  45. {django-cards-0.10.3 → django-cards-0.11.1}/cards/static/cards/jstree/js/jstree.min.js +0 -0
  46. {django-cards-0.10.3 → django-cards-0.11.1}/cards/templates/cards/groups/groups.html +0 -0
  47. {django-cards-0.10.3 → django-cards-0.11.1}/cards/templates/cards/standard/blank.html +0 -0
  48. {django-cards-0.10.3 → django-cards-0.11.1}/cards/templates/cards/standard/card_group.html +0 -0
  49. {django-cards-0.10.3 → django-cards-0.11.1}/cards/templates/cards/standard/datatable.html +0 -0
  50. {django-cards-0.10.3 → django-cards-0.11.1}/cards/templates/cards/standard/default.html +0 -0
  51. {django-cards-0.10.3 → django-cards-0.11.1}/cards/templates/cards/standard/html.html +0 -0
  52. {django-cards-0.10.3 → django-cards-0.11.1}/cards/templates/cards/standard/list_selection.html +0 -0
  53. {django-cards-0.10.3 → django-cards-0.11.1}/cards/templates/cards/standard/message.html +0 -0
  54. {django-cards-0.10.3 → django-cards-0.11.1}/cards/templates/cards/standard/table.html +0 -0
  55. {django-cards-0.10.3 → django-cards-0.11.1}/cards/templates/cards/standard/table_body.html +0 -0
  56. {django-cards-0.10.3 → django-cards-0.11.1}/cards/templates/cards/standard/tree_selection.html +0 -0
  57. {django-cards-0.10.3 → django-cards-0.11.1}/cards/templatetags/__init__.py +0 -0
  58. {django-cards-0.10.3 → django-cards-0.11.1}/cards/templatetags/django_cards_tags.py +0 -0
  59. {django-cards-0.10.3 → django-cards-0.11.1}/cards/url_converters.py +0 -0
  60. {django-cards-0.10.3 → django-cards-0.11.1}/django_cards.egg-info/SOURCES.txt +0 -0
  61. {django-cards-0.10.3 → django-cards-0.11.1}/django_cards.egg-info/dependency_links.txt +0 -0
  62. {django-cards-0.10.3 → django-cards-0.11.1}/django_cards.egg-info/top_level.txt +0 -0
  63. {django-cards-0.10.3 → django-cards-0.11.1}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: django-cards
3
- Version: 0.10.3
3
+ Version: 0.11.1
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
@@ -89,6 +89,8 @@ class CardBase:
89
89
  self.footer = footer
90
90
 
91
91
  self.rows = []
92
+ self._row_styles = {}
93
+ self._default_row_styles = None
92
94
  self.title = title
93
95
  self.created_modified_dates = self.get_created_modified_dates(details_object=details_object)
94
96
  if isinstance(menu, (list, tuple)):
@@ -132,7 +134,7 @@ class CardBase:
132
134
 
133
135
  def add_boolean_entry(self, value, label=None, hidden=False, html_override=None,
134
136
  entry_css_class=None, css_class=None,
135
- menu=None, default_if=None, value_type=None, **kwargs):
137
+ menu=None, default_if=None, value_type=None, row_style=None, **kwargs):
136
138
  if value:
137
139
  entry = self._add_entry_internal(value='<i class="fas fa-check" style="color:green;"></i>',
138
140
  label=label,
@@ -143,6 +145,7 @@ class CardBase:
143
145
  menu=menu,
144
146
  default_if=default_if,
145
147
  value_type=value_type,
148
+ row_style=row_style,
146
149
  **kwargs)
147
150
  else:
148
151
  entry = self._add_entry_internal(value='<i class="fas fa-times" style="color:red;"></i>',
@@ -154,11 +157,13 @@ class CardBase:
154
157
  menu=menu,
155
158
  default_if=default_if,
156
159
  value_type=value_type,
160
+ row_style=row_style,
157
161
  **kwargs)
158
162
  return entry
159
163
 
160
164
  def add_date_entry(self, value, label=None, hidden=False, html_override=None,
161
- entry_css_class=None, css_class=None, menu=None, default_if=None, value_type=None, **kwargs):
165
+ entry_css_class=None, css_class=None, menu=None, default_if=None,
166
+ value_type=None, row_style=None, **kwargs):
162
167
  new_value = value.strftime('%d/%m/%y')
163
168
  return self._add_entry_internal(value=new_value,
164
169
  label=label,
@@ -169,6 +174,7 @@ class CardBase:
169
174
  menu=menu,
170
175
  default_if=default_if,
171
176
  value_type=value_type,
177
+ row_style=row_style,
172
178
  **kwargs)
173
179
 
174
180
  def add_row(self, *args, extra_row_kwargs=None):
@@ -199,7 +205,7 @@ class CardBase:
199
205
 
200
206
  def add_entry(self, value=None, field=None, label=None, entry_css_class=None, css_class=None,
201
207
  default='N/A', link=None, hidden=False, hidden_if_blank_or_none=False,
202
- html_override=None, value_method=None, value_type=None, default_if=None, **kwargs):
208
+ html_override=None, value_method=None, value_type=None, default_if=None, row_style=None, **kwargs):
203
209
 
204
210
  entry = self._add_entry_internal(value=value,
205
211
  field=field,
@@ -214,6 +220,7 @@ class CardBase:
214
220
  value_method=value_method,
215
221
  value_type=value_type,
216
222
  default_if=default_if,
223
+ row_style=row_style,
217
224
  **kwargs)
218
225
  if entry is not None:
219
226
  self.rows.append({'type': 'standard', 'entries': [entry]})
@@ -225,6 +232,17 @@ class CardBase:
225
232
  html = render_to_string(template_name=template_name, context=context)
226
233
  self.rows.append({'type': 'html', 'html': html, **kwargs})
227
234
 
235
+ def add_row_style(self, name, html, is_default=False):
236
+ if not isinstance(html, str) and hasattr(html, 'render'):
237
+ html = html.render()
238
+ self._row_styles[name] = html
239
+ if is_default:
240
+ self._default_row_styles = name
241
+
242
+ def set_default_style(self, name=None):
243
+ if name in self._row_styles:
244
+ self._default_row_styles = name
245
+
228
246
  def get_field_value(self, value, field, label):
229
247
  field_type = None
230
248
  if value is None and field is not None:
@@ -270,7 +288,7 @@ class CardBase:
270
288
  def _add_many_to_many_field(self, label, query, query_filter=None, m2m_field=None,
271
289
  html_barge=None, default='N/A', html_override=None,
272
290
  entry_css_class=None, css_class=None, menu=None,
273
- default_if=None, value_type=None, **kwargs):
291
+ default_if=None, value_type=None, row_style=None, **kwargs):
274
292
  if html_barge is None:
275
293
  html_barge = '<span class="small badge badge-pill badge-primary"> %1% </span> '
276
294
 
@@ -299,12 +317,13 @@ class CardBase:
299
317
  menu=menu,
300
318
  default_if=default_if,
301
319
  value_type=value_type,
320
+ row_style=row_style,
302
321
  **kwargs)
303
322
 
304
323
  def _add_entry_internal(self, value=None, field=None, label=None, default='N/A', link=None,
305
324
  hidden=False, hidden_if_blank_or_none=False, html_override=None,
306
325
  value_method=None, value_type=None,
307
- entry_css_class=None, css_class=None, menu=None, default_if=None,
326
+ entry_css_class=None, css_class=None, menu=None, default_if=None, row_style=None,
308
327
  **kwargs):
309
328
 
310
329
  value, label, field_type = self.get_field_value(value=value, field=field, label=label)
@@ -321,6 +340,7 @@ class CardBase:
321
340
  menu=menu,
322
341
  default_if=default_if,
323
342
  value_type=value_type,
343
+ row_style=row_style,
324
344
  **kwargs)
325
345
  elif isinstance(value, datetime.date):
326
346
  return self.add_date_entry(value=value,
@@ -330,6 +350,7 @@ class CardBase:
330
350
  menu=menu,
331
351
  default_if=default_if,
332
352
  value_type=value_type,
353
+ row_style=row_style,
333
354
  **kwargs)
334
355
  elif hasattr(value, 'through'):
335
356
  return self._add_many_to_many_field(label=label,
@@ -341,6 +362,7 @@ class CardBase:
341
362
  menu=menu,
342
363
  default_if=default_if,
343
364
  value_type=value_type,
365
+ row_style=row_style,
344
366
  **kwargs)
345
367
  else:
346
368
  if value is None or value == '' or default_if:
@@ -378,6 +400,21 @@ class CardBase:
378
400
 
379
401
  if menu is not None and isinstance(menu, (list, tuple)):
380
402
  menu = HtmlMenu(self.request, self.button_menu_type).add_items(*menu)
403
+ row_style_html = None
404
+ if (row_style is not None and row_style in self._row_styles) or self._default_row_styles is not None:
405
+
406
+ if row_style is not None:
407
+ html_row_style = self._row_styles[row_style]
408
+ else:
409
+ html_row_style = self._row_styles[self._default_row_styles]
410
+
411
+ value_dict = {'value': value,
412
+ 'label': label,
413
+ 'menu': menu,
414
+ 'link': link,
415
+ **kwargs}
416
+
417
+ row_style_html = html_row_style.format(**value_dict)
381
418
 
382
419
  entry = {'label': label,
383
420
  'html': value,
@@ -386,6 +423,7 @@ class CardBase:
386
423
  'multiple_lines': multiple_parts,
387
424
  'link': link,
388
425
  'menu': menu,
426
+ 'row_style_html': row_style_html,
389
427
  **kwargs}
390
428
  return entry
391
429
 
@@ -3,9 +3,11 @@
3
3
  <div class="{{ card_body_css_class }}{% if card.enable_collapse %} collapse{% if not card.collapsed %} show{% endif %}{% endif %}" id="{{ card.code }}_body">
4
4
  <div class="list-group">
5
5
  {% for row in card.rows %}
6
+
6
7
  {% if row.type == 'html' %}<div class="{{ item_css_class }}">{{ row.html|safe }}</div>{% else %}
7
8
  {% if row.type == 'multiple' %}<div class="{{ item_css_class }}"><div class="row">{% endif %}
8
9
  {% for entry in row.entries %}
10
+ {% if entry.row_style_html %}{{ entry.row_style_html|safe }}{% else %}
9
11
  {% if entry.entry_css_class %}<div class="{{ entry.entry_css_class }}">{% endif %}
10
12
  {% if entry.link %}<a class="{{ item_css_class }} cards-list-group-item" href="{{ entry.link }}" style="{{ item_css }}">{% elif row.type != 'multiple' %}<div class="{{ item_css_class }}" style="{{ item_css }}">{% endif %}
11
13
  {% if entry.label %}
@@ -21,7 +23,7 @@
21
23
  {{ entry.html|safe }}
22
24
  {% endif %}
23
25
  {% if entry.link %}</a>{% elif row.type != 'multiple' %}</div>{% endif %}
24
- {% if entry.entry_css_class %}</div>{% endif %}
26
+ {% if entry.entry_css_class %}</div>{% endif %}{% endif %}
25
27
  {% endfor %}
26
28
  {% if row.type == 'multiple' %}</div></div>{% endif %}
27
29
  {% endif %}
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: django-cards
3
- Version: 0.10.3
3
+ Version: 0.11.1
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.10.3",
8
+ version="0.11.1",
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