Commit 961a5f71 by Kálmán Viktor

network: use mixin in record create view to set owner

parent 338c3960
......@@ -495,21 +495,21 @@ class RecordCreate(LoginRequiredMixin, SuperuserRequiredMixin,
success_message = _(u'Successfully created record!')
def get_initial(self):
initial = super(RecordCreate, self).get_initial()
initial['domain'] = self.request.GET.get('domain')
host_pk = self.request.GET.get("host")
try:
host = Host.objects.get(pk=host_pk)
except (Host.DoesNotExist, ValueError):
host = None
initial = {'owner': self.request.user}
if host:
initial.update({
'type': "CNAME",
'host': host,
'address': host.get_fqdn(),
})
else:
initial['domain'] = self.request.GET.get('domain')
return initial
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment