Skip to content

Commit

Permalink
changes
Browse files Browse the repository at this point in the history
  • Loading branch information
BitTheByte committed Apr 11, 2024
1 parent 0f9de6b commit 4250e71
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
24 changes: 24 additions & 0 deletions monitorizer/inventory/admin.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
from django import forms
from django.contrib import admin
from django_ace import AceWidget
from import_export import resources
from import_export.admin import ImportExportModelAdmin
from unfold.admin import ModelAdmin, StackedInline
Expand Down Expand Up @@ -116,12 +118,34 @@ def get_queryset(self, request):
return models.DomainScan.objects.order_by("-created_at")


class CommandTemplateForm(forms.ModelForm):
class Meta:
model = models.CommandTemplate
fields = "__all__"
widgets = {
"parser": AceWidget(
mode="python",
theme="dracula",
wordwrap=False,
width="100%",
showprintmargin=True,
showinvisibles=False,
usesofttabs=True,
fontsize="14px",
toolbar=False,
showgutter=True,
behaviours=True,
),
}


@admin.register(models.CommandTemplate)
class CommandTemplateAdmin(ModelAdmin, ImportExportModelAdmin):
export_form_class = ExportForm
import_form_class = ImportForm
resource_class = CommandTemplateResource
list_display = ["id", "name"]
form = CommandTemplateForm

def get_queryset(self, request):
return models.CommandTemplate.objects.order_by("-created_at")
1 change: 1 addition & 0 deletions monitorizer/server/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@
"unfold.contrib.forms",
"unfold.contrib.import_export",
"debug_toolbar",
"django_ace",
"import_export",
"django_celery_beat",
"django.contrib.admin",
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ django-debug-toolbar = "^4.3.0"
pytelegrambotapi = "^4.17.0"
pyyaml = "^6.0.1"
jinja2 = "^3.1.3"
django-ace = "^1.32.4"

[tool.poetry.group.dev.dependencies]
black = "^24.3.0"
Expand Down

0 comments on commit 4250e71

Please sign in to comment.