damned-lies r1402 - in trunk: . docs teams



Author: claudep
Date: Tue Jan 27 14:51:10 2009
New Revision: 1402
URL: http://svn.gnome.org/viewvc/damned-lies?rev=1402&view=rev

Log:
2009-01-27  Claude Paroz  <claude 2xlibre net>

	* docs/notes-upgrade.txt: Migration notes about decoupling 'team' from
	'auth_group'.
	* teams/models.py: 'team' table is now independant of auth_group. One
	outcome is that languages without teams are shown again on /languages.

Modified:
   trunk/ChangeLog
   trunk/docs/notes-upgrade.txt
   trunk/teams/models.py

Modified: trunk/docs/notes-upgrade.txt
==============================================================================
--- trunk/docs/notes-upgrade.txt	(original)
+++ trunk/docs/notes-upgrade.txt	Tue Jan 27 14:51:10 2009
@@ -19,3 +19,18 @@
 
 # r1229
 ALTER TABLE statistics ADD UNIQUE ("branch_id", "domain_id", "language_id");
+
+# r1402
+# decouple team from auth_group:
+ALTER TABLE team ADD `id` int(11) NOT NULL FIRST;
+ALTER TABLE team ADD UNIQUE(`id`);
+ALTER TABLE team ADD `name` varchar(50) NOT NULL AFTER id;
+UPDATE team INNER JOIN auth_group ON team.group_ptr_id=auth_group.id SET team.id=auth_group.id;
+UPDATE team INNER JOIN auth_group ON team.group_ptr_id=auth_group.id SET team.name=auth_group.name;
+# replace foreign key names with those of your db
+ALTER TABLE team DROP FOREIGN KEY `group_ptr_id_refs_id_5511b014501b060`;
+ALTER TABLE language DROP FOREIGN KEY `team_id_refs_group_ptr_id_66eefe8fd7bd994`;
+ALTER TABLE language ADD FOREIGN KEY (`team_id`) REFERENCES `team` (`id`);
+ALTER TABLE team DROP group_ptr_id;
+ALTER TABLE team MODIFY `id` int(11) NOT NULL auto_increment;
+ALTER TABLE team ADD primary key(`id`);

Modified: trunk/teams/models.py
==============================================================================
--- trunk/teams/models.py	(original)
+++ trunk/teams/models.py	Tue Jan 27 14:51:10 2009
@@ -19,7 +19,6 @@
 # 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
 from django.db import models
-from django.contrib.auth.models import Group
 from django.utils.translation import ugettext_lazy, ugettext as _
 from people.models import Person
 
@@ -41,10 +40,10 @@
         return teams
 
 
-class Team(Group):
-    """The name of the team is stored in Group.name.
-       The lang_code is generally used."""
+class Team(models.Model):
+    """The lang_code is generally used for the name of the team."""
 
+    name = models.CharField(max_length=80)
     description = models.TextField()
     members = models.ManyToManyField(Person, through='Role', related_name='teams')
     webpage_url = models.URLField(null=True, blank=True)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]