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 ...@@ -44,7 +44,7 @@ from social.apps.django_app.views import complete
import weblate import weblate
from weblate.accounts.avatar import get_avatar_image, get_fallback_avatar_url from weblate.accounts.avatar import get_avatar_image, get_fallback_avatar_url
from weblate.accounts.models import set_lang, remove_user, Profile 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 ( from weblate.accounts.forms import (
ProfileForm, SubscriptionForm, UserForm, ContactForm, ProfileForm, SubscriptionForm, UserForm, ContactForm,
SubscriptionSettingsForm SubscriptionSettingsForm
...@@ -180,8 +180,8 @@ def user_profile(request): ...@@ -180,8 +180,8 @@ def user_profile(request):
x for x in all_backends x for x in all_backends
if x == 'email' or x not in social_names if x == 'email' or x not in social_names
] ]
license_projects = Project.objects.all_acl( license_projects = SubProject.objects.filter(
request.user project__in=Project.objects.all_acl(request.user)
).exclude( ).exclude(
license='' license=''
) )
......
...@@ -252,20 +252,20 @@ ...@@ -252,20 +252,20 @@
</p> </p>
{% if licenses %} {% 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"> <table class="table">
<thead> <thead>
<tr><th>{% trans "Project" %}</th><th>{% trans "License" %}</th></tr> <tr><th>{% trans "Project" %}</th><th>{% trans "License" %}</th></tr>
</thead> </thead>
<tbody> <tbody>
{% for project in licenses %} {% for resource in licenses %}
<tr> <tr>
<th><a href="{{ project.get_absolute_url }}">{{ project.name }}</a></th> <th><a href="{{ resource.get_absolute_url }}">{{ resource.name }}</a></th>
<td> <td>
{% if project.license_url %} {% if resource.license_url %}
<a href="{{ project.license_url }}">{{ project.license }}</a></p> <a href="{{ resource.license_url }}">{{ resource.license }}</a></p>
{% else %} {% else %}
{{ project.license }} {{ resource.license }}
{% endif %} {% endif %}
</td> </td>
</tr> </tr>
......
...@@ -17,16 +17,3 @@ ...@@ -17,16 +17,3 @@
<td colspan="2"><a href="{{ object.instructions }}">{{ object.instructions }}</a></td> <td colspan="2"><a href="{{ object.instructions }}">{{ object.instructions }}</a></td>
</tr> </tr>
{% endif %} {% 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 @@ ...@@ -4,6 +4,19 @@
{% include "project_info.html" %} {% include "project_info.html" %}
{% endwith %} {% 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 %} {% if perms.trans.can_see_git_repository %}
<tr> <tr>
<th>{% trans "Git repository" %}</th> <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