Django coin/points system ideas -
i creating web based game in django, in action require coins/points , every action need check if userprofile has specific coins action or not. have seen awards/rewards packages seems awarding/rewarding after action has been performed. need generic solution checks if user has coins action or not.
for coins doing way:
class userprofile(models.model): .... def deduct_coins(coins): self.coin -= coins self.save() def has_coins(coins): if self.coins >= coins: return true return false
i not using django forms actions before each action ( crud ) operations doing following steps:
- check if user has required coins
- perform action
- deduct coins required
1- how can make process generic.
2- there custom signals other builtin signals, if how can use them.
3- can pre_save signal used scenario.
Comments
Post a Comment