Commit 458553dc by Dudás Ádám

enforszolgatom a gájdlájnokat

parent 83fcd17c
...@@ -12,12 +12,16 @@ MANAGERS = ADMINS ...@@ -12,12 +12,16 @@ MANAGERS = ADMINS
DATABASES = { DATABASES = {
'default': { 'default': {
'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. 'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2',
'NAME': 'webadmin', # Or path to database file if using sqlite3. # 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'webadmin', # Or path to database file if
# using sqlite3.
'USER': 'webadmin', # Not used with sqlite3. 'USER': 'webadmin', # Not used with sqlite3.
'PASSWORD': 'asjklddfjklqjf', # Not used with sqlite3. 'PASSWORD': 'asjklddfjklqjf', # Not used with sqlite3.
'HOST': '', # Set to empty string for localhost. Not used with sqlite3. 'HOST': '', # Set to empty string for localhost.
'PORT': '', # Set to empty string for default. Not used with sqlite3. # Not used with sqlite3.
'PORT': '', # Set to empty string for default.
# Not used with sqlite3.
} }
} }
......
...@@ -15,14 +15,21 @@ urlpatterns = patterns('', ...@@ -15,14 +15,21 @@ urlpatterns = patterns('',
url(r'^logout/$', 'school.views.logout', name='logout'), url(r'^logout/$', 'school.views.logout', name='logout'),
url(r'^vm/new/(?P<template>\d+)/$', 'one.views.vm_new', name='vm_new'), url(r'^vm/new/(?P<template>\d+)/$', 'one.views.vm_new', name='vm_new'),
url(r'^vm/show/(?P<iid>\d+)/$', 'one.views.vm_show', name='vm_show'), url(r'^vm/show/(?P<iid>\d+)/$', 'one.views.vm_show', name='vm_show'),
url(r'^vm/delete/(?P<iid>\d+)/$', 'one.views.vm_delete', name='vm_delete'), url(r'^vm/delete/(?P<iid>\d+)/$', 'one.views.vm_delete',
name='vm_delete'),
url(r'^vm/stop/(?P<iid>\d+)/$', 'one.views.vm_stop', name='vm_stop'), url(r'^vm/stop/(?P<iid>\d+)/$', 'one.views.vm_stop', name='vm_stop'),
url(r'^vm/resume/(?P<iid>\d+)/$', 'one.views.vm_resume', name='vm_resume'), url(r'^vm/resume/(?P<iid>\d+)/$', 'one.views.vm_resume',
url(r'^vm/power_off/(?P<iid>\d+)/$', 'one.views.vm_power_off', name='vm_power_off'), name='vm_resume'),
url(r'^vm/restart/(?P<iid>\d+)/$', 'one.views.vm_restart', name='vm_restart'), url(r'^vm/power_off/(?P<iid>\d+)/$', 'one.views.vm_power_off',
url(r'^vm/port_add/(?P<iid>\d+)/$', 'one.views.vm_port_add', name='vm_port_add'), name='vm_power_off'),
url(r'^vm/port_del/(?P<iid>\d+)/(?P<proto>tcp|udp)/(?P<public>\d+)/$', 'one.views.vm_port_del', name='vm_port_del'), url(r'^vm/restart/(?P<iid>\d+)/$', 'one.views.vm_restart',
url(r'^reload/$', 'firewall.views.reload_firewall', name='reload_firewall'), name='vm_restart'),
url(r'^vm/port_add/(?P<iid>\d+)/$', 'one.views.vm_port_add',
name='vm_port_add'),
url(r'^vm/port_del/(?P<iid>\d+)/(?P<proto>tcp|udp)/(?P<public>\d+)/$',
'one.views.vm_port_del', name='vm_port_del'),
url(r'^reload/$', 'firewall.views.reload_firewall',
name='reload_firewall'),
url(r'^fwapi/$', 'firewall.views.firewall_api', name='firewall_api'), url(r'^fwapi/$', 'firewall.views.firewall_api', name='firewall_api'),
url(r'^store/$', 'store.views.index', name='store_index'), url(r'^store/$', 'store.views.index', name='store_index'),
url(r'^store/top/$', 'store.views.toplist', name='store_top'), url(r'^store/top/$', 'store.views.toplist', name='store_top'),
......
...@@ -7,7 +7,9 @@ class AliasInline(contrib.admin.TabularInline): ...@@ -7,7 +7,9 @@ class AliasInline(contrib.admin.TabularInline):
model = Alias model = Alias
class HostAdmin(admin.ModelAdmin): class HostAdmin(admin.ModelAdmin):
list_display = ('hostname', 'vlan', 'ipv4', 'ipv6', 'pub_ipv4', 'mac', 'shared_ip', 'owner', 'groups_l', 'rules_l', 'description', 'reverse') list_display = ('hostname', 'vlan', 'ipv4', 'ipv6', 'pub_ipv4', 'mac',
'shared_ip', 'owner', 'groups_l', 'rules_l', 'description',
'reverse')
ordering = ('hostname', ) ordering = ('hostname', )
list_filter = ('owner', 'vlan', 'groups') list_filter = ('owner', 'vlan', 'groups')
search_fields = ('hostname', 'description', 'ipv4', 'ipv6', 'mac') search_fields = ('hostname', 'description', 'ipv4', 'ipv6', 'mac')
...@@ -16,16 +18,21 @@ class HostAdmin(admin.ModelAdmin): ...@@ -16,16 +18,21 @@ class HostAdmin(admin.ModelAdmin):
class HostInline(contrib.admin.TabularInline): class HostInline(contrib.admin.TabularInline):
model = Host model = Host
fields = ('hostname', 'ipv4', 'ipv6', 'pub_ipv4', 'mac', 'shared_ip', 'owner', 'reverse') fields = ('hostname', 'ipv4', 'ipv6', 'pub_ipv4', 'mac', 'shared_ip',
'owner', 'reverse')
class VlanAdmin(admin.ModelAdmin): class VlanAdmin(admin.ModelAdmin):
list_display = ('vid', 'name', 'rules_l', 'ipv4', 'net_ipv4', 'ipv6', 'net_ipv6', 'description', 'domain', 'snat_ip', 'snat_to_l') list_display = ('vid', 'name', 'rules_l', 'ipv4', 'net_ipv4', 'ipv6',
'net_ipv6', 'description', 'domain', 'snat_ip', 'snat_to_l')
ordering = ('vid', ) ordering = ('vid', )
inlines = (HostInline, ) inlines = (HostInline, )
class RuleAdmin(admin.ModelAdmin): class RuleAdmin(admin.ModelAdmin):
list_display = ('r_type', 'color_desc', 'description', 'vlan_l', 'owner', 'extra', 'direction', 'accept', 'proto', 'sport', 'dport', 'nat', 'nat_dport') list_display = ('r_type', 'color_desc', 'description', 'vlan_l',
list_filter = ('r_type', 'vlan', 'owner', 'direction', 'accept', 'proto', 'nat') 'owner', 'extra', 'direction', 'accept', 'proto', 'sport', 'dport',
'nat', 'nat_dport')
list_filter = ('r_type', 'vlan', 'owner', 'direction', 'accept',
'proto', 'nat')
class AliasAdmin(admin.ModelAdmin): class AliasAdmin(admin.ModelAdmin):
list_display = ('alias', 'host') list_display = ('alias', 'host')
......
...@@ -25,7 +25,7 @@ class MACAddressField(models.Field): ...@@ -25,7 +25,7 @@ class MACAddressField(models.Field):
super(MACAddressField, self).__init__(*args, **kwargs) super(MACAddressField, self).__init__(*args, **kwargs)
def get_internal_type(self): def get_internal_type(self):
return "CharField" return 'CharField'
def formfield(self, **kwargs): def formfield(self, **kwargs):
defaults = {'form_class': MACAddressFormField} defaults = {'form_class': MACAddressFormField}
...@@ -34,13 +34,19 @@ class MACAddressField(models.Field): ...@@ -34,13 +34,19 @@ class MACAddressField(models.Field):
add_introspection_rules([], ["firewall\.fields\.MACAddressField"]) add_introspection_rules([], ["firewall\.fields\.MACAddressField"])
def val_alfanum(value): def val_alfanum(value):
if not alfanum_re.search(value): if alfanum_re.search(value) is None:
raise ValidationError(u'%s - csak betut, kotojelet, alahuzast, szamot tartalmazhat!' % value) raise ValidationError(
_(u'%s - only letters, numbers, underscores and hyphens are '
'allowed!') % value)
def val_domain(value): def val_domain(value):
if not domain_re.search(value): if domain_re.search(value) is None:
raise ValidationError(u'%s - helytelen domain' % value) raise ValidationError(_(u'%s - invalid domain') % value)
def ipv4_2_ipv6(ipv4): def ipv4_2_ipv6(ipv4):
"""Convert IPv4 addr. string to IPv6 addr. string."""
m = ipv4_re.match(ipv4) m = ipv4_re.match(ipv4)
return "2001:738:2001:4031:%s:%s:%s:0" % (m.group(1), m.group(2), m.group(3)) if m is None:
raise ValidationError(_(u'%s - not an IPv4 address') % ipv4)
return ("2001:738:2001:4031:%s:%s:%s:0" %
(m.group(1), m.group(2), m.group(3)))
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