mirror of
git://git.yoctoproject.org/layerindex-web.git
synced 2025-07-19 20:59:01 +02:00
rrs: admin: add in-line for Milestones to Releases
If you're creating a new release then you will need to create milestones within it, so add in-line forms for these. Unfortunately there's no capability yet to automatically split up the release into n milestones (or perhaps copy milestones from a previous release), that will have to wait until later - for now this makes things a little easier. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
This commit is contained in:
parent
b34d5072d7
commit
da81a2cdf3
19
rrs/admin.py
19
rrs/admin.py
|
@ -121,10 +121,29 @@ class MaintenancePlanAdmin(admin.ModelAdmin):
|
||||||
milestone.end_date = release.end_date
|
milestone.end_date = release.end_date
|
||||||
milestone.save()
|
milestone.save()
|
||||||
|
|
||||||
|
class MilestoneFormSet(BaseInlineFormSet):
|
||||||
|
def clean(self):
|
||||||
|
super(MilestoneFormSet, self).clean()
|
||||||
|
total = 0
|
||||||
|
for form in self.forms:
|
||||||
|
if not form.is_valid():
|
||||||
|
return
|
||||||
|
if form.cleaned_data and not form.cleaned_data.get('DELETE'):
|
||||||
|
total += 1
|
||||||
|
if not total:
|
||||||
|
raise ValidationError('Releases must have at least one milestone')
|
||||||
|
|
||||||
|
class MilestoneInline(admin.StackedInline):
|
||||||
|
model = Milestone
|
||||||
|
formset = MilestoneFormSet
|
||||||
|
|
||||||
class ReleaseAdmin(admin.ModelAdmin):
|
class ReleaseAdmin(admin.ModelAdmin):
|
||||||
search_fields = ['name']
|
search_fields = ['name']
|
||||||
list_filter = ['plan']
|
list_filter = ['plan']
|
||||||
model = Release
|
model = Release
|
||||||
|
inlines = [
|
||||||
|
MilestoneInline,
|
||||||
|
]
|
||||||
|
|
||||||
class MilestoneAdmin(admin.ModelAdmin):
|
class MilestoneAdmin(admin.ModelAdmin):
|
||||||
search_fields = ['name']
|
search_fields = ['name']
|
||||||
|
|
Loading…
Reference in New Issue
Block a user