Commit 007803de authored by Michal Čihař's avatar Michal Čihař

Use per resource license field

Issue #507
Signed-off-by: default avatarMichal Čihař <michal@cihar.com>
parent 576dad54
......@@ -44,7 +44,7 @@ from social.apps.django_app.views import complete
import weblate
from weblate.accounts.avatar import get_avatar_image, get_fallback_avatar_url
from weblate.accounts.models import set_lang, remove_user, Profile
from weblate.trans.models import Change, Project
from weblate.trans.models import Change, Project, SubProject
from weblate.accounts.forms import (
ProfileForm, SubscriptionForm, UserForm, ContactForm,
SubscriptionSettingsForm
......@@ -180,8 +180,8 @@ def user_profile(request):
x for x in all_backends
if x == 'email' or x not in social_names
]
license_projects = Project.objects.all_acl(
request.user
license_projects = SubProject.objects.filter(
project__in=Project.objects.all_acl(request.user)
).exclude(
license=''
)
......
......@@ -252,20 +252,20 @@
</p>
{% if licenses %}
<p>{% trans "Following projects have explicitly specified their licensing and copyright conditions:" %}</p>
<p>{% trans "Following translations have explicitly specified their licensing and copyright conditions:" %}</p>
<table class="table">
<thead>
<tr><th>{% trans "Project" %}</th><th>{% trans "License" %}</th></tr>
</thead>
<tbody>
{% for project in licenses %}
{% for resource in licenses %}
<tr>
<th><a href="{{ project.get_absolute_url }}">{{ project.name }}</a></th>
<th><a href="{{ resource.get_absolute_url }}">{{ resource.name }}</a></th>
<td>
{% if project.license_url %}
<a href="{{ project.license_url }}">{{ project.license }}</a></p>
{% if resource.license_url %}
<a href="{{ resource.license_url }}">{{ resource.license }}</a></p>
{% else %}
{{ project.license }}
{{ resource.license }}
{% endif %}
</td>
</tr>
......
......@@ -17,16 +17,3 @@
<td colspan="2"><a href="{{ object.instructions }}">{{ object.instructions }}</a></td>
</tr>
{% endif %}
{% if object.license %}
<tr>
<th>{% trans "Translation license" %}</th>
<td colspan="2">
{% if object.license_url %}
<a href="{{ object.license_url }}">{{ object.license }}</a>
{% else %}
{{ object.license }}
{% endif %}
</td>
</tr>
{% endif %}
......@@ -4,6 +4,19 @@
{% include "project_info.html" %}
{% endwith %}
{% if object.license %}
<tr>
<th>{% trans "Translation license" %}</th>
<td colspan="2">
{% if object.license_url %}
<a href="{{ object.license_url }}">{{ object.license }}</a>
{% else %}
{{ object.license }}
{% endif %}
</td>
</tr>
{% endif %}
{% if perms.trans.can_see_git_repository %}
<tr>
<th>{% trans "Git repository" %}</th>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment