forked from mirrors/bookwyrm
can't use self as a name
This commit is contained in:
parent
60201ee5bf
commit
20264bc3f5
6 changed files with 11 additions and 11 deletions
|
@ -63,7 +63,7 @@ def get_connector(book=None):
|
||||||
else:
|
else:
|
||||||
# only select from external connectors
|
# only select from external connectors
|
||||||
connector_info = models.Connector.objects.filter(
|
connector_info = models.Connector.objects.filter(
|
||||||
self=False
|
local=False
|
||||||
).order_by('priority').first()
|
).order_by('priority').first()
|
||||||
return load_connector(connector_info)
|
return load_connector(connector_info)
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ class AbstractConnector(ABC):
|
||||||
self.key_name = info.key_name
|
self.key_name = info.key_name
|
||||||
self.max_query_count = info.max_query_count
|
self.max_query_count = info.max_query_count
|
||||||
self.name = info.name
|
self.name = info.name
|
||||||
self.self = info.self
|
self.local = info.local
|
||||||
|
|
||||||
|
|
||||||
def is_available(self):
|
def is_available(self):
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Generated by Django 3.0.3 on 2020-05-03 19:52
|
# Generated by Django 3.0.3 on 2020-05-03 20:07
|
||||||
|
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
@ -16,6 +16,11 @@ class Migration(migrations.Migration):
|
||||||
field=models.CharField(default='https://openlibrary.org', max_length=255),
|
field=models.CharField(default='https://openlibrary.org', max_length=255),
|
||||||
preserve_default=False,
|
preserve_default=False,
|
||||||
),
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='connector',
|
||||||
|
name='local',
|
||||||
|
field=models.BooleanField(default=False),
|
||||||
|
),
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='connector',
|
model_name='connector',
|
||||||
name='name',
|
name='name',
|
||||||
|
@ -26,11 +31,6 @@ class Migration(migrations.Migration):
|
||||||
name='priority',
|
name='priority',
|
||||||
field=models.IntegerField(default=2),
|
field=models.IntegerField(default=2),
|
||||||
),
|
),
|
||||||
migrations.AddField(
|
|
||||||
model_name='connector',
|
|
||||||
name='self',
|
|
||||||
field=models.BooleanField(default=False),
|
|
||||||
),
|
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name='connector',
|
model_name='connector',
|
||||||
name='connector_file',
|
name='connector_file',
|
|
@ -18,7 +18,7 @@ class Connector(FedireadsModel):
|
||||||
identifier = models.CharField(max_length=255, unique=True)
|
identifier = models.CharField(max_length=255, unique=True)
|
||||||
priority = models.IntegerField(default=2)
|
priority = models.IntegerField(default=2)
|
||||||
name = models.CharField(max_length=255, null=True)
|
name = models.CharField(max_length=255, null=True)
|
||||||
self = models.BooleanField(default=False)
|
local = models.BooleanField(default=False)
|
||||||
connector_file = models.CharField(
|
connector_file = models.CharField(
|
||||||
max_length=255,
|
max_length=255,
|
||||||
choices=ConnectorFiles.choices
|
choices=ConnectorFiles.choices
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<h2>Search results</h2>
|
<h2>Search results</h2>
|
||||||
{% for result_set in results %}
|
{% for result_set in results %}
|
||||||
<section>
|
<section>
|
||||||
{% if not result_set.connector.self %}
|
{% if not result_set.connector.local %}
|
||||||
<h3>
|
<h3>
|
||||||
Results from <a href="{{ result_set.connector.base_url }}">{{ result_set.connector.name }}</a>
|
Results from <a href="{{ result_set.connector.base_url }}">{{ result_set.connector.name }}</a>
|
||||||
</h3>
|
</h3>
|
||||||
|
|
|
@ -25,7 +25,7 @@ Connector.objects.create(
|
||||||
Connector.objects.create(
|
Connector.objects.create(
|
||||||
identifier=DOMAIN,
|
identifier=DOMAIN,
|
||||||
name='Local',
|
name='Local',
|
||||||
self=True,
|
local=True,
|
||||||
connector_file='self_connector',
|
connector_file='self_connector',
|
||||||
base_url='https://%s' % DOMAIN,
|
base_url='https://%s' % DOMAIN,
|
||||||
books_url='https://%s/book' % DOMAIN,
|
books_url='https://%s/book' % DOMAIN,
|
||||||
|
|
Loading…
Reference in a new issue