本文整理汇总了Python中notification.models.Notification.user方法的典型用法代码示例。如果您正苦于以下问题:Python Notification.user方法的具体用法?Python Notification.user怎么用?Python Notification.user使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类notification.models.Notification
的用法示例。
在下文中一共展示了Notification.user方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: user_post_save
# 需要导入模块: from notification.models import Notification [as 别名]
# 或者: from notification.models.Notification import user [as 别名]
def user_post_save(sender, instance, created, **kwargs):
if created and not kwargs.get('raw', False):
notification = Notification()
notification.user = instance
notification.save()
address = Address()
address.save(user=instance)
profile = UserProfile()
profile.user = instance
profile.address = address
profile.save()
today = datetime.date.today()
subscription = Subscription.objects.create(owner=instance,
state=SUBSCRIPTION_STATE_TRIAL,
expiration_date=today + datetime.timedelta(settings.TRIAL_DURATION),
transaction_id='TRIAL-%i%i%i-%i' % (today.year, today.month, today.day, instance.id))