#1 by PatrickT
Good evening,
I have an ExtraModel and Custom Export set up in the following way:
class Bids(ExtraModel):
group=models.Link(Group)
player=models.Link(Player)
round_number=models.IntegerField
firm_ID=models.IntegerField
wage=models.IntegerField
bid_number=models.IntegerField
time_offered=models.FloatField
number_of_offers=models.IntegerField
Then, I add data to the ExtraModel in my live_method with:
Bids.create(group=player.group, player=player , round_number=player.round_number, firm_ID=player.id_in_group, wage=player.wage, bid_number=player.bid_number, time_offered=player.time_offered, number_of_offers=player.number_of_offers_in_round)
My custom export is set up like so:
def custom_export(players):
#Header row
yield ["round_number","firm_id","wage","bid_number","time_offered","number_of_offers"]
bids=Bids.filter()
for bid in bids:
player=bid.player
yield [bid.round_number, bid.firm_ID, bid.wage, bid.bid_number, bid.time_offered, bid.number_of_offers]
After some trouble shooting, I got the custom export to work, but the data looks like this:
round_number firm_id wage...
<bound method IntegerField of Bids()> <bound method IntegerField of Bids()>...
How do I get the actual data to appear rather than bound method?
#2 by PatrickT
For everyone that comes across this post, I realized that I forgot to include"()" after each field when I defined my ExtraModel. So, it should instead look like this:
class Bids(ExtraModel):
group=models.Link(Group)
player=models.Link(Player)
round_number=models.IntegerField()
firm_ID=models.IntegerField()
wage=models.IntegerField()
bid_number=models.IntegerField()
time_offered=models.FloatField()
number_of_offers=models.IntegerField()
My custom data export works now!