Skip to content

Commit

Permalink
housekeeping
Browse files Browse the repository at this point in the history
  • Loading branch information
menckend committed Oct 22, 2024
1 parent 6755713 commit a7ebbf0
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 11 deletions.
4 changes: 2 additions & 2 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
:hidden:

Home <self>
Contributing <include: ../CONTRIBUTING.md>
Contributing <include:: ../CONTRIBUTING.md>
:parser: myst_parser.docutils_
Changelog <include: ../CHANGELOG.md>
Changelog <include:: ../CHANGELOG.md>
:parser: myst_parser.docutils_
...
autoapi/index
Expand Down
2 changes: 2 additions & 0 deletions netbox_ptov/api/urls.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# api/urls.py

from netbox.api.routers import NetBoxRouter

from netbox_ptov.api.views import (
Expand Down
2 changes: 2 additions & 0 deletions netbox_ptov/api/views.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# api/views.py

from netbox.api.viewsets import NetBoxModelViewSet
from rest_framework.routers import APIRootView

Expand Down
8 changes: 4 additions & 4 deletions netbox_ptov/filtersets.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,30 @@
from .models import gns3srv, ptovjob, switchtojob



class gns3srvFilterSet(NetBoxModelFilterSet):

class Meta:
model = gns3srv
fields = ['name', ]


def search(self, queryset, name, value):
return queryset.filter(description__icontains=value)

class ptovjobFilterSet(NetBoxModelFilterSet):

class ptovjobFilterSet(NetBoxModelFilterSet):
class Meta:
model = ptovjob
fields = ['name', 'gns3prjname', 'gns3srv', 'eosuname' ]


def search(self, queryset, name, value):
return queryset.filter(description__icontains=value)

class switchtojobFilterSet(NetBoxModelFilterSet):

class Meta:
model = switchtojob
fields = ['name', 'switch', 'job' ]


def search(self, queryset, name, value):
return queryset.filter(description__icontains=value)
2 changes: 1 addition & 1 deletion netbox_ptov/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by Django 5.0.9 on 2024-10-21 12:43
# migrations/0001_initial.py

import django.db.models.deletion
import taggit.managers
Expand Down
2 changes: 0 additions & 2 deletions netbox_ptov/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@


urlpatterns = (
# path("vlab_results/", views.vlab_result, name="vlab_result"),
path("golabs/", views.golab, name="golab"),

path("gns3srvs/", views.gns3srvListView.as_view(), name="gns3srv_list"),
path("gns3srvs/add/", views.gns3srvEditView.as_view(), name="gns3srv_add"),
path("gns3srvs/<int:pk>/", views.gns3srvView.as_view(), name="gns3srv"),
Expand Down
22 changes: 20 additions & 2 deletions netbox_ptov/views.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
from dcnodatg import dcnodatg
# from django.db.models import Count
from netbox.views import generic
from netbox_ptov import filtersets, forms, models, tables
from netbox_ptov.models import gns3srv
from django.shortcuts import render, redirect
from django.contrib import messages
#from django.forms.models import ConfigContextModelQuerySet
import json


def golab(request):
if request.method == 'POST':
form = forms.golabForm(request.POST)
Expand All @@ -34,37 +33,56 @@ def golab(request):
form = forms.golabForm()
return render(request, 'golab.html', {'form': form})


class gns3srvView(generic.ObjectView):
queryset = models.gns3srv.objects.all()


class gns3srvListView(generic.ObjectListView):
queryset = models.gns3srv.objects.all()
table = tables.gns3srvTable


class gns3srvEditView(generic.ObjectEditView):
queryset = models.gns3srv.objects.all()
form = forms.gns3srvForm


class gns3srvDeleteView(generic.ObjectDeleteView):
queryset = models.gns3srv.objects.all()


class ptovjobView(generic.ObjectView):
queryset = models.ptovjob.objects.all()


class ptovjobListView(generic.ObjectListView):
queryset = models.ptovjob.objects.all()
table = tables.ptovjobTable


class ptovjobEditView(generic.ObjectEditView):
queryset = models.ptovjob.objects.all()
form = forms.ptovjobForm


class ptovjobDeleteView(generic.ObjectDeleteView):
queryset = models.ptovjob.objects.all()


class switchtojobView(generic.ObjectView):
queryset = models.switchtojob.objects.all()


class switchtojobListView(generic.ObjectListView):
queryset = models.switchtojob.objects.all()
table = tables.switchtojobTable


class switchtojobEditView(generic.ObjectEditView):
queryset = models.switchtojob.objects.all()
form = forms.switchtojobForm


class switchtojobDeleteView(generic.ObjectDeleteView):
queryset = models.switchtojob.objects.all()

0 comments on commit a7ebbf0

Please sign in to comment.