Export grist balance to the api
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
from piston.handler import AnonymousBaseHandler
|
||||
from piston.handler import AnonymousBaseHandler, BaseHandler
|
||||
from profiles.models import MinecraftProfile, Quote
|
||||
from minecraft.models import MOTD
|
||||
from django.http import HttpResponse
|
||||
@@ -28,3 +28,8 @@ class MOTDHandler(AnonymousBaseHandler):
|
||||
if len(quote) > 0:
|
||||
motd += "\n"+'"'+quote[0].text+'"'
|
||||
return {"motd":motd.split('\n')}
|
||||
|
||||
class BalanceHandler(BaseHandler):
|
||||
def read(self, request):
|
||||
user = request.user
|
||||
return {"balance":user.get_profile().currencyaccount.balance}
|
||||
|
@@ -7,5 +7,6 @@ motdHandler = Resource(handlers.MOTDHandler)
|
||||
|
||||
urlpatterns = patterns('api',
|
||||
url(r'^validate/(?P<username>.*)$', whitelistHandler),
|
||||
url(r'^motd/(?P<username>.*)$', motdHandler)
|
||||
url(r'^motd/(?P<username>.*)$', motdHandler),
|
||||
url(r'^balance$', Resource(handlers.BalanceHandler))
|
||||
)
|
||||
|
Reference in New Issue
Block a user