Commit 5cb27a0e authored by Ilya Simonov's avatar Ilya Simonov

fix save mrss

parent fef40331
from django.contrib import admin
from django.conf import settings
from django.contrib.contenttypes.admin import GenericTabularInline
from . import models, forms
......@@ -63,10 +62,6 @@ class PlayListAdmin(admin.ModelAdmin):
return [TagInline]
return []
def save_model(self, request, obj, form, change):
obj.mrss = f'{settings.DOMAIN_NAME}/api/playlist/{obj.id}/mrss'
super().save_model(request, obj, form, change)
class CategoryAdmin(admin.ModelAdmin):
list_display = ['id', 'name', ]
......
......@@ -4,3 +4,6 @@ from django.apps import AppConfig
class CoreConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'apps.core'
def ready(self):
import apps.core.signals
from django.conf import settings
from django.dispatch import receiver
from django.db.models.signals import post_save
from . import models
@receiver(post_save, sender=models.Playlist)
def save_playlist_mrss(sender, instance, created, **kwargs):
if created:
instance.mrss = f'{settings.DOMAIN_NAME}/api/playlist/{instance.id}/mrss'
instance.save()
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 to comment