Add missing BusinessConstraint resource/admin
- Legacy-Id: 17903
This commit is contained in:
parent
69a5752a00
commit
2c49e7b2dd
|
@ -6,7 +6,7 @@ from django.contrib import admin
|
||||||
|
|
||||||
from ietf.meeting.models import (Meeting, Room, Session, TimeSlot, Constraint, Schedule,
|
from ietf.meeting.models import (Meeting, Room, Session, TimeSlot, Constraint, Schedule,
|
||||||
SchedTimeSessAssignment, ResourceAssociation, FloorPlan, UrlResource,
|
SchedTimeSessAssignment, ResourceAssociation, FloorPlan, UrlResource,
|
||||||
SessionPresentation, ImportantDate, SlideSubmission, SchedulingEvent)
|
SessionPresentation, ImportantDate, SlideSubmission, SchedulingEvent, BusinessConstraint)
|
||||||
|
|
||||||
|
|
||||||
class UrlResourceAdmin(admin.ModelAdmin):
|
class UrlResourceAdmin(admin.ModelAdmin):
|
||||||
|
@ -65,6 +65,18 @@ class TimeSlotAdmin(admin.ModelAdmin):
|
||||||
admin.site.register(TimeSlot, TimeSlotAdmin)
|
admin.site.register(TimeSlot, TimeSlotAdmin)
|
||||||
|
|
||||||
|
|
||||||
|
class BusinessConstraintAdmin(admin.ModelAdmin):
|
||||||
|
list_display = ["slug", "name", "penalty"]
|
||||||
|
search_fields = ["slug", "name"]
|
||||||
|
|
||||||
|
def name_lower(self, instance):
|
||||||
|
return instance.name.name.lower()
|
||||||
|
|
||||||
|
name_lower.short_description = "businessconstraint" # type: ignore # https://github.com/python/mypy/issues/2087
|
||||||
|
|
||||||
|
admin.site.register(BusinessConstraint, BusinessConstraintAdmin)
|
||||||
|
|
||||||
|
|
||||||
class ConstraintAdmin(admin.ModelAdmin):
|
class ConstraintAdmin(admin.ModelAdmin):
|
||||||
list_display = ["meeting", "source", "name_lower", "target"]
|
list_display = ["meeting", "source", "name_lower", "target"]
|
||||||
raw_id_fields = ["meeting", "source", "target"]
|
raw_id_fields = ["meeting", "source", "target"]
|
||||||
|
|
|
@ -13,7 +13,8 @@ from ietf import api
|
||||||
|
|
||||||
from ietf.meeting.models import ( Meeting, ResourceAssociation, Constraint, Room, Schedule, Session,
|
from ietf.meeting.models import ( Meeting, ResourceAssociation, Constraint, Room, Schedule, Session,
|
||||||
TimeSlot, SchedTimeSessAssignment, SessionPresentation, FloorPlan,
|
TimeSlot, SchedTimeSessAssignment, SessionPresentation, FloorPlan,
|
||||||
UrlResource, ImportantDate, SlideSubmission, SchedulingEvent )
|
UrlResource, ImportantDate, SlideSubmission, SchedulingEvent,
|
||||||
|
BusinessConstraint)
|
||||||
|
|
||||||
from ietf.name.resources import MeetingTypeNameResource
|
from ietf.name.resources import MeetingTypeNameResource
|
||||||
class MeetingResource(ModelResource):
|
class MeetingResource(ModelResource):
|
||||||
|
@ -358,3 +359,18 @@ class SlideSubmissionResource(ModelResource):
|
||||||
"submitter": ALL_WITH_RELATIONS,
|
"submitter": ALL_WITH_RELATIONS,
|
||||||
}
|
}
|
||||||
api.meeting.register(SlideSubmissionResource())
|
api.meeting.register(SlideSubmissionResource())
|
||||||
|
|
||||||
|
|
||||||
|
class BusinessConstraintResource(ModelResource):
|
||||||
|
class Meta:
|
||||||
|
queryset = BusinessConstraint.objects.all()
|
||||||
|
serializer = api.Serializer()
|
||||||
|
cache = SimpleCache()
|
||||||
|
#resource_name = 'businessconstraint'
|
||||||
|
ordering = ['slug', ]
|
||||||
|
filtering = {
|
||||||
|
"slug": ALL,
|
||||||
|
"name": ALL,
|
||||||
|
"penalty": ALL,
|
||||||
|
}
|
||||||
|
api.meeting.register(BusinessConstraintResource())
|
||||||
|
|
Loading…
Reference in a new issue