{% if doc.owner_organization %}
<a href="{% url 'organizations_main' doc.owner_organization.pk %}">{{ doc.owner_organization }}</a>
{% else %}
- {{ doc.owner_user.first_name }} {{ doc.owner_user.last_name }}
+ {{ doc.owner_user.get_full_name }}
{% endif %} /
<h1 style='margin-bottom: 1em'>{{ doc.meta.title }}</h1>
<td><a href="{% url 'catalogue_html' book.pk %}">{{ book.meta.title }}</a></td>
<td>
{% if book.owner_user %}
- {{ book.owner_user.first_name }} {{ book.owner_user.last_name }}
+ {{ book.owner_user.get_full_name }}
{% else %}
<a href="{{ book.owner_organization.get_absolute_url }}">{{ book.owner_organization }}</a>
{% endif %}
{% endif %}
</td>
<td>{{ book.stage|default:"–" }}</td>
- <td class="{% if book.is_overdue %}alert-danger{% endif %}">{% if book.assigned_to %}{{ book.assigned_to.first_name }} {{ book.assigned_to.last_name }}{% endif %}</td>
+ <td class="{% if book.is_overdue %}alert-danger{% endif %}">{% if book.assigned_to %}{{ book.assigned_to.get_full_name }}{% endif %}</td>
<td class="{% if book.is_overdue %}alert-danger{% endif %}">{{ book.get_plan.deadline|default:"–" }}</td>
<td>
{% if am_owner %}
{% endif %}
</td>
</tr>
-
-</div>
-</div>
<table class="table table-striped">
{% autopaginate books 100 %}
<thead>
- <th>{% trans "Title" %}</th>
- <th>{% trans "Owner" %}</th>
- <th>{% trans "Stage" %}</th>
- <th>{% trans "Assigned to" %}</th>
- <th>{% trans "Deadline" %}</th>
- <th></th>
+ <td>{% trans "Title" %}</td>
+ <td>{% trans "Owner" %}</td>
+ <td>{% trans "Stage" %}</td>
+ <td>{% trans "Assigned to" %}</td>
+ <td>{% trans "Deadline" %}</td>
+ <td></td>
</thead>
<tbody>
{% for doc in books %}
<select name="other-user" style="display:none;">
{% for user in other_users %}
<option {% if request.GET.user == user.username %}selected="selected"
- {% endif %}value="{{ user.username }}">{{ user.first_name }} {{ user.last_name }} ({{ user.count }})</option>
+ {% endif %}value="{{ user.username }}">{{ user.get_full_name }} ({{ user.count }})</option>
{% endfor %}
</select>
{% if doc.owner_organization %}
<a href="{% url 'organizations_main' doc.owner_organization.pk %}">{{ doc.owner_organization }}</a>
{% else %}
- {{ doc.owner_user.first_name }} {{ doc.owner_user.last_name }}
+ {{ doc.owner_user.get_full_name }}
{% endif %} /
<h1 style='margin-bottom: 1em'>{{ doc.meta.title }}</h1>
{% if book.owner_organization %}
<a href="{% url 'organizations_main' book.owner_organization.pk %}">{{ book.owner_organization }}</a>
{% else %}
- {{ book.owner_user.first_name }} {{ book.owner_user.last_name }}
+ {{ book.owner_user.get_full_name }}
{% endif %} /
<h1 style="margin-bottom: 1em">{{ book.meta.title }}</h1>
<form method="POST">
<table class="table table-striped">
<thead>
- <th>{% trans "Stage" %}</th>
- <th>{% trans "Person" %}</th>
- <th>{% trans "Deadline" %}</th>
+ <td>{% trans "Stage" %}</td>
+ <td>{% trans "Person" %}</td>
+ <td>{% trans "Deadline" %}</td>
</thead>
<tbody>
{% for i, sch, data in schedule %}
{% if u.pk == data.0 %}
selected="selected"
{% endif %}
- >{{ u.first_name }} {{ u.last_name }}</option>
+ >{{ u.get_full_name }}</option>
{% endfor %}
</select>
{% else %}
- {{ people.0.first_name }} {{ people.0.last_name }}
+ {{ people.0.get_full_name }}
{% endif %}
</td>
<td><input placeholder="YYYY-MM-DD" name="s{{ i }}-deadline" value="{{ data.1|default:'' }}" class="form-control datepicker-field"></td>
{% endif %}
{% else %}
-<div class="navbar-text" href="">{% trans "Resource owner" %}: {{ doc.owner_user.first_name }} {{ doc.owner_user.last_name }}</div>
+<div class="navbar-text" href="">{% trans "Resource owner" %}: {{ doc.owner_user.get_full_name }}</div>
{% endif %}
<div class="btn-group navbar-right">
{% trans "Audience" %}: {{ doc.meta.audience }}<br>
{% endif %}
{% trans "Owner" %}: {{ doc.owner_organization|default:"" }}
- {{ doc.owner_user.first_name }} {{ doc.owner_user.last_name }}<br/>
+ {{ doc.owner_user.get_full_name }}<br/>
</div>
</a>
</div>
{% trans "Audience" %}: {{ doc.meta.audience }}<br>
{% endif %}
{% trans "Owner" %}: {{ doc.owner_organization|default:"" }}
- {{ doc.owner_user.first_name }} {{ doc.owner_user.last_name }}<br/>
+ {{ doc.owner_user.get_full_name }}<br/>
</div>
</a>
</div>
--- /dev/null
+# -*- coding: utf-8 -*-
+# Generated by Django 1.9.12 on 2017-02-16 15:08
+from __future__ import unicode_literals
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('organizations', '0009_auto_20170119_1321'),
+ ]
+
+ operations = [
+ migrations.RemoveField(
+ model_name='organization',
+ name='preview_html',
+ ),
+ migrations.RemoveField(
+ model_name='organization',
+ name='preview_html_pl',
+ ),
+ migrations.RemoveField(
+ model_name='usercard',
+ name='preview_html',
+ ),
+ migrations.RemoveField(
+ model_name='usercard',
+ name='preview_html_pl',
+ ),
+ ]
from django.contrib.auth.models import User
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
-from django.template.loader import render_to_string
-from django.utils import translation
countries = [
description = models.TextField(blank=True, default="")
projects = models.TextField(blank=True, default="")
- preview_html = models.TextField(blank=True, default="")
- preview_html_pl = models.TextField(blank=True, default="")
-
created_at = models.DateTimeField(auto_now_add=True)
class Meta:
abstract = True
- def save(self, *args, **kwargs):
- translation.activate('en')
- self.preview_html = render_to_string(self.preview_html_template, {
- 'org': self
- })
- translation.activate('pl')
- self.preview_html_pl = render_to_string(self.preview_html_template, {
- 'org': self
- })
- ret = super(Card, self).save(*args, **kwargs)
- return ret
-
def get_projects(self):
for project_line in self.projects.strip().split('\n'):
parts = project_line.strip().split(None, 2)
url, lang, desc = (parts + [''] * 2)[:3]
yield url, lang, desc
- def get_preview_html(self):
- lang = translation.get_language()
- try:
- p = getattr(self, "preview_html_%s" % lang)
- assert p
- return p
- except (AssertionError, AttributeError):
- return self.preview_html
-
@python_2_unicode_compatible
class UserCard(Card):
- preview_html_template = 'organizations/snippets/user.html'
user = models.OneToOneField(User, primary_key=True)
def __str__(self):
- return str(self.user)
+ return self.user.get_full_name()
def get_absolute_url(self):
return reverse('organizations_user', args=[self.user.pk])
@python_2_unicode_compatible
class Organization(Card):
- preview_html_template = 'organizations/snippets/organization.html'
-
name = models.CharField(max_length=1024)
tags = models.ManyToManyField('catalogue.Tag', blank=True)
- # logo = models.ImageField(upload_to='people/logo', blank=True)
- # country = models.CharField(max_length=64, blank=True, choices=countries)
- # www = models.URLField(blank=True)
- # description = models.TextField(blank=True, default="")
- # #projects = JSONField(default=[])
- # projects = models.TextField(blank=True, default="")
-
- # preview_html = models.TextField(blank=True, default="")
-
- # created_at = models.DateTimeField(auto_now_add=True)
def __str__(self):
return self.name
{% extends "catalogue/base.html" %}
{% load i18n %}
{% load document_list from document_list %}
+{% load thumbnail %}
{% block inner_content %}
<a style="float:right; margin-right: 5px" class="btn btn-default" href="{% url 'catalogue_create_missing' %}?organization={{ org.pk }}">{% trans "New resource +" %}</a>
{% endif %}
- {{ org.get_preview_html|safe }}
+ {% include "organizations/snippets/organization.html" %}
{% if tab == 'members' %}
{% for m in org.membership_set.all %}
{% if am_owner or m.status != 'pending' or m.user == request.user %}
<tr class="member-{{ m.status }}">
- <td>{{ m.user.first_name }} {{ m.user.last_name }}</td>
+ <td>{{ m.user.get_full_name }}</td>
{% if am_owner %}<td>{{ m.user.email }}</td>{% endif %}
<td>
{% if m.status == 'owner' %}
--- /dev/null
+{% load thumbnail %}
+{% load i18n %}
+{% load urlinfo %}
+
+
+{% if org.logo %}
+ <img style="margin: 2em 2em 0 0; float: left;" src="{% thumbnail org.logo '180x180' format="PNG" padding=True as th %}{{ th.url }}{% endthumbnail %}">
+{% endif %}
+
+<h1>{{ org }}</h1>
+ <table class="table table-striped" style="width: auto"><tbody>
+ {% if org.country %}<tr><th>{% trans "Country" %}:</th><td>{{ org.get_country_display }}</td></tr>{% endif %}
+ {% if org.www %}<tr><th>{% trans "WWW" %}:</th><td><a href="{{ org.www }}" target="_blank">{{ org.www }}</a></td></tr>{% endif %}
+
+ {% if org.description %}
+ <tr><th>{% trans "Description" %}:</th><td>{{ org.description }}</td></tr>
+ {% endif %}
+
+ {% for url, lang, desc in org.get_projects %}
+ {% if forloop.first %}
+ <tr><th colspan="2">{% trans "Main projects and publications" %}:</th></tr>
+ {% endif %}
+ {% urlinfo url as ui %}
+ <tr>
+ <td style="text-align: center">
+ {% if ui.picture_url %}
+ <a href="{{ url }}" target="_blank">
+ {% thumbnail ui.picture_url '120x40' format="PNG" as th %}
+ <img src="{{ th.url }}">
+ {% endthumbnail %}
+ </a>
+ {% endif %}
+ </td>
+ <td>{{ desc }}<br>
+ <a href="{{ url }}" target="_blank">{{ url }}</a> {% if lang %}({{ lang }}){% endif %}
+ </td>
+ </tr>
+ {% endfor %}
+ </tbody></table>
-{% load thumbnail %}
-{% load i18n %}
-{% load urlinfo %}
-
-
-{% if org.logo %}
-<img style="margin: 2em 2em 0 0; float: left;" src="{% thumbnail org.logo '180x180' format="PNG" as th %}{{ th.url }}{% endthumbnail %}">
-{% endif %}
-
-<h1>{{ org }}</h1>
- <table class="table table-striped" style="width: auto"><tbody>
- <tr><th>{% trans "Country" %}:</th><td>{{ org.get_country_display }}</td></tr>
- <tr><th>{% trans "WWW" %}:</th><td><a href="{{ org.www }}" target="_blank">{{ org.www }}</a></td></tr>
-
- {% if org.description %}
- <tr><th>{% trans "Description" %}:</th><td>{{ org.description }}</td></tr>
- {% endif %}
-
- <tr><th colspan="2">{% trans "Main projects and publications" %}:</th></tr>
- {% for url, lang, desc in org.get_projects %}
- {% urlinfo url as ui %}
- <tr>
- <td style="text-align: center">
- {% if ui.picture_url %}
- <a href="{{ url }}" target="_blank">
- {% thumbnail ui.picture_url '120x40' format="PNG" as th %}
- <img src="{{ th.url }}">
- {% endthumbnail %}
- </a>
- {% endif %}
- </td>
- <td>{{ desc }}<br>
- <a href="{{ url }}" target="_blank">{{ url }}</a> {% if lang %}({{ lang }}){% endif %}
- </td>
- </tr>
- {% endfor %}
- </tbody></table>
+{% extends "organizations/snippets/card.html" %}
\ No newline at end of file
-{% load thumbnail %}
-{% load i18n %}
-{% load urlinfo %}
-
-
-{% if org.logo %}
-<img style="margin: 2em 2em 0 0; float: left;" src="{% thumbnail org.logo '180x180' format="PNG" as th %}{{ th.url }}{% endthumbnail %}">
-{% endif %}
-
-<h1>{{ org.user.first_name }} {{ org.user.last_name }}</h1>
- <table class="table table-striped" style="width: auto"><tbody>
- {% if org.country %}<tr><th>{% trans "Country" %}:</th><td>{{ org.get_country_display }}</td></tr>{% endif %}
- {% if org.www %}<tr><th>{% trans "WWW" %}:</th><td><a href="{{ org.www }}" target="_blank">{{ org.www }}</a></td></tr>{% endif %}
-
- {% if org.description %}
- <tr><th>{% trans "Description" %}:</th><td>{{ org.description }}</td></tr>
- {% endif %}
-
- {% for url, lang, desc in org.get_projects %}
- {% if forloop.first %}
- <tr><th colspan="2">{% trans "Main projects and publications" %}:</th></tr>
- {% endif %}
- {% urlinfo url as ui %}
- <tr>
- <td style="text-align: center">
- {% if ui.picture_url %}
- <a href="{{ url }}" target="_blank">
- {% thumbnail ui.picture_url '120x40' format="PNG" as th %}
- <img src="{{ th.url }}">
- {% endthumbnail %}
- </a>
- {% endif %}
- </td>
- <td>{{ desc }}<br>
- <a href="{{ url }}" target="_blank">{{ url }}</a> {% if lang %}({{ lang }}){% endif %}
- </td>
- </tr>
- {% endfor %}
- </tbody></table>
+{% extends "organizations/snippets/card.html" %}
\ No newline at end of file
{% extends "catalogue/base.html" %}
{% load i18n %}
{% load document_list from document_list %}
+{% load thumbnail %}
{% block inner_content %}
<a style="float:right" class="btn btn-default" href="{% url 'organizations_user_edit' %}">{% trans "Edit" %}</a>
{% endif %}
- {{ card.get_preview_html|safe }}
+ {% include "organizations/snippets/user.html" with org=card %}
<h2>{% trans "Resources" %}</h2>
{% document_list user=card.user.pk %}
{% trans "Audience" %}: {{ doc.meta.audience }}<br>
{% endif %}
{% trans "Owner" %}: {{ doc.owner_organization|default:"" }}
- {{ doc.owner_user.first_name }} {{ doc.owner_user.last_name }}<br/>
+ {{ doc.owner_user.get_full_name }}<br/>
</div>
</a>
</div>
{% trans "Audience" %}: {{ doc.meta.audience }}<br>
{% endif %}
{% trans "Owner" %}: {{ doc.owner_organization|default:"" }}
- {{ doc.owner_user.first_name }} {{ doc.owner_user.last_name }}<br/>
+ {{ doc.owner_user.get_full_name }}<br/>
</div>
</a>
</div>