コード例 #1
0
ファイル: creator.py プロジェクト: bpepple/metron
 def get_context_data(self, **kwargs):
     context = super(CreatorCreate, self).get_context_data(**kwargs)
     if self.request.POST:
         context["attribution"] = AttributionFormSet(self.request.POST)
     else:
         context["attribution"] = AttributionFormSet()
     return context
コード例 #2
0
ファイル: team.py プロジェクト: bpepple/metron
 def get_context_data(self, **kwargs):
     context = super(TeamCreate, self).get_context_data(**kwargs)
     context["title"] = "Add Team"
     if self.request.POST:
         context["attribution"] = AttributionFormSet(self.request.POST)
     else:
         context["attribution"] = AttributionFormSet()
     return context
コード例 #3
0
ファイル: team.py プロジェクト: bpepple/metron
 def get_context_data(self, **kwargs):
     context = super(TeamUpdate, self).get_context_data(**kwargs)
     context["title"] = f"Edit information for {context['team']}"
     if self.request.POST:
         context["attribution"] = AttributionFormSet(
             self.request.POST,
             instance=self.object,
             queryset=(Attribution.objects.filter(teams=self.object)),
             prefix="attribution",
         )
         context["attribution"].full_clean()
     else:
         context["attribution"] = AttributionFormSet(
             instance=self.object,
             queryset=(Attribution.objects.filter(teams=self.object)),
             prefix="attribution",
         )
     return context
コード例 #4
0
ファイル: creator.py プロジェクト: bpepple/metron
 def get_context_data(self, **kwargs):
     context = super(CreatorUpdate, self).get_context_data(**kwargs)
     context["title"] = "Edit Creator Information"
     if self.request.POST:
         context["attribution"] = AttributionFormSet(
             self.request.POST,
             instance=self.object,
             queryset=(Attribution.objects.filter(creators=self.object)),
             prefix="attribution",
         )
         context["attribution"].full_clean()
     else:
         context["attribution"] = AttributionFormSet(
             instance=self.object,
             queryset=(Attribution.objects.filter(creators=self.object)),
             prefix="attribution",
         )
     return context