Mercurial > hg > savane-forge
changeset 89:f38539942743
Import script for groups->svmain_extendedgroup and group_type->svmain_groupconfiguration
author | Sylvain Beucler <beuc@beuc.net> |
---|---|
date | Tue, 28 Jul 2009 12:37:23 +0200 |
parents | beba59837ded |
children | 570667aa9b3a |
files | MIGRATION.txt migrate_old_savane.sql src/savane/svmain/admin.py src/savane/svmain/fixtures/license.yaml src/savane/svmain/models.py |
diffstat | 5 files changed, 564 insertions(+), 31 deletions(-) [+] |
line wrap: on
line diff
--- a/MIGRATION.txt +++ b/MIGRATION.txt @@ -1,9 +1,232 @@ - users: + - clean-up duplicate users - cf. migrate_old_savane.sql - fill-in is_staff and is_superuser - groups: - SQL - licenses: content/hashes.txt -> svmain_license - - develompent_status: content/hashes.txt -> svmain_develomentstatus + + there's a special 'none' ('N/A') value + group field type: slug (e.g. 'gpl', 'gplv3orlater') + - development_status: content/hashes.txt -> svmain_develomentstatus (ids) + group field type: id (e.g. '4') + I think we can ignore the hashes.txt comment about id=7 for 'N/A' - group configurations (group_type): - + +Users +===== + +To remove duplicate users *FOR TESTING*: +(TODO: need to remove only the duplicate, not both) +DELETE FROM user WHERE user_name IN ('adiebald','alkana','andersgh','andrenix','animalfarm','antigerme','baravalle','Bassslinger','blitzkerk','bolek11','brawil1','brijesh_gadhiya','caribe','caterkiller2001','cce','chawil','conan','cux221','dave_san','ddavies','doudou61','dungeon','elektroland','emil5','ericclaassen','espahr','fcattoen','gauntlet','Gerardoco','Gonzalvez','GOOS','grubthosch','hans-peter','heikorah','helen','jaguaryou','jezdikm','JonGretar','kodion','kpc82','kumud','lamborghini0102','markm','mbaruchel','mdopheide','moocha','Netsnipe','osia','otello','pepex82','phgbest007','planetstar','plijnzaad','plomo00','Progenator','pthom','puyo','qemm','quaxter','rafaelrt','rdunphy','realshitok','roeles','rubenperez','scorbeau','seb_cante','SeeksTheMoon','shezAbrat','shiau','shyguy','siman','sjh0320','sorenoid','Steve_Stanfield','surfnix54','suydam','Sweethrt758','taroo','tdp','The_WABBIT','thresher','tklein','tontonraoul','tony-rs','treker','tt3','vdemart','vinod','vka3','wbrown','Webb','wertzu','willou','wutzkem'); + +Warnings during import: + +TODO: I don't really understand why three are illegal UTF-8 strings, +this was taken care of during the savane-cleanup UTF-8 upgrade, +cf. savane/update/clean-up/09-utf-8.php + +| Warning | 1265 | Data truncated for column 'first_name' at row 370 | +| Warning | 1366 | Incorrect string value: '\xC2\x8Eeljk...' for column 'first_name' at row 1080 | +| Warning | 1265 | Data truncated for column 'first_name' at row 1207 | +| Warning | 1265 | Data truncated for column 'first_name' at row 1297 | +| Warning | 1265 | Data truncated for column 'first_name' at row 1701 | +| Warning | 1366 | Incorrect string value: '\xC5\x82' for column 'first_name' at row 2117 | +| Warning | 1366 | Incorrect string value: '\xC2\x82\xC2\x95\xC2\x9A' for column 'first_name' at row 2656 | +| Warning | 1265 | Data truncated for column 'first_name' at row 3182 | +| Warning | 1265 | Data truncated for column 'first_name' at row 3310 | +| Warning | 1265 | Data truncated for column 'first_name' at row 3430 | +| Warning | 1366 | Incorrect string value: '\xC2\x9Aa Bo...' for column 'first_name' at row 3798 | +| Warning | 1366 | Incorrect string value: '\xC2\x9Aan F...' for column 'first_name' at row 4404 | +| Warning | 1366 | Incorrect string value: '\xC5\x9Eent\xC3...' for column 'first_name' at row 4823 | +| Warning | 1265 | Data truncated for column 'first_name' at row 5045 | +| Warning | 1366 | Incorrect string value: '\xC5\x84ski' for column 'first_name' at row 5613 | +| Warning | 1366 | Incorrect string value: '\xC5\x82 Mu\xC5...' for column 'first_name' at row 5793 | +| Warning | 1366 | Incorrect string value: '\xE0\xA6\xB6\xE0\xA7\x81...' for column 'first_name' at row 6116 | +| Warning | 1265 | Data truncated for column 'first_name' at row 6604 | +| Warning | 1366 | Incorrect string value: '\xC2\x9Aa Du...' for column 'first_name' at row 7648 | +| Warning | 1366 | Incorrect string value: '\xC2\x8A\xC2\xB1?G...' for column 'first_name' at row 7695 | +| Warning | 1265 | Data truncated for column 'first_name' at row 7855 | +| Warning | 1265 | Data truncated for column 'first_name' at row 8105 | +| Warning | 1265 | Data truncated for column 'first_name' at row 8422 | +| Warning | 1265 | Data truncated for column 'first_name' at row 9033 | +| Warning | 1265 | Data truncated for column 'first_name' at row 9045 | +| Warning | 1265 | Data truncated for column 'first_name' at row 9488 | +| Warning | 1265 | Data truncated for column 'first_name' at row 9863 | +| Warning | 1265 | Data truncated for column 'first_name' at row 10394 | +| Warning | 1265 | Data truncated for column 'first_name' at row 10760 | +| Warning | 1366 | Incorrect string value: '\xC2\x8Aegan' for column 'first_name' at row 11949 | +| Warning | 1366 | Incorrect string value: '\xC2\x91P\xC2\x8Ee' for column 'first_name' at row 11987 | +| Warning | 1366 | Incorrect string value: '\xD0\x90\xD0\xBB\xD0\xB5...' for column 'first_name' at row 13137 | +| Warning | 1366 | Incorrect string value: '\xC2\x9Cnik' for column 'first_name' at row 13151 | +| Warning | 1265 | Data truncated for column 'first_name' at row 13674 | +| Warning | 1366 | Incorrect string value: '\xC4\x83' for column 'first_name' at row 13997 | +| Warning | 1265 | Data truncated for column 'first_name' at row 14114 | +| Warning | 1265 | Data truncated for column 'first_name' at row 14200 | +| Warning | 1265 | Data truncated for column 'first_name' at row 14287 | +| Warning | 1265 | Data truncated for column 'first_name' at row 14579 | +| Warning | 1366 | Incorrect string value: '\xC2\x9A' for column 'first_name' at row 14794 | +| Warning | 1366 | Incorrect string value: '\xC2\x93@?G\xC2...' for column 'first_name' at row 15408 | +| Warning | 1265 | Data truncated for column 'first_name' at row 15819 | +| Warning | 1265 | Data truncated for column 'first_name' at row 16444 | +| Warning | 1265 | Data truncated for column 'first_name' at row 16587 | +| Warning | 1265 | Data truncated for column 'first_name' at row 16798 | +| Warning | 1366 | Incorrect string value: '\xC2\x9Ain' for column 'first_name' at row 16956 | +| Warning | 1265 | Data truncated for column 'first_name' at row 17909 | +| Warning | 1366 | Incorrect string value: '\xD0\x94\xD0\xB0\xD0\xBD...' for column 'first_name' at row 18031 | +| Warning | 1265 | Data truncated for column 'first_name' at row 18064 | +| Warning | 1265 | Data truncated for column 'first_name' at row 18134 | +| Warning | 1366 | Incorrect string value: '\xC2\x9Eek' for column 'first_name' at row 19360 | +| Warning | 1265 | Data truncated for column 'first_name' at row 19720 | +| Warning | 1366 | Incorrect string value: '\xC5\x88uk' for column 'first_name' at row 19744 | +| Warning | 1366 | Incorrect string value: '\xC5\x99enek...' for column 'first_name' at row 19749 | +| Warning | 1366 | Incorrect string value: '\xC4\x9Fda\xC5\x9F...' for column 'first_name' at row 19780 | +| Warning | 1366 | Incorrect string value: '\xE5\x86\xAF\xE6\x98\x8E...' for column 'first_name' at row 20033 | +| Warning | 1265 | Data truncated for column 'first_name' at row 21228 | +| Warning | 1265 | Data truncated for column 'first_name' at row 21553 | +| Warning | 1265 | Data truncated for column 'first_name' at row 21762 | +| Warning | 1265 | Data truncated for column 'first_name' at row 21797 | +| Warning | 1265 | Data truncated for column 'first_name' at row 22367 | +| Warning | 1265 | Data truncated for column 'first_name' at row 22464 | +| Warning | 1265 | Data truncated for column 'first_name' at row 23013 | +| Warning | 1265 | Data truncated for column 'first_name' at row 24967 | + +---- + +| Warning | 1366 | Incorrect string value: '\xC2\x9198\x0D\x0A...' for column 'people_resume' at row 1197 | +| Warning | 1366 | Incorrect string value: '\xC2\x95 Des...' for column 'people_resume' at row 4592 | +| Warning | 1366 | Incorrect string value: '\xC2\x95 C, ...' for column 'people_resume' at row 5390 | +| Warning | 1366 | Incorrect string value: '\xC2\x92s de...' for column 'people_resume' at row 9639 | +| Warning | 1366 | Incorrect string value: '\xC2\x96 200...' for column 'people_resume' at row 10729 | +| Warning | 1366 | Incorrect string value: '\xC2\x96 Phi...' for column 'people_resume' at row 11448 | +| Warning | 1048 | Column 'email_hide' cannot be null | +| Warning | 1048 | Column 'email_hide' cannot be null | +| Warning | 1048 | Column 'email_hide' cannot be null | +| Warning | 1048 | Column 'email_hide' cannot be null | +| Warning | 1048 | Column 'email_hide' cannot be null | +| Warning | 1048 | Column 'email_hide' cannot be null | +| Warning | 1366 | Incorrect string value: '\xC2\x95\x09Str...' for column 'people_resume' at row 15267 | +| Warning | 1366 | Incorrect string value: '\xC2\x91A\xC2\x92 ...' for column 'people_resume' at row 17491 | +| Warning | 1366 | Incorrect string value: '\xC2\x95 Dat...' for column 'people_resume' at row 18044 | +| Warning | 1366 | Incorrect string value: '\xC2\x92Intr...' for column 'people_resume' at row 19923 | +| Warning | 1366 | Incorrect string value: '\xC2\x91Netw...' for column 'people_resume' at row 21149 | +| Warning | 1366 | Incorrect string value: '\xC2\x96 Apr...' for column 'people_resume' at row 23126 | +| Warning | 1366 | Incorrect string value: '\xC2\x95\x09Chi...' for column 'people_resume' at row 23274 | +| Warning | 1366 | Incorrect string value: '\xC2\x95 (43...' for column 'people_resume' at row 25042 | +| Warning | 1366 | Incorrect string value: '\xC2\x92t ha...' for column 'people_resume' at row 25253 | +| Warning | 1366 | Incorrect string value: '\xC2\x95 COL...' for column 'people_resume' at row 25484 | +| Warning | 1366 | Incorrect string value: '\xC2\x92s ma...' for column 'people_resume' at row 26162 | +| Warning | 1366 | Incorrect string value: '\xC2\x92 exp...' for column 'people_resume' at row 27182 | +| Warning | 1366 | Incorrect string value: '\xC2\x96 Pre...' for column 'people_resume' at row 28369 | +| Warning | 1366 | Incorrect string value: '\xC2\x96 Lee...' for column 'people_resume' at row 28853 | +| Warning | 1366 | Incorrect string value: '\xC2\x96 91-...' for column 'people_resume' at row 29208 | +| Warning | 1366 | Incorrect string value: '\xC2\x92s We...' for column 'people_resume' at row 31392 | +| Warning | 1366 | Incorrect string value: '\xC2\x96a di...' for column 'people_resume' at row 31490 | +| Warning | 1366 | Incorrect string value: '\xC2\x9E/?~W...' for column 'gpg_key' at row 31866 | +| Warning | 1366 | Incorrect string value: '\xC2\x96 01 ...' for column 'people_resume' at row 32776 | +| Warning | 1366 | Incorrect string value: '\xC2\x95\x09Pre...' for column 'people_resume' at row 33378 | +| Warning | 1366 | Incorrect string value: '\xC2\x80STER...' for column 'authorized_keys' at row 33546 | +| Warning | 1366 | Incorrect string value: '\xC2\x93seei...' for column 'people_resume' at row 34256 | +| Warning | 1366 | Incorrect string value: '\xC2\x96 pre...' for column 'people_resume' at row 34387 | +| Warning | 1366 | Incorrect string value: '\xC2\x92m a ...' for column 'people_resume' at row 34810 | +| Warning | 1366 | Incorrect string value: '\xC2\x92s Co...' for column 'people_resume' at row 35162 | +| Warning | 1366 | Incorrect string value: '\xC2\x92s\x0D\x0A ...' for column 'people_resume' at row 35163 | +| Warning | 1366 | Incorrect string value: '\xEF\x83\x92 Mi...' for column 'people_resume' at row 38675 | +| Warning | 1048 | Column 'email_hide' cannot be null | +| Warning | 1048 | Column 'email_hide' cannot be null | +| Warning | 1048 | Column 'email_hide' cannot be null | +| Warning | 1048 | Column 'email_hide' cannot be null | +| Warning | 1048 | Column 'email_hide' cannot be null | +| Warning | 1048 | Column 'email_hide' cannot be null | +| Warning | 1048 | Column 'email_hide' cannot be null | +| Warning | 1048 | Column 'email_hide' cannot be null | +| Warning | 1048 | Column 'email_hide' cannot be null | +| Warning | 1048 | Column 'email_hide' cannot be null | +| Warning | 1048 | Column 'email_hide' cannot be null | +| Warning | 1048 | Column 'email_hide' cannot be null | +| Warning | 1048 | Column 'email_hide' cannot be null | +| Warning | 1048 | Column 'email_hide' cannot be null | +| Warning | 1048 | Column 'email_hide' cannot be null | +| Warning | 1366 | Incorrect string value: '\xD1\x85\xD0\xBC' for column 'people_resume' at row 39772 | +| Warning | 1366 | Incorrect string value: '\xEF\x82\xA7\x09B....' for column 'people_resume' at row 39894 | +| Warning | 1366 | Incorrect string value: '\xC4\xB1n\xC4\xB1f...' for column 'people_resume' at row 40734 | +| Warning | 1366 | Incorrect string value: '\xE5\xBD\xAD\xE7\x95\x85...' for column 'authorized_keys' at row 41167 | +| Warning | 1366 | Incorrect string value: '\xEF\x82\xA7\x09Hi...' for column 'people_resume' at row 41332 | +| Warning | 1366 | Incorrect string value: '\xEF\xBB\xBF\x0D\x0AI...' for column 'people_resume' at row 41438 | +| Warning | 1048 | Column 'email_hide' cannot be null | +| Warning | 1366 | Incorrect string value: '\xC5\x84sk U...' for column 'people_resume' at row 45091 | +| Warning | 1366 | Incorrect string value: '\xEF\x83\x98\x09Pl...' for column 'people_resume' at row 48021 | +| Warning | 1048 | Column 'email_hide' cannot be null | + + +---- + +Groups: ++---------+------+-------------------------------------------------------------------------------+ +| Level | Code | Message | ++---------+------+-------------------------------------------------------------------------------+ +| Warning | 1048 | Column 'short_description' cannot be null | +| Warning | 1048 | Column 'long_description' cannot be null | +| Warning | 1048 | Column 'license_other' cannot be null | +| Warning | 1048 | Column 'required_software' cannot be null | +| Warning | 1048 | Column 'other_comments' cannot be null | +| Warning | 1048 | Column 'registered_gpg_keys' cannot be null | +| Warning | 1366 | Incorrect integer value: '' for column 'use_homepage' at row 1 | +| Warning | 1366 | Incorrect integer value: '' for column 'use_mail' at row 1 | +| Warning | 1366 | Incorrect integer value: '' for column 'use_patch' at row 1 | +| Warning | 1366 | Incorrect integer value: '' for column 'use_task' at row 1 | +| Warning | 1366 | Incorrect integer value: '' for column 'use_forum' at row 1 | +| Warning | 1366 | Incorrect integer value: '' for column 'use_cvs' at row 1 | +| Warning | 1366 | Incorrect integer value: '' for column 'use_news' at row 1 | +| Warning | 1366 | Incorrect integer value: '' for column 'use_support' at row 1 | +| Warning | 1366 | Incorrect integer value: '' for column 'use_bugs' at row 1 | +| Warning | 1366 | Incorrect integer value: '' for column 'use_extralink_documentation' at row 1 | +| Warning | 1048 | Column 'long_description' cannot be null | +| Warning | 1048 | Column 'required_software' cannot be null | +| Warning | 1048 | Column 'other_comments' cannot be null | +| Warning | 1264 | Out of range value adjusted for column 'register_time' at row 2 | +| Warning | 1048 | Column 'long_description' cannot be null | +| Warning | 1048 | Column 'required_software' cannot be null | +| Warning | 1048 | Column 'other_comments' cannot be null | +| Warning | 1264 | Out of range value adjusted for column 'register_time' at row 3 | +| Warning | 1366 | Incorrect integer value: '' for column 'use_homepage' at row 3 | +| Warning | 1366 | Incorrect integer value: '' for column 'use_extralink_documentation' at row 3 | +| Warning | 1048 | Column 'required_software' cannot be null | +| Warning | 1048 | Column 'other_comments' cannot be null | +| Warning | 1264 | Out of range value adjusted for column 'register_time' at row 4 | +| Warning | 1366 | Incorrect integer value: '' for column 'use_homepage' at row 4 | +| Warning | 1366 | Incorrect integer value: '' for column 'use_extralink_documentation' at row 4 | +| Warning | 1048 | Column 'required_software' cannot be null | +| Warning | 1048 | Column 'other_comments' cannot be null | +| Warning | 1264 | Out of range value adjusted for column 'register_time' at row 5 | +| Warning | 1366 | Incorrect integer value: '' for column 'use_homepage' at row 5 | +| Warning | 1366 | Incorrect integer value: '' for column 'use_extralink_documentation' at row 5 | +| Warning | 1048 | Column 'required_software' cannot be null | +| Warning | 1048 | Column 'other_comments' cannot be null | +| Warning | 1264 | Out of range value adjusted for column 'register_time' at row 6 | +| Warning | 1366 | Incorrect integer value: '' for column 'use_homepage' at row 6 | +| Warning | 1366 | Incorrect integer value: '' for column 'use_extralink_documentation' at row 6 | +| Warning | 1048 | Column 'long_description' cannot be null | +| Warning | 1048 | Column 'required_software' cannot be null | +| Warning | 1048 | Column 'other_comments' cannot be null | +| Warning | 1264 | Out of range value adjusted for column 'register_time' at row 7 | +| Warning | 1048 | Column 'required_software' cannot be null | +| Warning | 1048 | Column 'other_comments' cannot be null | +| Warning | 1264 | Out of range value adjusted for column 'register_time' at row 8 | +| Warning | 1048 | Column 'long_description' cannot be null | +| Warning | 1048 | Column 'required_software' cannot be null | +| Warning | 1048 | Column 'other_comments' cannot be null | +| Warning | 1264 | Out of range value adjusted for column 'register_time' at row 9 | +| Warning | 1048 | Column 'registered_gpg_keys' cannot be null | +| Warning | 1366 | Incorrect integer value: '' for column 'use_homepage' at row 9 | +| Warning | 1366 | Incorrect integer value: '' for column 'use_extralink_documentation' at row 9 | +| Warning | 1048 | Column 'required_software' cannot be null | +| Warning | 1048 | Column 'other_comments' cannot be null | +| Warning | 1264 | Out of range value adjusted for column 'register_time' at row 10 | +| Warning | 1048 | Column 'long_description' cannot be null | +| Warning | 1048 | Column 'required_software' cannot be null | +| Warning | 1048 | Column 'other_comments' cannot be null | +| Warning | 1264 | Out of range value adjusted for column 'register_time' at row 11 | +| Warning | 1048 | Column 'registered_gpg_keys' cannot be null | +| Warning | 1366 | Incorrect integer value: '' for column 'use_homepage' at row 11 | ++---------+------+-------------------------------------------------------------------------------+
--- a/migrate_old_savane.sql +++ b/migrate_old_savane.sql @@ -9,9 +9,10 @@ CONCAT('md5$$', user_pw), now(), FROM_UNIXTIME(add_date), status='A', 0, 0 FROM savane_old.user - WHERE user_id != 100; + WHERE savane_old.user.user_id != 100; -- Import all extended information except for the 'None' user (#100) +-- (X or 0) means 'if V==NULL then 0 else V' INSERT INTO svmain_extendeduser (user_ptr_id, status, spamscore, authorized_keys, authorized_keys_count, people_view_skills, people_resume, @@ -19,6 +20,258 @@ SELECT user_id, status, spamscore, authorized_keys, authorized_keys_count, people_view_skills, people_resume, timezone, theme, - email_hide, gpg_key, gpg_key_count + (email_hide or 0), gpg_key, gpg_key_count FROM savane_old.user - WHERE user_id != 100; + WHERE savane_old.user.user_id != 100; + +-- Import group configurations +-- type_id -> id +INSERT INTO svmain_groupconfiguration + (id, name, description, base_host, + mailing_list_address, mailing_list_virtual_host, mailing_list_format, + can_use_homepage, can_use_download, can_use_cvs, can_use_arch, can_use_svn, can_use_git, can_use_hg, + can_use_bzr, can_use_license, can_use_devel_status, can_use_forum, can_use_mailing_list, + can_use_patch, can_use_task, can_use_news, can_use_support, can_use_bug, + is_menu_configurable_homepage, + is_menu_configurable_download, + is_menu_configurable_forum, + is_menu_configurable_support, + is_menu_configurable_mail, + is_menu_configurable_cvs, + is_menu_configurable_cvs_viewcvs, + is_menu_configurable_cvs_viewcvs_homepage, + is_menu_configurable_arch, + is_menu_configurable_arch_viewcvs, + is_menu_configurable_svn, + is_menu_configurable_svn_viewcvs, + is_menu_configurable_git, + is_menu_configurable_git_viewcvs, + is_menu_configurable_hg, + is_menu_configurable_hg_viewcvs, + is_menu_configurable_bzr, + is_menu_configurable_bzr_viewcvs, + is_menu_configurable_bugs, + is_menu_configurable_task, + is_menu_configurable_patch, + is_menu_configurable_extralink_documentation, + is_configurable_download_dir, + homepage_scm, + dir_type_cvs, + dir_type_arch, + dir_type_svn, + dir_type_git, + dir_type_hg, + dir_type_bzr, + dir_type_homepage, + dir_type_download, + dir_homepage, + dir_cvs, + dir_arch, + dir_svn, + dir_git, + dir_hg, + dir_bzr, + dir_download, + url_homepage, + url_cvs_viewcvs_homepage, + url_cvs_viewcvs, + url_arch_viewcvs, + url_svn_viewcvs, + url_git_viewcvs, + url_hg_viewcvs, + url_bzr_viewcvs, + url_download, + url_mailing_list_listinfo, + url_mailing_list_subscribe, + url_mailing_list_unsubscribe, + url_mailing_list_archives, + url_mailing_list_archives_private, + url_mailing_list_admin, + url_extralink_documentation) + SELECT type_id, name, description, base_host, + mailing_list_address, mailing_list_virtual_host, mailing_list_format, + can_use_homepage, can_use_download, can_use_cvs, can_use_arch, can_use_svn, can_use_git, can_use_hg, + can_use_bzr, can_use_license, can_use_devel_status, can_use_forum, can_use_mailing_list, + can_use_patch, can_use_task, can_use_news, can_use_support, can_use_bug, + is_menu_configurable_homepage, + is_menu_configurable_download, + is_menu_configurable_forum, + is_menu_configurable_support, + is_menu_configurable_mail, + is_menu_configurable_cvs, + is_menu_configurable_cvs_viewcvs, + is_menu_configurable_cvs_viewcvs_homepage, + is_menu_configurable_arch, + is_menu_configurable_arch_viewcvs, + is_menu_configurable_svn, + is_menu_configurable_svn_viewcvs, + is_menu_configurable_git, + is_menu_configurable_git_viewcvs, + is_menu_configurable_hg, + is_menu_configurable_hg_viewcvs, + is_menu_configurable_bzr, + is_menu_configurable_bzr_viewcvs, + is_menu_configurable_bugs, + is_menu_configurable_task, + is_menu_configurable_patch, + is_menu_configurable_extralink_documentation, + is_configurable_download_dir, + homepage_scm, + dir_type_cvs, + dir_type_arch, + dir_type_svn, + dir_type_git, + dir_type_hg, + dir_type_bzr, + dir_type_homepage, + dir_type_download, + dir_homepage, + dir_cvs, + dir_arch, + dir_svn, + dir_git, + dir_hg, + dir_bzr, + dir_download, + url_homepage, + url_cvs_viewcvs_homepage, + url_cvs_viewcvs, + url_arch_viewcvs, + url_svn_viewcvs, + url_git_viewcvs, + url_hg_viewcvs, + url_bzr_viewcvs, + url_download, + url_mailing_list_listinfo, + url_mailing_list_subscribe, + url_mailing_list_unsubscribe, + url_mailing_list_archives, + url_mailing_list_archives_private, + url_mailing_list_admin, + url_extralink_documentation + FROM savane_old.group_type; + + +-- Import groups +-- id <- group_id +-- name <- unix_group_name +INSERT INTO auth_group + (id, name) + SELECT group_id, unix_group_name + FROM savane_old.groups + WHERE savane_old.groups.group_id != 100; + +-- Import license/devel_status +-- ./manage.py loaddata savane/svmain/fixtures/license.yaml +-- ./manage.py loaddata savane/svmain/fixtures/developmentstatus.yaml + +-- Import groups +-- group_ptr_id <- group_id +-- full_name <- group_name +-- license_id <- license+1 (django counts from 1, not from 0) +-- devel_status_id <- devel_status+1 (django counts from 1, not from 0) +-- type_id <- type +-- +-- Using LEFT JOIN so that if the license isn't known, the project is +-- not ignored (with license_id=NULL). +INSERT INTO svmain_extendedgroup + (group_ptr_id, full_name, license_id, devel_status_id, type_id, + is_public, + status, + short_description, + long_description, + license_other, + register_purpose, + required_software, + other_comments, + register_time, + registered_gpg_keys, + use_homepage, + use_mail, + use_patch, + use_task, + use_forum, + use_cvs, + use_arch, + use_svn, + use_git, + use_hg, + use_bzr, + use_news, + use_support, + use_download, + use_bugs, + use_extralink_documentation, + url_homepage, + url_download, + url_forum, + url_support, + url_mail, + url_cvs, + url_cvs_viewcvs, + url_cvs_viewcvs_homepage, + url_arch, + url_arch_viewcvs, + url_svn, + url_svn_viewcvs, + url_git, + url_git_viewcvs, + url_hg, + url_hg_viewcvs, + url_bzr, + url_bzr_viewcvs, + url_bugs, + url_task, + url_patch, + url_extralink_documentation) + SELECT group_id, group_name, svmain_license.id, devel_status+1, type, + is_public, + status, + short_description, + long_description, + license_other, + register_purpose, + required_software, + other_comments, + register_time, + registered_gpg_keys, + use_homepage, + use_mail, + use_patch, + use_task, + use_forum, + use_cvs, + use_arch, + use_svn, + use_git, + use_hg, + use_bzr, + use_news, + use_support, + use_download, + use_bugs, + use_extralink_documentation, + url_homepage, + url_download, + url_forum, + url_support, + url_mail, + url_cvs, + url_cvs_viewcvs, + url_cvs_viewcvs_homepage, + url_arch, + url_arch_viewcvs, + url_svn, + url_svn_viewcvs, + url_git, + url_git_viewcvs, + url_hg, + url_hg_viewcvs, + url_bzr, + url_bzr_viewcvs, + url_bugs, + url_task, + url_patch, + url_extralink_documentation + FROM savane_old.groups LEFT JOIN savane.svmain_license ON savane_old.groups.license = savane.svmain_license.slug + WHERE savane_old.groups.group_id != 100;
--- a/src/savane/svmain/admin.py +++ b/src/savane/svmain/admin.py @@ -32,13 +32,6 @@ ordering = ('username',) filter_horizontal = ('user_permissions',) -class ExtendedGroupAdmin(admin.ModelAdmin): - # Copy/pasted from django.contrib.auth.admin; inheritance fails - # when you attempt to display extended fields.. - search_fields = ('name',) - ordering = ('name',) - filter_horizontal = ('permissions',) - class GroupConfigurationAdmin(admin.ModelAdmin): fieldsets = ( (_('General Settings'), {'fields': ('name', 'base_host', 'description')}), @@ -84,6 +77,15 @@ ) +class ExtendedGroupAdmin(admin.ModelAdmin): + # Copy/pasted from django.contrib.auth.admin; inheritance fails + # when you attempt to display extended fields.. + search_fields = ('name',) + ordering = ('name',) + filter_horizontal = ('permissions',) + list_display = ('name', 'pk', 'full_name', 'type', 'license',) + list_filter = ('type', 'license', 'devel_status',) + admin.site.register(svmain_models.ExtendedUser, ExtendedUserAdmin) admin.site.register(svmain_models.ExtendedGroup, ExtendedGroupAdmin) admin.site.register(svmain_models.GroupConfiguration, GroupConfigurationAdmin)
--- a/src/savane/svmain/fixtures/license.yaml +++ b/src/savane/svmain/fixtures/license.yaml @@ -1,88 +1,134 @@ +- fields: + slug: 'none' + name: 'N/A' + model: svmain.license + pk: 1 - fields: slug: 'gpl' name: 'GNU General Public License V2 or later' url: 'http://www.gnu.org/copyleft/gpl.html' model: svmain.license - pk: 1 + pk: 2 - fields: slug: 'lgpl' name: 'GNU Lesser General Public License' url: 'http://www.gnu.org/copyleft/lesser.html' model: svmain.license - pk: 2 + pk: 3 - fields: slug: 'fdl' name: 'GNU Free Documentation License' url: 'http://www.gnu.org/copyleft/fdl.html' model: svmain.license - pk: 3 + pk: 4 - fields: slug: 'mbsd' name: 'Modified BSD License' url: 'http://www.xfree86.org/3.3.6/COPYRIGHT2.html#5' model: svmain.license - pk: 4 + pk: 5 - fields: slug: 'x11' name: 'X11 license' url: 'http://www.x.org/terms.htm' model: svmain.license - pk: 5 + pk: 6 - fields: slug: 'cryptix' name: 'Cryptix General License' url: 'http://www.cryptix.org/docs/license.html' model: svmain.license - pk: 6 + pk: 7 - fields: slug: 'zlib' name: 'The license of ZLib' url: 'ftp://ftp.freesoftware.com/pub/infozip/zlib/zlib_license.html' model: svmain.license - pk: 7 + pk: 8 - fields: slug: 'imatrix' name: 'The license of the iMatix Standard Function Library' model: svmain.license - pk: 8 + pk: 9 - fields: slug: 'w3c' name: 'The W3C Software Notice and License' url: 'http://www.w3.org/Consortium/Legal/copyright-software.html' model: svmain.license - pk: 9 + pk: 10 - fields: slug: 'berkeley' name: 'The Berkeley Database License' url: 'http://www.sleepycat.com/license.net' model: svmain.license - pk: 10 + pk: 11 - fields: slug: 'python16' name: 'The License of Python 1.6a2 and earlier versions' url: 'http://www.python.org/doc/Copyright.html' model: svmain.license - pk: 11 + pk: 12 - fields: slug: 'cartistic' name: 'The Clarified Artistic License' url: 'http://www.statistica.unimib.it/utenti/dellavedova/software/artistic2.html' model: svmain.license - pk: 12 + pk: 13 - fields: slug: 'expat' name: 'Expat License (sometime refered to as MIT License)' url: 'http://www.gnu.org/licenses/license-list.html#Expat' model: svmain.license - pk: 13 + pk: 14 - fields: slug: 'affero' name: 'Affero General Public License V1 or later' url: 'http://www.affero.org/oagpl.html' model: svmain.license - pk: 14 + pk: 15 - fields: slug: 'website' name: 'WebSite Only' model: svmain.license - pk: 15 + pk: 16 +- fields: + slug: 'python2' + name: 'The License of Python 2.0.1, 2.1.1, and newer versions' + url: 'http://www.python.org/2.0.1/license.html' + model: svmain.license + pk: 17 +- fields: + slug: 'perl' + name: 'The license of Perl (disjunction of the Artistic License and the GNU GPL)' + url: 'http://www.gnu.org/philosophy/license-list.html#PerlLicense' + model: svmain.license + pk: 18 +- fields: + slug: 'classpath' + name: 'GNU General Public License v2 or later with GNU Classpath special exception' + url: 'http://www.gnu.org/software/classpath/license.html' + model: svmain.license + pk: 19 +- fields: + slug: 'public domain' + name: 'Public domain' + model: svmain.license + pk: 20 +- fields: + slug: 'dual-gpl' + name: 'GNU General Public License v2 or later (+ dual licensing)' + url: 'http://www.gnu.org/licenses/gpl.html' + model: svmain.license + pk: 21 +- fields: + slug: 'gplv3orlater' + name: 'GNU General Public License v3 or later' + url: 'http://www.gnu.org/licenses/gpl.html' + model: svmain.license + pk: 22 +- fields: + slug: 'agpl' + name: 'GNU Affero General Public License v3 or later' + url: 'http://www.gnu.org/licenses/agpl-3.0.html' + model: svmain.license + pk: 23
--- a/src/savane/svmain/models.py +++ b/src/savane/svmain/models.py @@ -20,8 +20,6 @@ from django.db import models from django.contrib.auth import models as auth_models -# TODO: these models probably don't belong to the 'my' application - class ExtendedUser(auth_models.User): """Django base User class + extra Savane fields""" @@ -144,7 +142,7 @@ can_use_support = models.BooleanField(default=True) can_use_bug = models.BooleanField(default=True) is_menu_configurable_homepage = models.BooleanField(default=False, - help_text='the homepage link can be modified') + help_text='the homepage link can be modified') is_menu_configurable_download = models.BooleanField(default=False) is_menu_configurable_forum = models.BooleanField(default=False) is_menu_configurable_support = models.BooleanField(default=False) @@ -252,12 +250,16 @@ #cookbook_rflags = IntegerField(default='5') #support_rflags = IntegerField(default='2') + def __unicode__(self): + return self.name + class ExtendedGroup(auth_models.Group): """Django base Group class + extra Savane fields""" type = models.ForeignKey(GroupConfiguration) - name = models.CharField(max_length=30, blank=True) + full_name = models.CharField(max_length=30, blank=True, + help_text="Full project name (not Unix system name)") is_public = models.BooleanField(default=False) status_CHOICES = ( ('A', 'Active'), @@ -272,7 +274,7 @@ license = models.ForeignKey(License, null=True) license_other = models.TextField() - devel_status = models.ForeignKey(DevelopmentStatus), + devel_status = models.ForeignKey(DevelopmentStatus) # Registration-specific register_purpose = models.TextField() @@ -365,3 +367,10 @@ #support_private_exclude_address text #patch_private_exclude_address text #cookbook_private_exclude_address text + + def __unicode__(self): + return self.name + + class Meta: + ordering = ['name'] +