George Notaras avatar George Notaras committed 0bfc5bf

Also clone the Domain Metadata.

Comments (0)

Files changed (1)

src/powerdns_manager/actions.py

     Domain = cache.get_model('powerdns_manager', 'Domain')
     Record = cache.get_model('powerdns_manager', 'Record')
     DynamicZone = cache.get_model('powerdns_manager', 'DynamicZone')
-
+    DomainMetadata = cache.get_model('powerdns_manager', 'DomainMetadata')
+    
     # Check the number of selected zones. This action can work on a single zone.
     
     n = queryset.count()
                 )
             clone_dynzone_obj.save()
             
+            # Clone the zone's metadata
+            
+            # Get the base domain's metadata object.
+            # There is only one metadata object for each zone.
+            domain_metadata_obj = DomainMetadata.objects.get(domain=domain_obj)
+            
+            # Create and save the metadata object for the clone.
+            clone_metadata_obj = DomainMetadata(
+                domain = clone_obj,
+                kind = domain_metadata_obj.kind,
+                content = domain_metadata_obj.content
+                )
+            clone_metadata_obj.save()
+            
             messages.info(request, 'Successfully cloned %s zone to %s' % \
                 (domain_obj.name, clone_domain_name))
             
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.