Skip to content

Instantly share code, notes, and snippets.

@mansha99
Created July 9, 2023 09:15
Show Gist options
  • Save mansha99/cc41a22c3a63376385a5509cafd82482 to your computer and use it in GitHub Desktop.
Save mansha99/cc41a22c3a63376385a5509cafd82482 to your computer and use it in GitHub Desktop.
project_app_models.py
from django.db import models
from helloapp import signals
class Notice(models.Model):
title = models.CharField(max_length=80)
description = models.CharField(max_length=255)
def save(self, *args, **kwargs):
if self.title=="Oops":
signals.invalid_notice_signal.send(sender=None)
return
else:
super().save(*args, **kwargs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment