I have a many to one relationship between domain and DNSRecord. When
adding a domain I need to add some default DNSRecords. I do this after
saving the domain using the following code.


domain = form.save(commit=True)

d = DNSRecord(domain=domain, type='NS', data='ns1.mydomain.com',
aux=0, ttl=7200)
new_d = d.save()

d = DNSRecord(domain=domain, type='NS', data='ns2.mydomain.com',
aux=0, ttl=7200)
new_d = d.save()

d = DNSRecord(domain=domain, type='NS', data='ns3.mydomain.com',
aux=0, ttl=7200)
new_d = d.save()

d = DNSRecord(domain=domain, type='NS', data='ns4.mydomain.com',
aux=0, ttl=7200)
new_d = d.save()


It works but it's not very nice because the default records are hard
coded into the view. Does anyone have any suggestions for a better
approach?

Paddy


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to