This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
developers = {} | |
for er in EditorialReview.objects.all(): | |
print er | |
for dtg in er.game.developers.all(): | |
if dtg.company.name in developers: | |
_dict = developers[dtg.company.name] | |
_dict['total_reviews'] += 1 | |
_dict['total_review_score'] += er.score | |
_dict['avg_review_score'] = '%.1f' % (float(_dict['total_review_score']) / float(_dict['total_reviews'])) | |
else: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{u'2K Australia': {'avg_review_score': 4, | |
'total_review_score': 4, | |
'total_reviews': 1}, | |
u'2K China': {'avg_review_score': 4, | |
'total_review_score': 4, | |
'total_reviews': 1}, | |
u'2K Czech': {'avg_review_score': 3, | |
'total_review_score': 3, | |
'total_reviews': 1}, | |
u'2K Marin': {'avg_review_score': 4, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WITH REDIS | |
Executed SQL | |
EXPLAIN SELECT "shout_post"."id", "shout_post"."body", "shout_post"."date_added", "shout_post"."date_last_updated", "shout_post"."user_profile_id", "shout_post"."status", "shout_post"."points", "shout_post"."content_type_id", "shout_post"."object_id", "shout_post"."section" FROM "shout_post" WHERE "shout_post"."id" IN (2882288, 2882276, 2882274, 637787, 637651, 637513, 637478, 637447, 637439, 637351, 636576, 636569, 635341, 635252, 635213, 635206, 635194, 635155, 635095, 635084) ORDER BY "shout_post"."id" DESC | |
Time | |
1.73 ms | |
QUERY PLAN | |
Sort (cost=165.88..165.93 rows=20 width=363) | |
Sort Key: id | |
-> Bitmap Heap Scan on shout_post (cost=85.48..165.45 rows=20 width=363) | |
Recheck Cond: (id = ANY ('{2882288,2882276,2882274,637787,637651,637513,637478,637447,637439,637351,636576,636569,635341,635252,635213,635206,635194,635155,635095,635084}'::integer[])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.contrib import comments | |
from django.contrib.auth.models import User | |
from django.contrib.sites.models import Site | |
from django.contrib.contenttypes.models import ContentType | |
from django.contrib.webdesign.lorem_ipsum import sentence | |
from scout.topics.models import Topic | |
def create_comments(obj, number_of_comments=5): | |
for i in range(0, number_of_comments): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Topic(Publishable): | |
@property | |
def comments(self): | |
return Comment.objects.filter(content_type=ContentType.objects.get_for_model(self), object_pk=self.id).order_by('id') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from momme.forms import ListingInline, LifeStageInline, FranchiseInline | |
class MommeArticleModelAdmin(admin.ModelAdmin): | |
" Custom model admin for Articles to separate out LifeStages, Franchises and SubCategories. " | |
inlines = [ | |
ListingInline, | |
LifeStageInline, | |
FranchiseInline | |
] | |
admin.register(Article, MommeArticleModelAdmin) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Live Galleries | |
a. chronological - should have the most recent gallery created on top | |
b. Category link should remain internal (not link to live site category page, but be | |
seen as a sorting tool for content under that category) | |
2. Add gallery | |
a. Category - should split out life stage / category / subcategory | |
b. need franchise drop down | |
- Family Ties | |
- Parenting Styles | |
- Am I Ruining My Kid |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> cd ~/.virtualenvs/tested/lib/python2.7/site-packages | |
> subl django | |
Open: django.contrib.admin.options.py | |
Search for the methods: | |
add_view() | |
change_view() | |
Remove the decorators above those methods: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% box 'main_video_player.tpl' for listings.0 %} | |
{% for listing in listings|slice:1 %} | |
{% box 'archive.tpl' for listing %} | |
{% endfor %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% box featured for listings.0 %} | |
second_listing: {{ listings.1 }} | |
{% endbox %} | |
OlderNewer