How to access Model’s pk/id when you create an instance in Django

If you need to modify instance fields depending on the instance’s pk or id, hop on.

When you create an instance, before it is saved, you can’t have pk or id as it is not yet created.

    def save(self, *args, **kwargs):
        # self.pk == None
        # self.id == None
        super().save(*args, **kwargs)
        # self.pk != None
        # self.id != None        

If you have a property that somehow depends on the value of self.pk or self.id and you want to have it saved on creating, you have two options.

Read More »

Download TikTok video without Watermark with Python (Part 1) [TikTok-Api] What is video_url? (upd. 11.01.20 IT DOES NOT WORK ANYMORE lol 4 days later)

There is a rather fresh updating of TikTok-Api concerning watermarks, let’s dive in!

This is more of a study than a complete solution, and even though I provide a working code, it is not perfect. Proceed to see why!

A part of what I see as a blooming TikTok Scrapping series.

upd. 11.01.20 IT DOES NOT WORK ANYMORE lol 4 days later

Read More »

[Note] ImportError: cannot import name ‘CaptchaStore’ from ‘captcha.models’

You use django-simple-captcha and just get this all of a sudden.

For me it was that I tried to install Google Captcha or something, it installed captcha or something, I don’t remember.

Basically, do this:

pip uninstall captcha
pip uninstall django-simple-captcha
pip install django-simple-captcha

honesty, everything that could’ve gone wrong has gone wrong this week with my project. I am not impressed anymore.