-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(bans) : Add ban condition into login_required_ajax
- Loading branch information
Showing
8 changed files
with
93 additions
and
24 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
from django.contrib import admin | ||
from bans.models import SSOBans | ||
from bans.models import SSOBan | ||
# Register your models here. | ||
|
||
|
||
class SSOBansAdmin(admin.ModelAdmin): | ||
list_display = ('banned_user', 'banned_by','id') | ||
|
||
admin.site.register(SSOBans, SSOBansAdmin) | ||
admin.site.register(SSOBan, SSOBansAdmin) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Generated by Django 3.2.16 on 2023-10-10 12:47 | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('users', '0040_remove_userprofile_followed_communities'), | ||
('bans', '0001_initial'), | ||
] | ||
|
||
operations = [ | ||
migrations.RenameModel( | ||
old_name='SSOBans', | ||
new_name='SSOBan', | ||
), | ||
] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Generated by Django 3.2.16 on 2023-10-10 13:34 | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('users', '0040_remove_userprofile_followed_communities'), | ||
('bans', '0002_rename_ssobans_ssoban'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='ssoban', | ||
name='banned_by', | ||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='banned_by', to='users.userprofile'), | ||
), | ||
] |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
"""Serializers for Bans """ | ||
from rest_framework import serializers | ||
from users.serializers import UserProfileSerializer | ||
from .models import SSOBans | ||
from .models import SSOBan | ||
|
||
class SSOBansSerializer(serializers.ModelSerializer): | ||
banned_by = UserProfileSerializer(read_only = False, source = 'name') | ||
|
||
class Meta: | ||
model = SSOBans | ||
model = SSOBan | ||
fields = '__all__' |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
"""URLs for Bans""" | ||
from django.urls import path | ||
from bans.views import SSOBansViewSet | ||
from bans.views import SSOBanViewSet | ||
|
||
urlpatterns =[ | ||
path('bans/', SSOBansViewSet.as_view( | ||
path('bans/', SSOBanViewSet.as_view( | ||
{'get':'list', 'post':'create'} | ||
)), | ||
path('bans/<pk>/', SSOBansViewSet.as_view({ | ||
path('bans/<pk>/', SSOBanViewSet.as_view({ | ||
'put': 'update', 'delete': 'destroy', 'get': 'retrieve', 'patch': 'update' | ||
})) | ||
] |
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
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