9 views
Skip to first unread message

Dave Fowler

unread,
Feb 9, 2018, 5:36:46 PM2/9/18
to facto...@googlegroups.com
I'm updating my scripts that create a large dataset using factory boy.  For it it's really useful to be able to get (frequently) a count of the # of rows/instances that have been made for each model.

From the code 3 years ago I used to be able to access the _counter.seq to get the value that sequence is using.

Inline image 1

this doesn't work anymore.  

I've tried changing it to 

cls._options_class._counter.seq


But this seems to get reset every time a new factory is kicked off.

Any advice/help would be much appreciated!


Raphaël Barrois

unread,
Feb 11, 2018, 10:24:05 AM2/11/18
to Dave Fowler, facto...@googlegroups.com
Hi,

There was a big refactor recently, which changed many internals/private APIs, hence the issue you're seeing.

You should still be able to access the counter by going through cls._meta._counter.seq (_options_class points to the uninstantiated class handling options).


Cheers,

--
Raphaël
Reply all
Reply to author
Forward
0 new messages