mirror of
https://github.com/bugsink/bugsink.git
synced 2025-12-21 13:00:13 -06:00
32 lines
767 B
Python
32 lines
767 B
Python
from django.forms import ModelForm
|
|
|
|
from .models import MessagingServiceConfig
|
|
|
|
|
|
class MessagingServiceConfigNewForm(ModelForm):
|
|
|
|
def __init__(self, project, *args, **kwargs):
|
|
super().__init__(*args, **kwargs)
|
|
self.project = project
|
|
|
|
class Meta:
|
|
model = MessagingServiceConfig
|
|
fields = ["display_name", "kind"]
|
|
|
|
def save(self, commit=True):
|
|
instance = super().save(commit=False)
|
|
instance.project = self.project
|
|
if commit:
|
|
instance.save()
|
|
return instance
|
|
|
|
|
|
class MessagingServiceConfigEditForm(ModelForm):
|
|
|
|
def __init__(self, *args, **kwargs):
|
|
super().__init__(*args, **kwargs)
|
|
|
|
class Meta:
|
|
model = MessagingServiceConfig
|
|
fields = ["display_name"]
|