Changed model for Trophy
Review Request #3872 — Created Feb. 14, 2013 and discarded
Changed model for Trophy Added Trophy model at reviewboard/accounts/models.py.
Description | From | Last Updated |
---|---|---|
Col: 1 E302 expected 2 blank lines, found 1 |
reviewbot | |
Col: 80 E501 line too long (101 > 79 characters) |
reviewbot | |
Col: 5 E128 continuation line under-indented for visual indent |
reviewbot | |
David and I discussed this design a bit more, and want to make a change here. A ManyToManyField here would … |
chipx86 | |
256 is a bit long. 16 bytes should be more than enough. We should define each type of trophy we … |
chipx86 | |
'received'. Note the order of 'i' and 'e'. I would just call it 'timestamp' though. Also it should default to … |
chipx86 |
- Summary:
-
change model for TrophyChanged model for Trophy
- Description:
-
~ change model for Trophy
~ Changed model for Trophy
+ + Added Trophy model and changed LocalSiteProfile model at reviewboard/accounts.models.py.
+ Created reviewboard/accounts/evolutions/trophies.py. + Added an entry of trophies in the init.py - Testing Done:
-
~ tried ./reviewboard/manage.py evolve --hint
~ tried ./contrib/internal/devserver.py
-
This is a review from Review Bot. Tool: PEP8 Style Checker Processed Files: reviewboard/accounts/evolutions/__init__.py reviewboard/accounts/models.py reviewboard/accounts/evolutions/trophies.py Ignored Files:
-
This is a review from Review Bot. Tool: PEP8 Style Checker Processed Files: reviewboard/accounts/evolutions/__init__.py reviewboard/accounts/models.py reviewboard/accounts/evolutions/trophies.py Ignored Files:
-
-
David and I discussed this design a bit more, and want to make a change here. A ManyToManyField here would cause a lot of extra database queries. ManyToManyFields create an extra, hidden table that maps the Trophy and LocalSiteProfile, and we don't need that. We also don't want to tie this to LocalSiteProfile anymore. So what we'd like is 2 new fields on Trophy instead. Both are ForeignKeys, just like the review_request one. One would point to User, and the other to LocalSite (which should have null=True, since there might not be a LocalSite for the trophy). You will need to erase your evolution file and generate a new one. That would mean going back to your database backup first, and starting just like you did when you wrote this. Hope that makes sense. Let me know if you'd like any more explanation!
- Description:
-
Changed model for Trophy
~ Added Trophy model and changed LocalSiteProfile model at reviewboard/accounts.models.py.
~ Added Trophy model at reviewboard/accounts.models.py.
- Created reviewboard/accounts/evolutions/trophies.py. - Added an entry of trophies in the init.py - Diff:
-
Revision 6 (+10)
-
This is a review from Review Bot. Tool: PEP8 Style Checker Processed Files: reviewboard/accounts/models.py Ignored Files:
-
-
256 is a bit long. 16 bytes should be more than enough. We should define each type of trophy we want as constants on the class. For example: FISH = 'fish' MILESTONE = 'milestone'
-
'received'. Note the order of 'i' and 'e'. I would just call it 'timestamp' though. Also it should default to 'now', using default=timezone.now. See reviews/models.py for an example.
-
This is a review from Review Bot. Tool: PEP8 Style Checker Processed Files: reviewboard/accounts/models.py Ignored Files: