Blog postings
I decided to move from using article ids to slugs in the URLs on this website. It was surprisingly straightforward. (Slugs are the bits in the URL like django-and-slugs
instead of article ID numbers which are less appealing.
- Install the
django-autoslug
thing using pip and pipenv. - Add the field to the model. Make sure the migration touches all instances so the slug gets populated.
- Make sure all url things use slug, not id
- Make sure all templates call the right url
I thought it would be well hard. But not. The hardest bit was adding the following operation in a migration:
def add_slug_fields(apps, schema_editor): Article = apps.get_model('articles','Article') for instance in Article.objects.all(): instance.save()
well when i can get python to format in this. One thing at a time.
One of the signs of spring I look out for is the carpet of bluebells you get in some woods around here. Usually a sign that the cold days of winter are well behind us. Where I'm originally from the equivalent is the saying "cast ne'er a cloot until May be oot" - "Never throw away clothing until the May trees [hawthorns] are flowering". Bluebells are prettier.
When will this end urgh
only had mild symptoms; fatigue and coughing the worst. But fatigue was baaaaad man
I updated by payslip checking thing to work with 2022/23 numbers. I thought this would be a straightforward thing, but turns out there is not. His Holiness Sunak decided to have two Primary Thresholds apply in one tax year, so I had to change the backend as well as just squirting some more parameters into the database. (If you don't know what the PT is - this is the number above which you start paying National Insurance via PAYE).
Now I am not doing proper payroll calcs so this is all on the 30/360 day count convention instead of the Actual/Actual with rounding that is done in practice. But the PT thing has two effects. Means there is an awkward branch in a view. And also is a sign of the fact that the guys in charge hadn't planned this. For if they have, they'd have put it in with the start of the tax year.
The PT change was signposted far in advance. Supposedly to give the payroll guys time to put it in properly. I managed to jam it into this terrible website in about an hour, and most of that was dealing with the fixture holding the 2022/23 rates and thresholds rather than coding (ten line change in Python to determine if we are in a special year, and if so do a special calc for the special months). I reckon the professional payroll software people could have put this in within minutes.
My trainers won't grip in this