This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT sub.ip FROM | |
(SELECT set_masklen(((generate_series(1, | |
(2 ^ (32 - masklen('10.10.100.0/24'::cidr)))::integer - 2) + | |
'10.10.100.0/24'::cidr)::inet), 32) as ip) AS sub | |
WHERE sub.ip NOT IN | |
(SELECT ip_address from ip_table) | |
AND sub.ip > set_masklen('10.10.100.0/24', 32)+10 | |
AND sub.ip < set_masklen(broadcast('10.10.100.0/24')::inet, 32)-5; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.contrib import admin | |
class ReadOnlyModelAdmin(admin.ModelAdmin): | |
""" | |
ModelAdmin class that prevents modifications through the admin. | |
The changelist and the detail view work, but a 403 is returned | |
if one actually tries to edit an object. |