Commit e9bb99e3 authored by fred's avatar fred
Browse files

select newsitem category by default if there is only one

parent 607172e7
......@@ -518,6 +518,8 @@ class EmissionNewsItemAdd(CreateView):
initial['emission'] = Emission.objects.get(slug=self.kwargs.get('emission_slug'))
initial['date'] =
initial['user'] = self.request.user
if NewsCategory.objects.all().count() == 1:
initial['category'] =[0]
return initial
def get_context_data(self, **kwargs):
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment