forked from AFPy/PonyConf
minor changes
This commit is contained in:
parent
d75371dfa7
commit
f4b7eb629d
26
accounts/migrations/0003_auto_20160615_2031.py
Normal file
26
accounts/migrations/0003_auto_20160615_2031.py
Normal file
|
@ -0,0 +1,26 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.9.7 on 2016-06-15 20:31
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import accounts.utils
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('accounts', '0002_auto_20160615_0949'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='participation',
|
||||
name='transport',
|
||||
field=models.IntegerField(blank=True, choices=[(1, 'train'), (2, 'plane'), (3, 'others')], null=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='profile',
|
||||
name='email_token',
|
||||
field=models.CharField(default=accounts.utils.generate_user_uid, max_length=12, unique=True),
|
||||
),
|
||||
]
|
|
@ -17,7 +17,7 @@ class Profile(models.Model):
|
|||
|
||||
user = models.OneToOneField(User)
|
||||
biography = models.TextField(blank=True, verbose_name='Biography')
|
||||
email_token = models.CharField(max_length=12, default=generate_user_uid)
|
||||
email_token = models.CharField(max_length=12, default=generate_user_uid, unique=True)
|
||||
|
||||
def __str__(self):
|
||||
return self.user.get_full_name() or self.user.username
|
||||
|
@ -28,7 +28,7 @@ class Profile(models.Model):
|
|||
|
||||
class Participation(models.Model):
|
||||
|
||||
TRANSPORTS = IntEnum('Transport', 'train plane')
|
||||
TRANSPORTS = IntEnum('Transport', 'train plane others')
|
||||
CONNECTORS = IntEnum('Connector', 'VGA HDMI miniDP')
|
||||
|
||||
site = models.ForeignKey(Site, on_delete=models.CASCADE)
|
||||
|
|
21
conversations/migrations/0003_auto_20160615_2031.py
Normal file
21
conversations/migrations/0003_auto_20160615_2031.py
Normal file
|
@ -0,0 +1,21 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.9.7 on 2016-06-15 20:31
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import conversations.utils
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('conversations', '0002_conversationabouttalk_talk'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='message',
|
||||
name='token',
|
||||
field=models.CharField(default=conversations.utils.generate_message_token, max_length=64, unique=True),
|
||||
),
|
||||
]
|
|
@ -15,7 +15,7 @@ class Message(models.Model):
|
|||
object_id = models.PositiveIntegerField()
|
||||
conversation = GenericForeignKey('content_type', 'object_id')
|
||||
|
||||
token = models.CharField(max_length=64, default=generate_message_token)
|
||||
token = models.CharField(max_length=64, default=generate_message_token, unique=True)
|
||||
|
||||
author = models.ForeignKey(User)
|
||||
date = models.DateTimeField(auto_now_add=True)
|
||||
|
@ -52,7 +52,7 @@ class ConversationWithParticipant(Conversation):
|
|||
|
||||
def new_message(self, message):
|
||||
site = self.get_site()
|
||||
subject = '[%s] Message notification' % site.name
|
||||
subject = '[%s] Conversation with %s' % (site.name, self.participation.user.profile)
|
||||
recipients = list(self.subscribers.all())
|
||||
# Auto-subscribe
|
||||
if message.author != self.participation.user and message.author not in recipients:
|
||||
|
@ -69,6 +69,7 @@ class ConversationWithParticipant(Conversation):
|
|||
notify_by_email('message', data, subject, message.author, recipients, message.token, ref)
|
||||
|
||||
if message.author != self.participation.user:
|
||||
subject = '[%s] Message notification' % site.name
|
||||
data.update({
|
||||
'uri': site.domain + reverse('inbox')
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue
Block a user