Django:BaseFormSet& url slug

时间:2018-06-06 08:29:52

标签: django

如何在我的类BaseReserveFormSet中从我的url获取slug组织器?以前有人这样做过吗?我真的在努力解决这个问题。

BaseFormSet:

class BaseReserveFormSet(BaseFormSet):

    def clean(self):   
        queryset = Organizer.objects.filter(
            # MY PROBLEM: HOW DO I GET <slug:organizer> IN HERE?
            slug='lorem-2',
        )
        max_qty_per_ticket = queryset.first().max_qty_per_ticket

urls.py

urlpatterns = [
    path('<slug:organizer>/<slug:event>/', event_detail_view, name='event'),
]

0 个答案:

没有答案