mirror of
https://github.com/retspen/webvirtcloud
synced 2026-12-03 01:16:10 +00:00
feat: a Tags page and tags in the API
Administration gets a Tags page: each tag with how many VMs and hosts have it, renamed (on the VMs, hosts and removed VMs that keep it) or deleted (taken off all of them). Both are logged. The API gives a VM's and a host's tags by name, read only, and its VM and host lists take ?tag= for those with a tag.
This commit is contained in:
parent
11b447f681
commit
f4051213fb
15 changed files with 508 additions and 163 deletions
|
|
@ -12,6 +12,7 @@ from django.utils.translation import gettext_lazy as _
|
|||
from accounts.forms import UniqueEmailMixin
|
||||
from accounts.models import UserAttributes, UserInstance
|
||||
from appsettings.settings import app_settings
|
||||
from computes.models import Tag
|
||||
from instances.models import Instance
|
||||
|
||||
from .models import Permission
|
||||
|
|
@ -49,6 +50,15 @@ def permission_rows(field):
|
|||
return rows
|
||||
|
||||
|
||||
class TagForm(forms.ModelForm):
|
||||
class Meta:
|
||||
model = Tag
|
||||
fields = ["name"]
|
||||
|
||||
def clean_name(self):
|
||||
return self.cleaned_data["name"].strip().lower()
|
||||
|
||||
|
||||
class GroupForm(forms.ModelForm):
|
||||
permissions = forms.ModelMultipleChoiceField(
|
||||
widget=forms.CheckboxSelectMultiple,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue