mirror of
https://github.com/peeringdb/peeringdb.git
synced 2024-05-11 05:55:09 +00:00
fix #444: default filter all
in admin views
fix #426: fix issue where asn email validation was case sensitive in some cases disable test_locale_files as this is now handled by weblate and locale files no longer reside in this repo
This commit is contained in:
@@ -55,16 +55,19 @@ class StatusFilter(admin.SimpleListFilter):
|
|||||||
|
|
||||||
title = _("Status")
|
title = _("Status")
|
||||||
parameter_name = "status"
|
parameter_name = "status"
|
||||||
dflt = "ok"
|
dflt = "all"
|
||||||
|
|
||||||
def lookups(self, request, model_admin):
|
def lookups(self, request, model_admin):
|
||||||
return [("ok", "ok"), ("pending", "pending"), ("deleted", "deleted"),
|
return [("ok", "ok"), ("pending", "pending"), ("deleted", "deleted"),
|
||||||
("all", "all")]
|
("all", "all")]
|
||||||
|
|
||||||
def choices(self, cl):
|
def choices(self, cl):
|
||||||
|
val = self.value()
|
||||||
|
if val is None:
|
||||||
|
val = "all"
|
||||||
for lookup, title in self.lookup_choices:
|
for lookup, title in self.lookup_choices:
|
||||||
yield {
|
yield {
|
||||||
'selected': self.value() == lookup,
|
'selected': val == lookup,
|
||||||
'query_string': cl.get_query_string({
|
'query_string': cl.get_query_string({
|
||||||
self.parameter_name: lookup
|
self.parameter_name: lookup
|
||||||
}, []),
|
}, []),
|
||||||
@@ -72,9 +75,7 @@ class StatusFilter(admin.SimpleListFilter):
|
|||||||
}
|
}
|
||||||
|
|
||||||
def queryset(self, request, queryset):
|
def queryset(self, request, queryset):
|
||||||
if self.value() is None:
|
if self.value() is None or self.value() == "all":
|
||||||
return queryset.filter(**{self.parameter_name: self.dflt})
|
|
||||||
elif self.value() == "all":
|
|
||||||
return queryset.all()
|
return queryset.all()
|
||||||
return queryset.filter(**{self.parameter_name: self.value()})
|
return queryset.filter(**{self.parameter_name: self.value()})
|
||||||
|
|
||||||
|
@@ -1409,7 +1409,7 @@ class NetworkSerializer(ModelSerializer):
|
|||||||
rdap = RdapLookup().get_asn(asn)
|
rdap = RdapLookup().get_asn(asn)
|
||||||
|
|
||||||
# add network to existing org
|
# add network to existing org
|
||||||
if rdap and user.email in rdap.emails:
|
if rdap and user.validate_rdap_relationship(rdap):
|
||||||
# user email exists in RiR data, skip verification queue
|
# user email exists in RiR data, skip verification queue
|
||||||
validated_data["status"] = "ok"
|
validated_data["status"] = "ok"
|
||||||
ticket_queue_asnauto_skipvq(user, validated_data["org"],
|
ticket_queue_asnauto_skipvq(user, validated_data["org"],
|
||||||
|
@@ -2,6 +2,6 @@
|
|||||||
|
|
||||||
Ownership of organization was automatically granted to user:
|
Ownership of organization was automatically granted to user:
|
||||||
|
|
||||||
User: 'user_a' (neteng@20c.com)
|
User: 'user_a' (Neteng@20c.com)
|
||||||
Organization: 'ORG AS9000001' (2)
|
Organization: 'ORG AS9000001' (2)
|
||||||
Network: 'AS9000001' AS9000001
|
Network: 'AS9000001' AS9000001
|
||||||
|
@@ -89,7 +89,7 @@ class AsnAutomationTestCase(TestCase):
|
|||||||
cls.base_org = models.Organization.objects.create(
|
cls.base_org = models.Organization.objects.create(
|
||||||
name="ASN Automation Tests")
|
name="ASN Automation Tests")
|
||||||
|
|
||||||
for username, email in [("user_a", "neteng@20c.com"),
|
for username, email in [("user_a", "Neteng@20c.com"),
|
||||||
("user_b", "neteng@other.com"),
|
("user_b", "neteng@other.com"),
|
||||||
("user_c", "other@20c.com")]:
|
("user_c", "other@20c.com")]:
|
||||||
setattr(cls, username,
|
setattr(cls, username,
|
||||||
|
@@ -17,7 +17,15 @@ class LocaleFilesTest(TestCase):
|
|||||||
messages = dict(zip(message_id, message_str))
|
messages = dict(zip(message_id, message_str))
|
||||||
return messages
|
return messages
|
||||||
|
|
||||||
def test_pt(self):
|
# weblate handles all this now, and these tests are failing
|
||||||
|
# atm because the locale files no longer reside here
|
||||||
|
#
|
||||||
|
# weblate also makes sure that variable formatting matches, so this
|
||||||
|
# test is somewhat redundant at this point.
|
||||||
|
#
|
||||||
|
# either need to redo this test and make sure it generates the locale
|
||||||
|
# or remove it.
|
||||||
|
def _test_pt(self):
|
||||||
"""
|
"""
|
||||||
Test portuguese locale files
|
Test portuguese locale files
|
||||||
"""
|
"""
|
||||||
|
Reference in New Issue
Block a user