34๐
โ
As for the first problem you can use the regex operator the Django ORM provides
e.g.
Model.objects.filter(adv_images__regex=r'^\d+')[:3]
Should output the first 3 rows depending on the ordering you have set.
To only select the whole number records the simplest solution is probably
Model.objects.filter(adv_images__regex=r'^\d\.')[:3]
As for the second problem, does the digit represent an unique album identifier, or is your snippet missing a relational field?
Source:stackexchange.com