mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-23 18:11:09 +00:00
Update connector model to add new connector
This commit is contained in:
parent
d85808a0d2
commit
f30d05acfc
3 changed files with 23 additions and 11 deletions
|
@ -1,3 +1,3 @@
|
|||
""" settings book data connectors """
|
||||
|
||||
CONNECTORS = ["openlibrary", "self_connector", "bookwyrm_connector"]
|
||||
CONNECTORS = ["openlibrary", "inventaire", "self_connector", "bookwyrm_connector"]
|
||||
|
|
22
bookwyrm/migrations/0062_auto_20210406_1731.py
Normal file
22
bookwyrm/migrations/0062_auto_20210406_1731.py
Normal file
|
@ -0,0 +1,22 @@
|
|||
# Generated by Django 3.1.6 on 2021-04-06 17:31
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('bookwyrm', '0061_auto_20210402_1435'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RemoveConstraint(
|
||||
model_name='connector',
|
||||
name='connector_file_valid',
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='connector',
|
||||
name='connector_file',
|
||||
field=models.CharField(choices=[('openlibrary', 'Openlibrary'), ('inventaire', 'Inventaire'), ('self_connector', 'Self Connector'), ('bookwyrm_connector', 'Bookwyrm Connector')], max_length=255),
|
||||
),
|
||||
]
|
|
@ -31,16 +31,6 @@ class Connector(BookWyrmModel):
|
|||
# when to reset the query count back to 0 (ie, after 1 day)
|
||||
query_count_expiry = models.DateTimeField(auto_now_add=True, blank=True)
|
||||
|
||||
class Meta:
|
||||
""" check that there's code to actually use this connector """
|
||||
|
||||
constraints = [
|
||||
models.CheckConstraint(
|
||||
check=models.Q(connector_file__in=ConnectorFiles),
|
||||
name="connector_file_valid",
|
||||
)
|
||||
]
|
||||
|
||||
def __str__(self):
|
||||
return "{} ({})".format(
|
||||
self.identifier,
|
||||
|
|
Loading…
Reference in a new issue