diff -r 3c487275bc66 apps accounts models py --- apps accounts models

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
diff -r 3c487275bc66 apps/accounts/models.py
--- a/apps/accounts/models.py Thu Oct 09 04:20:43 2008 +0700
+++ b/apps/accounts/models.py Tue Oct 14 03:50:51 2008 +0700
@@ -12,6 +12,7 @@
from accounts.storage import AvatarStorage
from repo.models import Repo
+from social.event_source import EventSource
def determine_avatar_filename(instance, filename):
ext = os.path.splitext(filename)[1]
@@ -26,6 +27,14 @@
max_height=100, max_width=100, blank=True, upload_to=determine_avatar_filename,
storage=AvatarStorage()))
User.add_to_class('spectating', models.ManyToManyField(Repo, related_name='spectators'))
+User.add_to_class('event_source', models.OneToOneField(EventSource))
+
+def get_new_user_init(old_init):
+ def new_user_init(self, *args, **kwargs):
+ old_init(self, *args, **kwargs)
+ self.event_source = EventSource()
+ return new_user_init
+User.__init__ = get_new_user_init(User.__init__)
def get_name(self):
if self.first_name or self.last_name:
$ cat apps/social/event_source.py
from django.db import models
class EventSource(models.Model):
pass