def data(self): jinx0 = DNSRecord(name="jinx0.lindenlab.com", comment="Fancy new MX Record") jinx0.save() jinx1 = DNSRecord(name="jinx1.lindenlab.com", comment="Fancy new A Record") jinx1.save() jinx = DNSService(name="jinx", comment="Fancy Jinx group") jinx.save() jinx0.group = jinx jinx1.group = jinx jinx0.save() jinx1.save() jinx.save()
def set_dns_service_group(response, dns_record, service_group): """Sets the service group to which a record belongs. If passed a group name of None, remove the record from any group it is a member of. Arguments: dns_hostname -- The dns hostname of a record. service_group -- The service group name. """ if service_group: group = _get_dns_service_group_instance(response, service_group) else: group = None try: record = DNSRecord.objects.get(name=dns_record) except ObjectDoesNotExist: record = DNSRecord(name=dns_record) record.group = group record.save() return True