can't use self as a name

This commit is contained in:
Mouse Reeve 2020-05-03 13:12:42 -07:00
parent 60201ee5bf
commit 20264bc3f5
6 changed files with 11 additions and 11 deletions

View file

@ -63,7 +63,7 @@ def get_connector(book=None):
else:
# only select from external connectors
connector_info = models.Connector.objects.filter(
self=False
local=False
).order_by('priority').first()
return load_connector(connector_info)

View file

@ -21,7 +21,7 @@ class AbstractConnector(ABC):
self.key_name = info.key_name
self.max_query_count = info.max_query_count
self.name = info.name
self.self = info.self
self.local = info.local
def is_available(self):

View file

@ -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
@ -16,6 +16,11 @@ class Migration(migrations.Migration):
field=models.CharField(default='https://openlibrary.org', max_length=255),
preserve_default=False,
),
migrations.AddField(
model_name='connector',
name='local',
field=models.BooleanField(default=False),
),
migrations.AddField(
model_name='connector',
name='name',
@ -26,11 +31,6 @@ class Migration(migrations.Migration):
name='priority',
field=models.IntegerField(default=2),
),
migrations.AddField(
model_name='connector',
name='self',
field=models.BooleanField(default=False),
),
migrations.AlterField(
model_name='connector',
name='connector_file',

View file

@ -18,7 +18,7 @@ class Connector(FedireadsModel):
identifier = models.CharField(max_length=255, unique=True)
priority = models.IntegerField(default=2)
name = models.CharField(max_length=255, null=True)
self = models.BooleanField(default=False)
local = models.BooleanField(default=False)
connector_file = models.CharField(
max_length=255,
choices=ConnectorFiles.choices

View file

@ -4,7 +4,7 @@
<h2>Search results</h2>
{% for result_set in results %}
<section>
{% if not result_set.connector.self %}
{% if not result_set.connector.local %}
<h3>
Results from <a href="{{ result_set.connector.base_url }}">{{ result_set.connector.name }}</a>
</h3>

View file

@ -25,7 +25,7 @@ Connector.objects.create(
Connector.objects.create(
identifier=DOMAIN,
name='Local',
self=True,
local=True,
connector_file='self_connector',
base_url='https://%s' % DOMAIN,
books_url='https://%s/book' % DOMAIN,