~widelands-dev/widelands-website/trunk

« back to all changes in this revision

Viewing changes to wlhelp/models.py

  • Committer: franku
  • Date: 2019-04-11 15:06:09 UTC
  • mto: This revision was merged to the branch mainline in revision 540.
  • Revision ID: somal@arcor.de-20190411150609-801l72ffxgr6gkui
converted to python 3.6 using 2to3 script

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
 
15
15
 
16
16
    def __unicode__(self):
17
 
        return u'%s' % self.name
 
17
        return '%s' % self.name
18
18
 
19
19
 
20
20
class Worker(models.Model):
39
39
 
40
40
 
41
41
    def __unicode__(self):
42
 
        return u'%s' % self.name
 
42
        return '%s' % self.name
43
43
 
44
44
 
45
45
class Ware(models.Model):
60
60
 
61
61
 
62
62
    def __unicode__(self):
63
 
        return u'%s' % self.name
 
63
        return '%s' % self.name
64
64
 
65
65
 
66
66
class BuildingManager(models.Manager):
168
168
    def get_build_cost(self):
169
169
        # Creating the relation between build_cost and build_wares
170
170
        # Querying the wares returns the wares in alphabetical order!
171
 
        count = map(int, self.build_costs.split())
 
171
        count = list(map(int, self.build_costs.split()))
172
172
        for c, w in zip(count, self.build_wares.all()):
173
173
            yield [w] * c
174
174
 
176
176
        return (self.workers_types.all().count() != 0)
177
177
 
178
178
    def get_workers(self):
179
 
        count = map(int, self.workers_count.split())
 
179
        count = list(map(int, self.workers_count.split()))
180
180
        for c, wor in zip(count, self.workers_types.all()):
181
181
            yield [wor] * c
182
182
 
199
199
        return (self.store_wares.all().count() != 0)
200
200
 
201
201
    def get_stored_wares(self):
202
 
        count = map(int, self.store_count.split())
 
202
        count = list(map(int, self.store_count.split()))
203
203
        for c, w in zip(count, self.store_wares.all()):
204
204
            yield [w] * c
205
205
 
206
206
    def __unicode__(self):
207
 
        return u"%s/%s" % (self.tribe.name, self.name)
 
207
        return "%s/%s" % (self.tribe.name, self.name)