<s> from django . db import models <EOL> from datetime import date <EOL> class logreport ( models . Model ) : <EOL> date = models . DateField ( ) <EOL> apikey = models . CharField ( max_length = <NUM_LIT> ) <EOL> count = models . IntegerField ( ) <EOL> def ApiLogIncrement ( apikey ) : <EOL> """<STR_LIT>""" <EOL> today = date . today ( ) <EOL> try : <EOL> report = logreport . objects . get ( apikey = apikey , date = today ) <EOL> report . count += <NUM_LIT:1> <EOL> report . save ( ) <EOL> return report . count <EOL> except logreport . DoesNotExist : <EOL> newreport = logreport ( date = today , apikey = apikey , count = <NUM_LIT:1> ) <EOL> newreport . save ( ) <EOL> return <NUM_LIT:1> </s>
