mirror of
https://github.com/netbox-community/netbox.git
synced 2026-04-05 08:57:19 +02:00
* Enable E501 rule * Configure ruff formatter * Reformat migration files to fix line length violations * Fix various E501 errors * Move table template code to template_code.py & ignore E501 errors * Reformat raw SQL
This commit is contained in:
@@ -93,9 +93,14 @@ class ManagedFile(SyncedDataMixin, models.Model):
|
||||
self.file_path = os.path.basename(self.data_path)
|
||||
|
||||
# Ensure that the file root and path make a unique pair
|
||||
if self._meta.model.objects.filter(file_root=self.file_root, file_path=self.file_path).exclude(pk=self.pk).exists():
|
||||
if self._meta.model.objects.filter(
|
||||
file_root=self.file_root, file_path=self.file_path
|
||||
).exclude(pk=self.pk).exists():
|
||||
raise ValidationError(
|
||||
f"A {self._meta.verbose_name.lower()} with this file path already exists ({self.file_root}/{self.file_path}).")
|
||||
_("A {model} with this file path already exists ({path}).").format(
|
||||
model=self._meta.verbose_name.lower(),
|
||||
path=f"{self.file_root}/{self.file_path}"
|
||||
))
|
||||
|
||||
def delete(self, *args, **kwargs):
|
||||
# Delete file from disk
|
||||
|
||||
@@ -203,7 +203,17 @@ class Job(models.Model):
|
||||
job_end.send(self)
|
||||
|
||||
@classmethod
|
||||
def enqueue(cls, func, instance=None, name='', user=None, schedule_at=None, interval=None, immediate=False, **kwargs):
|
||||
def enqueue(
|
||||
cls,
|
||||
func,
|
||||
instance=None,
|
||||
name='',
|
||||
user=None,
|
||||
schedule_at=None,
|
||||
interval=None,
|
||||
immediate=False,
|
||||
**kwargs
|
||||
):
|
||||
"""
|
||||
Create a Job instance and enqueue a job using the given callable
|
||||
|
||||
|
||||
Reference in New Issue
Block a user