Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(3)  |  Call(0)  |  Derive(0)  |  Import(3)

src/f/l/flamejam-HEAD/flamejam/models/game.py   flamejam(Download)
from flamejam.utils import get_slug, average, average_non_zero
from flamejam.models.gamescreenshot import GameScreenshot
from flamejam.models.rating import Rating, RATING_CATEGORIES
from flask import url_for
from datetime import datetime
    def ratingCategories(self):
        return [c for c in RATING_CATEGORIES if getattr(self, "score_" + c + "_enabled")]
 
    def getRatingByUser(self, user):
        return Rating.query.filter_by(user_id=user.id).first()
 
# Adds fields "dynamically" (which score categories are enabled?)
for c in RATING_CATEGORIES:

src/f/l/flamejam-HEAD/flamejam/forms.py   flamejam(Download)
import re
from flamejam import app, models, utils
from flamejam.models.rating import RATING_CATEGORIES
 
############## VALIDATORS ####################
 
# Adds fields "dynamically" (which score categories are enabled?)
for c in RATING_CATEGORIES:
    setattr(GameEditForm, "score_" + c + "_enabled", BooleanField(c.title()))
 
        return getattr(self, "score" if name in (None, "overall") else ("score_" + name))
 
for x in models.rating.RATING_CATEGORIES:
    setattr(RateGameForm, "score_" + x, IntegerField(x.capitalize() + " rating",
        validators=[Required(), NumberRange(min=0, max=10)], default = 5))

src/f/l/flamejam-HEAD/flamejam/views/game.py   flamejam(Download)
from flamejam import app, db, mail
from flamejam.utils import get_slug
from flamejam.models import Jam, Game, User, Comment, GamePackage, \
    GameScreenshot, JamStatusCode, Rating
from flamejam.models.rating import RATING_CATEGORIES
 
        if game.jam.getStatus().code < 4:
            for c in RATING_CATEGORIES:
                setattr(game, "score_" + c + "_enabled", form.get(c).data)
 

src/f/l/flamejam-HEAD/flamejam/__init__.py   flamejam(Download)
def inject():
    return dict(current_user = current_user,
        current_datetime = datetime.utcnow(),
        current_jam = get_current_jam(),
        RATING_CATEGORIES = flamejam.models.rating.RATING_CATEGORIES)