The Mantilogs Milestone 1 Marathon

The Mantilogs Milestone 1 Marathon

Welp... I am almost at the end of the first milestone for Mantilogs now. It started out as an impromptu software to help us keep track of caring for our cadre of mantis because we could not find any reliable care information with proper data to back it up. Then we moved and the last of our little mantis friends passed on. We didn't feel comfortable to attempt breeding after just one year of working with them however so we did not have any oothecae to start anew. Though I did buy some and one did hatch but there was an issue of sickness in the household that caused me to be the sole caretaker of everything and everyone while trying to maintain my studies... I failed to see things going badly and man I just can't get over that failure. We did release a lot of them into our garden/creek area so there is a chance there may be some oothecae for us to find out there next month. (Leaves should be cleared by then)

Anyway it grew into a care and logging system for our cultures of feeders and cleaners as well as for our geckos with plans to expand to all forms of exotic buds. Also added inventory management for things like heat wires, feeder food, and really anything you need to keep track of. You add items to the item database, then from the index of items you can click a button saying you used up the item and check a box if it expired, this way you can know how often things expire or don't and keep track of how often you might need to reorder some things (if they are expiring a lot maybe buy less often or smaller amounts, stuff like that.)

Well it will, working on that today. Also going to add some features to the gecko index. The last thing I need outside of that for finishing off this Milestone is to create a logo for Mantilogs... that bulma logo is great and all but shit needs branding.

Off I go to create some Inventory Views.

Alright, got an index.

Seems to work.

Created the Add Item form which also adds an instance to the Inventory model. Intuitive. Not my work... though I guess it is but I mean figuring out how to save it and add an entry to inventory was... easy.

 if form.is_valid():
                # Process the data.

                item =
                #Add an entry to Inventory.
                inv = Inventory(item=item)
                # Redirect
                return HttpResponseRedirect('/inventory/index')

Now for the Add Order Form which will take items ordered and add them to inventory. I really need to figure out a way to allow the user to say they bought X items and then update the Inventory accordingly, for now it increments by one on every item ordered. To (rather lazily) solve this issue for now I will have the quantity on the index be an input box with a save button next to it if you are logged in as staff. It's 2pm already and I want to get most of this stuff done by the end of the day. I'll figure it out over the weekend.

def update_inventory(request):
    if request.method == 'POST':
        if request.user.is_superuser:
            form = (request.POST, request.FILES)
            inv = Inventory.objects.get(item=request.POST['item'])
            inv.count = request.POST['count']

            print("What the hell, someone trying to GET on this for?")
            return HttpResponseRedirect('/inventory/index')
    return HttpResponseRedirect('/inventory/index')
That ought to do it. I should really validate that data but the DB wont accept it unless it's an Int so I'm good.

Alright, now we just need to add Item Usage and Expiration which is basically the same thing with a different form.

Had a bit of a hiccup and had to drop the inventory database, this is why we use test data and dont do this crap in production. Postgres seemed to believe I had to primary key fields declared somehow... anyway back to work.

With that, I have all the inventory features that we will be needing for now added in.

Inventory management, yay?

Here I was trying to compare datetimes in the templates... like some kind of barbarian when I could have added this sort of thing to the models as a property. Back into the models! Works for some use cases, not for all!

At any rate:

This is easier to read now.
This is fine.

With a bit of ham-fisted redesign...

With all that I have only one thing to do to complete this milestone. A logo. Gonna do that this weekend, for now though it's dinner cookin' time, lads, lasses and non-binary ass– people. Damn, couldn't think of a better rhyme there, too hungry.


Added a quick and dirty logo.

Milestone done.

Also added measurement logs. Had it written down in a note next to the couch and hadn't looked at it since I have been in the office most of the past week.