mirror of
https://github.com/eduardogsilva/routerfleet.git
synced 2025-08-04 02:04:49 +02:00
Backup data
This commit is contained in:
parent
cc54ba0f73
commit
c9a7a69d4b
16 changed files with 207 additions and 7 deletions
0
backup_data/__init__.py
Normal file
0
backup_data/__init__.py
Normal file
11
backup_data/admin.py
Normal file
11
backup_data/admin.py
Normal file
|
@ -0,0 +1,11 @@
|
|||
from django.contrib import admin
|
||||
from .models import RouterBackup
|
||||
|
||||
|
||||
class RouterBackupAdmin(admin.ModelAdmin):
|
||||
list_display = ('router', 'success', 'error', 'retry_count', 'next_retry', 'schedule_time', 'schedule_type', 'queue_length', 'finish_time', 'updated', 'created', 'uuid')
|
||||
search_fields = ('router__name', 'error_message', 'backup_text')
|
||||
list_filter = ('success', 'error', 'schedule_type')
|
||||
|
||||
|
||||
admin.site.register(RouterBackup, RouterBackupAdmin)
|
6
backup_data/apps.py
Normal file
6
backup_data/apps.py
Normal file
|
@ -0,0 +1,6 @@
|
|||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class BackupDataConfig(AppConfig):
|
||||
default_auto_field = 'django.db.models.BigAutoField'
|
||||
name = 'backup_data'
|
37
backup_data/migrations/0001_initial.py
Normal file
37
backup_data/migrations/0001_initial.py
Normal file
|
@ -0,0 +1,37 @@
|
|||
# Generated by Django 5.0.3 on 2024-03-17 21:51
|
||||
|
||||
import django.db.models.deletion
|
||||
import uuid
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
('router_manager', '0009_router_backup_profile'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='RouterBackup',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('success', models.BooleanField(default=False)),
|
||||
('error', models.BooleanField(default=False)),
|
||||
('error_message', models.TextField(blank=True, null=True)),
|
||||
('retry_count', models.IntegerField(default=0)),
|
||||
('next_retry', models.DateTimeField(blank=True, null=True)),
|
||||
('schedule_time', models.DateTimeField(blank=True, null=True)),
|
||||
('schedule_type', models.CharField(choices=[('daily', 'Daily'), ('weekly', 'Weekly'), ('monthly', 'Monthly'), ('instant', 'Instant')], max_length=10)),
|
||||
('queue_length', models.IntegerField(default=0)),
|
||||
('finish_time', models.DateTimeField(blank=True, null=True)),
|
||||
('backup_text', models.TextField(blank=True, null=True)),
|
||||
('updated', models.DateTimeField(auto_now=True)),
|
||||
('created', models.DateTimeField(auto_now_add=True)),
|
||||
('uuid', models.UUIDField(default=uuid.uuid4, editable=False, unique=True)),
|
||||
('router', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='router_manager.router')),
|
||||
],
|
||||
),
|
||||
]
|
0
backup_data/migrations/__init__.py
Normal file
0
backup_data/migrations/__init__.py
Normal file
23
backup_data/models.py
Normal file
23
backup_data/models.py
Normal file
|
@ -0,0 +1,23 @@
|
|||
from django.db import models
|
||||
from router_manager.models import Router
|
||||
import uuid
|
||||
|
||||
|
||||
class RouterBackup(models.Model):
|
||||
router = models.ForeignKey(Router, on_delete=models.CASCADE)
|
||||
success = models.BooleanField(default=False)
|
||||
error = models.BooleanField(default=False)
|
||||
error_message = models.TextField(blank=True, null=True)
|
||||
retry_count = models.IntegerField(default=0)
|
||||
next_retry = models.DateTimeField(blank=True, null=True)
|
||||
schedule_time = models.DateTimeField(blank=True, null=True)
|
||||
schedule_type = models.CharField(max_length=10, choices=(('daily', 'Daily'), ('weekly', 'Weekly'), ('monthly', 'Monthly'), ('instant', 'Instant')))
|
||||
queue_length = models.IntegerField(default=0) # Seconds
|
||||
finish_time = models.DateTimeField(blank=True, null=True)
|
||||
backup_text = models.TextField(blank=True, null=True)
|
||||
|
||||
updated = models.DateTimeField(auto_now=True)
|
||||
created = models.DateTimeField(auto_now_add=True)
|
||||
uuid = models.UUIDField(unique=True, editable=False, default=uuid.uuid4)
|
||||
|
||||
|
3
backup_data/tests.py
Normal file
3
backup_data/tests.py
Normal file
|
@ -0,0 +1,3 @@
|
|||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
3
backup_data/views.py
Normal file
3
backup_data/views.py
Normal file
|
@ -0,0 +1,3 @@
|
|||
from django.shortcuts import render
|
||||
|
||||
# Create your views here.
|
Loading…
Add table
Add a link
Reference in a new issue