Permalink
Browse files

Remove Wikidata support

Since we have translatable model fields now, this feature is redundant.
  • Loading branch information...
Benestar committed Jun 24, 2018
1 parent d8c70e3 commit 493d8b400d0947dc2c663a3396822f9a8cbd2e16
@@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2018-06-24 10:41
from __future__ import unicode_literals

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('depot', '0015_auto_20180601_1357'),
]

operations = [
migrations.RemoveField(
model_name='item',
name='wikidata_item',
),
]
@@ -168,7 +168,6 @@ class Item(models.Model):
visibility = models.CharField(max_length=1, choices=VISIBILITY_LEVELS)
location = models.CharField(max_length=256, blank=True)
depot = models.ForeignKey(Depot, on_delete=models.CASCADE)
wikidata_item = models.CharField(max_length=32, blank=True, editable=False)

@staticmethod
def filter_by_user(user):
@@ -76,18 +76,7 @@ <h1>
{{ forloop.counter }}
</th>
<td>
{% if labels|key:item.wikidata_item %}
{{ labels|key:item.wikidata_item }}

<a href="{% wikidata_url item.wikidata_item %}">
<span class="glyphicon glyphicon-barcode" aria-hidden="true"
data-toggle="tooltip" data-placement="right"
title="{% trans 'Label from Wikidata' %}"></span>
<span class="sr-only">{% trans 'Label from Wikidata' %}</span>
</a>
{% else %}
{{ item.name }}
{% endif %}
{{ item.name }}
</td>
<td>
{{ item.description }}
@@ -2,7 +2,6 @@
from depot.helpers import get_depot_if_allowed
from django.shortcuts import render
from django.views import View
from depot import wikidata


class DepotDetailView(View):
@@ -18,12 +17,10 @@ class DepotDetailView(View):
def get(self, request, depot_id):
depot = get_depot_if_allowed(depot_id, request.user)
item_list = depot.visible_items(request.user)
labels = wikidata.get_labels(item_list, lang=request.LANGUAGE_CODE)

return render(request, 'depot/detail.html', {
'depot': depot,
'item_list': item_list,
'labels': labels,
'show_visibility': depot.show_internal_items(request.user),
'managed_by_user': depot.managed_by(request.user),
'start_date': datetime.now() + timedelta(days=1),

This file was deleted.

Oops, something went wrong.
@@ -2,4 +2,3 @@ django ~= 1.10.6
django-modeltranslation ~= 0.12.2
flake8 ~= 3.3.0
markdown ~= 2.6.9
requests ~= 2.18.4
@@ -156,8 +156,6 @@
IMPRINT_URL = '/'
GITHUB_URL = 'https://github.com/verleihtool/verleihtool/'

WIKIDATA_URL = 'https://www.wikidata.org'

# E-Mail preferences

# Write Emails to std output instead of sending for development purposes
@@ -1,6 +1,5 @@
import json
from django import template
from django.conf import settings
from django.core.urlresolvers import translate_url
from depot.models import Item
from rental.models import Rental
@@ -115,17 +114,6 @@ def concat_with_and(list, final='and', empty=''):
)


@register.simple_tag
def wikidata_url(page):
"""
Construct the url to Wikidata for the given page
:author: Benedikt Seidl
"""

return settings.WIKIDATA_URL + '/wiki/' + page


@register.filter
def key(dictionary, key):
"""

0 comments on commit 493d8b4

Please sign in to comment.