Commits

George Notaras committed 15921b0

Renamed zone import/export templates.

Comments (0)

Files changed (11)

src/powerdns_manager/templates/powerdns_manager/export/zone.html

-{% extends "admin/base_site.html" %}
-{% load i18n %}
-{% load url from future %}
-
-{% block breadcrumbs %}
-    <div class="breadcrumbs">
-        <a href="{% url 'admin:index' %}">{% trans 'Home' %}</a>
-        &rsaquo; <a href="{% url 'admin:app_list' app_label='powerdns_manager' %}">PowerDNS Manager</a>
-        &rsaquo; <a href="{% url 'admin:powerdns_manager_domain_changelist' %}">{% trans "Zones" %}</a>
-        &rsaquo; {% trans "Export zone file" %}
-    </div>
-{% endblock %}
-
-{% block title %}{% trans 'Zone file for' %} {{ origin }}{% endblock %}
-
-{% block content %}
-    <h1>{% trans 'Zone file for' %} {{ origin }}</h1>
-    <p>{% trans 'The zone file has been exported successfully.' %}</p>
-    <pre>{{ zone_text }}</pre>
-{% endblock %}

src/powerdns_manager/templates/powerdns_manager/import/axfr.html

-{% extends "admin/base_site.html" %}
-{% load i18n static %}
-{% load url from future %}
-
-{% block extrastyle %}{{ block.super }}<link rel="stylesheet" type="text/css" href="{% static "admin/css/forms.css" %}" />{% endblock %}
-
-{% block title %}{% trans "Import zone using AXFR query" %}{% endblock %}
-
-{% block breadcrumbs %}
-    <div class="breadcrumbs">
-        <a href="{% url 'admin:index' %}">{% trans 'Home' %}</a>
-        &rsaquo; <a href="{% url 'admin:app_list' app_label='powerdns_manager' %}">PowerDNS Manager</a>
-        &rsaquo; <a href="{% url 'admin:powerdns_manager_domain_changelist' %}">{% trans "Zones" %}</a>
-        &rsaquo; {% trans "Import zone using AXFR query" %}
-    </div>
-{% endblock %}
-
-{% block content %}
-    <div id="content-main">
-        
-        <form action="" method="post">{% csrf_token %}
-        <div>
-            {% if form.errors %}
-                <p class="errornote">
-                {% blocktrans count counter=form.errors.items|length %}Please correct the error below.{% plural %}Please correct the errors below.{% endblocktrans %}
-                </p>
-            {% endif %}
-
-            <h1>{% trans 'Import zone using AXFR query' %}</h1>
-            <p>{% trans "This web form facilitates importing zone data using AXFR queries." %}</p>
-            <p>{% trans "By checking ``overwrite``, if a zone with the same origin exists in your database will be deleted and replaced by the imported one. Proceed with caution." %}</p>
-            
-            <fieldset class="module aligned wide">
-    
-                <div class="form-row">
-                    {{ form.origin.errors }}
-                    <label for="id_origin" class="required">{% trans 'Origin' %}:</label>{{ form.origin }}
-                </div>
-    
-                <div class="form-row">
-                    {{ form.nameserver.errors }}
-                    <label for="id_nameserver" class="required">{% trans 'Nameserver IP' %}:</label>{{ form.nameserver }}
-                </div>
-    
-                <div class="form-row">
-                    {{ form.overwrite.errors }}
-                    <label for="id_overwrite" class="">{% trans 'Overwrite' %}:</label>{{ form.overwrite }}
-                </div>
-    
-            </fieldset>
-
-            <div class="submit-row">
-                <input type="submit" value="{% trans 'Import zone' %}" class="default" />
-            </div>
-
-            <script type="text/javascript">document.getElementById("id_origin").focus();</script>
-        </div>
-        </form>
-
-    </div> <!-- content-main -->
-{% endblock %}

src/powerdns_manager/templates/powerdns_manager/import/error.html

-{% extends "admin/base_site.html" %}
-{% load i18n %}
-{% load url from future %}
-
-{% block breadcrumbs %}
-    <div class="breadcrumbs">
-        <a href="{% url 'admin:index' %}">{% trans 'Home' %}</a>
-        &rsaquo; {% trans 'Import zone file' %}
-    </div>
-{% endblock %}
-
-{% block title %}{% trans 'Error' %}{% endblock %}
-
-{% block content %}
-	<h1>{% trans 'Error' %}</h1>
-	<p><span style="color: red;">{{ strerror }}</span></p>
-	<p>{% trans "Please use your browser\'s <em>Back</em> button to return to the zone import form." %}</p>
-{% endblock %}

src/powerdns_manager/templates/powerdns_manager/import/success.html

-{% extends "admin/base_site.html" %}
-{% load i18n %}
-{% load url from future %}
-
-{% block breadcrumbs %}
-    <div class="breadcrumbs">
-        <a href="{% url 'admin:index' %}">{% trans 'Home' %}</a>
-        &rsaquo; {% trans 'Import zone file' %}
-    </div>
-{% endblock %}
-
-{% block title %}{% trans 'Zone import successful' %}{% endblock %}
-
-{% block content %}
-	<h1>{% trans 'Zone import successful' %}</h1>
-	<p>{% trans 'The zone file has been imported successfully. Import ' %}
-	{% if is_axfr %}
-	    <a href="{% url 'import_axfr' %}">{% trans 'another zone' %}</a>
-	{% else %}
-	    <a href="{% url 'import_zone' %}">{% trans 'another zone' %}</a>
-	{% endif %}
-	.</p>
-{% endblock %}

src/powerdns_manager/templates/powerdns_manager/import/zone.html

-{% extends "admin/base_site.html" %}
-{% load i18n static %}
-{% load url from future %}
-
-{% block extrastyle %}{{ block.super }}<link rel="stylesheet" type="text/css" href="{% static "admin/css/forms.css" %}" />{% endblock %}
-
-{% block title %}{% trans "Import zone file to PowerDNS Manager" %}{% endblock %}
-
-{% block breadcrumbs %}
-    <div class="breadcrumbs">
-        <a href="{% url 'admin:index' %}">{% trans 'Home' %}</a>
-        &rsaquo; <a href="{% url 'admin:app_list' app_label='powerdns_manager' %}">PowerDNS Manager</a>
-        &rsaquo; <a href="{% url 'admin:powerdns_manager_domain_changelist' %}">{% trans "Zones" %}</a>
-        &rsaquo; {% trans "Import zone file" %}
-    </div>
-{% endblock %}
-
-{% block content %}
-    <div id="content-main">
-        
-        <form action="" method="post">{% csrf_token %}
-        <div>
-            {% if form.errors %}
-                <p class="errornote">
-                {% blocktrans count counter=form.errors.items|length %}Please correct the error below.{% plural %}Please correct the errors below.{% endblocktrans %}
-                </p>
-            {% endif %}
-
-	        <h1>{% trans 'Import Zone File' %}</h1>
-	        <p>{% trans "This web form facilitates importing zone files to PowerDNS Manager by pasting the zone file data in the textarea below." %}</p>
-	        <p>{% trans "The origin field is optional. It should be filled in case this information is not available in your zone file either by the $ORIGIN directive or by using an FQDN in the name field of each record." %}</p>
-	        <p>{% trans "By checking ``overwrite``, if a zone with the same origin exists in your database will be deleted and replaced by the imported one. Proceed with caution." %}</p>
-            
-	        <fieldset class="module aligned wide">
-	
-	            <div class="form-row">
-	                {{ form.origin.errors }}
-	                <label for="id_origin" class="">{% trans 'Origin' %}:</label>{{ form.origin }}
-	            </div>
-	
-	            <div class="form-row">
-	                {{ form.zonetext.errors }}
-	                <label for="id_zonetext" class="required">{% trans 'Zone file text' %}:</label>{{ form.zonetext }}
-	            </div>
-	
-	            <div class="form-row">
-	                {{ form.overwrite.errors }}
-	                <label for="id_overwrite" class="">{% trans 'Overwrite' %}:</label>{{ form.overwrite }}
-	            </div>
-	
-	        </fieldset>
-
-	        <div class="submit-row">
-	            <input type="submit" value="{% trans 'Import zone' %}" class="default" />
-	        </div>
-
-            <script type="text/javascript">document.getElementById("id_origin").focus();</script>
-        </div>
-        </form>
-
-    </div> <!-- content-main -->
-{% endblock %}

src/powerdns_manager/templates/powerdns_manager/zone/export/zonefile.html

+{% extends "admin/base_site.html" %}
+{% load i18n %}
+{% load url from future %}
+
+{% block breadcrumbs %}
+    <div class="breadcrumbs">
+        <a href="{% url 'admin:index' %}">{% trans 'Home' %}</a>
+        &rsaquo; <a href="{% url 'admin:app_list' app_label='powerdns_manager' %}">PowerDNS Manager</a>
+        &rsaquo; <a href="{% url 'admin:powerdns_manager_domain_changelist' %}">{% trans "Zones" %}</a>
+        &rsaquo; {% trans "Export zone file" %}
+    </div>
+{% endblock %}
+
+{% block title %}{% trans 'Zone file for' %} {{ origin }}{% endblock %}
+
+{% block content %}
+    <h1>{% trans 'Zone file for' %} {{ origin }}</h1>
+    <p>{% trans 'The zone file has been exported successfully.' %}</p>
+    <pre>{{ zone_text }}</pre>
+{% endblock %}

src/powerdns_manager/templates/powerdns_manager/zone/import/axfr.html

+{% extends "admin/base_site.html" %}
+{% load i18n static %}
+{% load url from future %}
+
+{% block extrastyle %}{{ block.super }}<link rel="stylesheet" type="text/css" href="{% static "admin/css/forms.css" %}" />{% endblock %}
+
+{% block title %}{% trans "Import zone using AXFR query" %}{% endblock %}
+
+{% block breadcrumbs %}
+    <div class="breadcrumbs">
+        <a href="{% url 'admin:index' %}">{% trans 'Home' %}</a>
+        &rsaquo; <a href="{% url 'admin:app_list' app_label='powerdns_manager' %}">PowerDNS Manager</a>
+        &rsaquo; <a href="{% url 'admin:powerdns_manager_domain_changelist' %}">{% trans "Zones" %}</a>
+        &rsaquo; {% trans "Import zone using AXFR query" %}
+    </div>
+{% endblock %}
+
+{% block content %}
+    <div id="content-main">
+        
+        <form action="" method="post">{% csrf_token %}
+        <div>
+            {% if form.errors %}
+                <p class="errornote">
+                {% blocktrans count counter=form.errors.items|length %}Please correct the error below.{% plural %}Please correct the errors below.{% endblocktrans %}
+                </p>
+            {% endif %}
+
+            <h1>{% trans 'Import zone using AXFR query' %}</h1>
+            <p>{% trans "This web form facilitates importing zone data using AXFR queries." %}</p>
+            <p>{% trans "By checking ``overwrite``, if a zone with the same origin exists in your database will be deleted and replaced by the imported one. Proceed with caution." %}</p>
+            
+            <fieldset class="module aligned wide">
+    
+                <div class="form-row">
+                    {{ form.origin.errors }}
+                    <label for="id_origin" class="required">{% trans 'Origin' %}:</label>{{ form.origin }}
+                </div>
+    
+                <div class="form-row">
+                    {{ form.nameserver.errors }}
+                    <label for="id_nameserver" class="required">{% trans 'Nameserver IP' %}:</label>{{ form.nameserver }}
+                </div>
+    
+                <div class="form-row">
+                    {{ form.overwrite.errors }}
+                    <label for="id_overwrite" class="">{% trans 'Overwrite' %}:</label>{{ form.overwrite }}
+                </div>
+    
+            </fieldset>
+
+            <div class="submit-row">
+                <input type="submit" value="{% trans 'Import zone' %}" class="default" />
+            </div>
+
+            <script type="text/javascript">document.getElementById("id_origin").focus();</script>
+        </div>
+        </form>
+
+    </div> <!-- content-main -->
+{% endblock %}

src/powerdns_manager/templates/powerdns_manager/zone/import/error.html

+{% extends "admin/base_site.html" %}
+{% load i18n %}
+{% load url from future %}
+
+{% block breadcrumbs %}
+    <div class="breadcrumbs">
+        <a href="{% url 'admin:index' %}">{% trans 'Home' %}</a>
+        &rsaquo; {% trans 'Import zone file' %}
+    </div>
+{% endblock %}
+
+{% block title %}{% trans 'Error' %}{% endblock %}
+
+{% block content %}
+	<h1>{% trans 'Error' %}</h1>
+	<p><span style="color: red;">{{ strerror }}</span></p>
+	<p>{% trans "Please use your browser\'s <em>Back</em> button to return to the zone import form." %}</p>
+{% endblock %}

src/powerdns_manager/templates/powerdns_manager/zone/import/success.html

+{% extends "admin/base_site.html" %}
+{% load i18n %}
+{% load url from future %}
+
+{% block breadcrumbs %}
+    <div class="breadcrumbs">
+        <a href="{% url 'admin:index' %}">{% trans 'Home' %}</a>
+        &rsaquo; {% trans 'Import zone file' %}
+    </div>
+{% endblock %}
+
+{% block title %}{% trans 'Zone import successful' %}{% endblock %}
+
+{% block content %}
+	<h1>{% trans 'Zone import successful' %}</h1>
+	<p>{% trans 'The zone file has been imported successfully. Import ' %}
+	{% if is_axfr %}
+	    <a href="{% url 'import_axfr' %}">{% trans 'another zone' %}</a>
+	{% else %}
+	    <a href="{% url 'import_zone' %}">{% trans 'another zone' %}</a>
+	{% endif %}
+	.</p>
+{% endblock %}

src/powerdns_manager/templates/powerdns_manager/zone/import/zonefile.html

+{% extends "admin/base_site.html" %}
+{% load i18n static %}
+{% load url from future %}
+
+{% block extrastyle %}{{ block.super }}<link rel="stylesheet" type="text/css" href="{% static "admin/css/forms.css" %}" />{% endblock %}
+
+{% block title %}{% trans "Import zone file to PowerDNS Manager" %}{% endblock %}
+
+{% block breadcrumbs %}
+    <div class="breadcrumbs">
+        <a href="{% url 'admin:index' %}">{% trans 'Home' %}</a>
+        &rsaquo; <a href="{% url 'admin:app_list' app_label='powerdns_manager' %}">PowerDNS Manager</a>
+        &rsaquo; <a href="{% url 'admin:powerdns_manager_domain_changelist' %}">{% trans "Zones" %}</a>
+        &rsaquo; {% trans "Import zone file" %}
+    </div>
+{% endblock %}
+
+{% block content %}
+    <div id="content-main">
+        
+        <form action="" method="post">{% csrf_token %}
+        <div>
+            {% if form.errors %}
+                <p class="errornote">
+                {% blocktrans count counter=form.errors.items|length %}Please correct the error below.{% plural %}Please correct the errors below.{% endblocktrans %}
+                </p>
+            {% endif %}
+
+	        <h1>{% trans 'Import Zone File' %}</h1>
+	        <p>{% trans "This web form facilitates importing zone files to PowerDNS Manager by pasting the zone file data in the textarea below." %}</p>
+	        <p>{% trans "The origin field is optional. It should be filled in case this information is not available in your zone file either by the $ORIGIN directive or by using an FQDN in the name field of each record." %}</p>
+	        <p>{% trans "By checking ``overwrite``, if a zone with the same origin exists in your database will be deleted and replaced by the imported one. Proceed with caution." %}</p>
+            
+	        <fieldset class="module aligned wide">
+	
+	            <div class="form-row">
+	                {{ form.origin.errors }}
+	                <label for="id_origin" class="">{% trans 'Origin' %}:</label>{{ form.origin }}
+	            </div>
+	
+	            <div class="form-row">
+	                {{ form.zonetext.errors }}
+	                <label for="id_zonetext" class="required">{% trans 'Zone file text' %}:</label>{{ form.zonetext }}
+	            </div>
+	
+	            <div class="form-row">
+	                {{ form.overwrite.errors }}
+	                <label for="id_overwrite" class="">{% trans 'Overwrite' %}:</label>{{ form.overwrite }}
+	            </div>
+	
+	        </fieldset>
+
+	        <div class="submit-row">
+	            <input type="submit" value="{% trans 'Import zone' %}" class="default" />
+	        </div>
+
+            <script type="text/javascript">document.getElementById("id_origin").focus();</script>
+        </div>
+        </form>
+
+    </div> <!-- content-main -->
+{% endblock %}

src/powerdns_manager/views.py

                 info_dict = {
                     'strerror': mark_safe(str(e)),
                 }
-                return render_to_response('powerdns_manager/import/error.html', info_dict)
-            return render_to_response('powerdns_manager/import/success.html', {})
+                return render_to_response('powerdns_manager/zone/import/error.html', info_dict)
+            return render_to_response('powerdns_manager/zone/import/success.html', {})
             
     else:
         form = ZoneImportForm() # An unbound form
         'form': form,
     }
     return render_to_response(
-        'powerdns_manager/import/zone.html', info_dict, context_instance=RequestContext(request))
+        'powerdns_manager/zoneimport/zonefile.html', info_dict, context_instance=RequestContext(request))
 
 
 
                 info_dict = {
                     'strerror': mark_safe(str(e)),
                 }
-                return render_to_response('powerdns_manager/import/error.html', {})
+                return render_to_response('powerdns_manager/zone/import/error.html', {})
             info_dict = {'is_axfr': True}
-            return render_to_response('powerdns_manager/import/success.html', info_dict)
+            return render_to_response('powerdns_manager/zone/import/success.html', info_dict)
             
     else:
         form = AxfrImportForm() # An unbound form
         'form': form,
     }
     return render_to_response(
-        'powerdns_manager/import/axfr.html', info_dict, context_instance=RequestContext(request))
+        'powerdns_manager/zone/import/axfr.html', info_dict, context_instance=RequestContext(request))
 
 
 
         'origin': origin,
     }
     return render_to_response(
-        'powerdns_manager/export/zone.html', info_dict, context_instance=RequestContext(request))
+        'powerdns_manager/zone/export/zonefile.html', info_dict, context_instance=RequestContext(request))
 
 
 
 
 
 
+@login_required
+@csrf_protect
+def zone_set_type_view(request, id_list):
+    """sets the domain type on the selected zones.
+    
+    Accepts a comma-delimited list of Domain object IDs.
+    
+    An intermediate page asking for the new zone type is used.
+    
+    """
+    # Create a list from the provided comma-delimited list of IDs.
+    id_list = id_list.split(',')
+    
+    # Permission check on models.
+    if not request.user.has_perms([
+            'powerdns_manager.change_domain',
+        ]):
+        messages.error(request, 'Insufficient permissions for this action.')
+        return HttpResponseRedirect(reverse('admin:powerdns_manager_domain_changelist'))
+    
+    if request.method == 'POST':
+        domain_type = request.POST.get('domaintype')
+        
+        Domain = cache.get_model('powerdns_manager', 'Domain')
+        
+        for n, zone_id in enumerate(id_list):
+            obj = Domain.objects.get(id=zone_id)
+            obj_display = force_unicode(obj)
+            
+            # Check change permission
+            if not request.user.has_perm('powerdns_manager.change_domain', obj):
+                messages.error(request, 'Permission denied for domain: %s' % obj_display)
+            else:
+                obj.type = domain_type
+                obj.update_serial()
+                obj.save()
+                
+        n += 1
+        if n == 1:
+            messages.info(request, "Successfully set the type of '%s' to '%s'" % (obj_display, domain_type))
+        elif n > 1:
+            messages.info(request, "Successfully set the type of %s zones to '%s'" % (n, domain_type))
+            
+        # Redirect to the Domain changelist.
+        return HttpResponseRedirect(reverse('admin:powerdns_manager_domain_changelist'))
+    
+    else:
+        info_dict = {
+            'form': ZoneTypeSelectionForm(),
+            'id_list': id_list,
+        }
+        return render_to_response(
+            'powerdns_manager/zone/set_type.html', info_dict, context_instance=RequestContext(request))
+
+
 
 @login_required
 @csrf_protect
     
 
 
-@login_required
-@csrf_protect
-def zone_set_type_view(request, id_list):
-    """sets the domain type on the selected zones.
-    
-    Accepts a comma-delimited list of Domain object IDs.
-    
-    An intermediate page asking for the new zone type is used.
-    
-    """
-    # Create a list from the provided comma-delimited list of IDs.
-    id_list = id_list.split(',')
-    
-    # Permission check on models.
-    if not request.user.has_perms([
-            'powerdns_manager.change_domain',
-        ]):
-        messages.error(request, 'Insufficient permissions for this action.')
-        return HttpResponseRedirect(reverse('admin:powerdns_manager_domain_changelist'))
-    
-    if request.method == 'POST':
-        domain_type = request.POST.get('domaintype')
-        
-        Domain = cache.get_model('powerdns_manager', 'Domain')
-        
-        for n, zone_id in enumerate(id_list):
-            obj = Domain.objects.get(id=zone_id)
-            obj_display = force_unicode(obj)
-            
-            # Check change permission
-            if not request.user.has_perm('powerdns_manager.change_domain', obj):
-                messages.error(request, 'Permission denied for domain: %s' % obj_display)
-            else:
-                obj.type = domain_type
-                obj.update_serial()
-                obj.save()
-                
-        n += 1
-        if n == 1:
-            messages.info(request, "Successfully set the type of '%s' to '%s'" % (obj_display, domain_type))
-        elif n > 1:
-            messages.info(request, "Successfully set the type of %s zones to '%s'" % (n, domain_type))
-            
-        # Redirect to the Domain changelist.
-        return HttpResponseRedirect(reverse('admin:powerdns_manager_domain_changelist'))
-    
-    else:
-        info_dict = {
-            'form': ZoneTypeSelectionForm(),
-            'id_list': id_list,
-        }
-        return render_to_response(
-            'powerdns_manager/zone/set_type.html', info_dict, context_instance=RequestContext(request))
-        
-        
-        
+
+