Show federated servers and connectors in admin

This commit is contained in:
Mouse Reeve
2020-10-31 12:45:39 -07:00
parent 7f2f8c53d6
commit 02265b1e49
4 changed files with 58 additions and 10 deletions

View File

@ -10,25 +10,25 @@ class Connector(BookWyrmModel):
''' book data source connectors '''
identifier = models.CharField(max_length=255, unique=True)
priority = models.IntegerField(default=2)
name = models.CharField(max_length=255, null=True)
name = models.CharField(max_length=255, null=True, blank=True)
local = models.BooleanField(default=False)
connector_file = models.CharField(
max_length=255,
choices=ConnectorFiles.choices
)
api_key = models.CharField(max_length=255, null=True)
api_key = models.CharField(max_length=255, null=True, blank=True)
base_url = models.CharField(max_length=255)
books_url = models.CharField(max_length=255)
covers_url = models.CharField(max_length=255)
search_url = models.CharField(max_length=255, null=True)
search_url = models.CharField(max_length=255, null=True, blank=True)
politeness_delay = models.IntegerField(null=True) #seconds
max_query_count = models.IntegerField(null=True)
politeness_delay = models.IntegerField(null=True, blank=True) #seconds
max_query_count = models.IntegerField(null=True, blank=True)
# how many queries executed in a unit of time, like a day
query_count = models.IntegerField(default=0)
# when to reset the query count back to 0 (ie, after 1 day)
query_count_expiry = models.DateTimeField(auto_now_add=True)
query_count_expiry = models.DateTimeField(auto_now_add=True, blank=True)
class Meta:
''' check that there's code to actually use this connector '''
@ -38,3 +38,9 @@ class Connector(BookWyrmModel):
name='connector_file_valid'
)
]
def __str__(self):
return "{} ({})".format(
self.identifier,
self.id,
)