Commit 2264b2fe by Kálmán Viktor

network: record list to domain edit

parent 52aa7931
...@@ -100,6 +100,18 @@ class RecordTable(Table): ...@@ -100,6 +100,18 @@ class RecordTable(Table):
order_by = 'name' order_by = 'name'
class SmallRecordTable(Table):
fqdn = LinkColumn('network.record', args=[A('pk')], orderable=False)
class Meta:
model = Record
attrs = {'class': 'table table-striped table-bordered'}
fields = ('type', 'fqdn', 'host', 'address', )
sequence = ('type', 'fqdn', )
order_by = '-type'
orderable = False
class RuleTable(Table): class RuleTable(Table):
r_type = LinkColumn('network.rule', args=[A('pk')]) r_type = LinkColumn('network.rule', args=[A('pk')])
color_desc = TemplateColumn( color_desc = TemplateColumn(
......
...@@ -12,8 +12,15 @@ ...@@ -12,8 +12,15 @@
</div> </div>
<div class="row"> <div class="row">
<div class="col-sm-4"> <div class="col-sm-5">
{% crispy form %} {% crispy form %}
</div> </div>
<div class="col-sm-5 col-sm-offset-1">
<h3>
List of this domain's records
</h3>
<hr />
{% render_table record_list %}
</div>
</div> </div>
{% endblock %} {% endblock %}
...@@ -10,7 +10,8 @@ from firewall.models import (Host, Vlan, Domain, Group, Record, Blacklist, ...@@ -10,7 +10,8 @@ from firewall.models import (Host, Vlan, Domain, Group, Record, Blacklist,
Rule, VlanGroup) Rule, VlanGroup)
from .tables import (HostTable, VlanTable, SmallHostTable, DomainTable, from .tables import (HostTable, VlanTable, SmallHostTable, DomainTable,
GroupTable, RecordTable, BlacklistTable, RuleTable, GroupTable, RecordTable, BlacklistTable, RuleTable,
VlanGroupTable, SmallRuleTable, SmallGroupRuleTable) VlanGroupTable, SmallRuleTable, SmallGroupRuleTable,
SmallRecordTable)
from .forms import (HostForm, VlanForm, DomainForm, GroupForm, RecordForm, from .forms import (HostForm, VlanForm, DomainForm, GroupForm, RecordForm,
BlacklistForm, RuleForm, VlanGroupForm) BlacklistForm, RuleForm, VlanGroupForm)
...@@ -123,6 +124,10 @@ class DomainDetail(UpdateView): ...@@ -123,6 +124,10 @@ class DomainDetail(UpdateView):
def get_context_data(self, *args, **kwargs): def get_context_data(self, *args, **kwargs):
context = super(DomainDetail, self).get_context_data(**kwargs) context = super(DomainDetail, self).get_context_data(**kwargs)
context['domain_pk'] = self.get_object().pk context['domain_pk'] = self.get_object().pk
# records
q = Record.objects.filter(domain=self.get_object()).all()
context['record_list'] = SmallRecordTable(q)
return context return context
......
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