mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-08 16:48:16 -06:00
Misc cleanup
This commit is contained in:
parent
ba11e97b1e
commit
6bec89d46b
@ -276,7 +276,7 @@ class NotificationListView(LoginRequiredMixin, generic.ObjectListView):
|
||||
template_name = 'account/notifications.html'
|
||||
|
||||
def get_queryset(self, request):
|
||||
return Notification.objects.filter(user=request.user)
|
||||
return request.user.notifications.all()
|
||||
|
||||
def get_extra_context(self, request):
|
||||
return {
|
||||
@ -289,7 +289,7 @@ class SubscriptionListView(LoginRequiredMixin, generic.ObjectListView):
|
||||
template_name = 'account/subscriptions.html'
|
||||
|
||||
def get_queryset(self, request):
|
||||
return Subscription.objects.filter(user=request.user)
|
||||
return request.user.subscriptions.all()
|
||||
|
||||
def get_extra_context(self, request):
|
||||
return {
|
||||
|
@ -151,7 +151,6 @@ class NotificationViewSet(NetBoxModelViewSet):
|
||||
|
||||
|
||||
class NotificationGroupViewSet(NetBoxModelViewSet):
|
||||
metadata_class = ContentTypeMetadata
|
||||
queryset = NotificationGroup.objects.all()
|
||||
serializer_class = serializers.NotificationGroupSerializer
|
||||
|
||||
|
@ -37,7 +37,7 @@ class Migration(migrations.Migration):
|
||||
('created', models.DateTimeField(auto_now_add=True)),
|
||||
('object_id', models.PositiveBigIntegerField()),
|
||||
('object_type', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='contenttypes.contenttype')),
|
||||
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
|
||||
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='subscriptions', to=settings.AUTH_USER_MODEL)),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'subscription',
|
||||
|
@ -176,7 +176,8 @@ class Subscription(models.Model):
|
||||
)
|
||||
user = models.ForeignKey(
|
||||
to=settings.AUTH_USER_MODEL,
|
||||
on_delete=models.CASCADE
|
||||
on_delete=models.CASCADE,
|
||||
related_name='subscriptions'
|
||||
)
|
||||
object_type = models.ForeignKey(
|
||||
to='contenttypes.ContentType',
|
||||
|
Loading…
Reference in New Issue
Block a user