@benjaoming@social.data.coop
@benjaoming@social.data.coop avatar

benjaoming

@benjaoming@social.data.coop

❤️ing computer reuse, repair and Open Source
🤜️ing tech solutionism and colonialism
🦫ing as an open source consultant/activist
📝️ing for GovStack's Consent Building Block

Active in www.fairdanmark.dk (@fairdanmark), www.data.coop, www.django-denmark.org, co-organizer of DjangoCon Europe 2019, co-organizer of Malawi Data Science Bootcamp 2021 https://mwdata.science

Daily work revolves around documentation, Django and digital consent

This profile is from a federated server and may be incomplete. Browse more on the original instance.

carlton, to django
@carlton@fosstodon.org avatar
benjaoming,
@benjaoming@social.data.coop avatar

@carlton OMG THIS!

> ModelAdmin.list_display now supports using __ lookups to list fields from related models.

benjaoming, to random
@benjaoming@social.data.coop avatar

CRUD. C=Create, R=Read, U=Update, D=Delete, (null)=List.

Here is the proper acronym:

CRUDL

(pronounced cruddle)

Edit: Now updated, still unsure why I always feel super annoyed with this acronym 😂

benjaoming,
@benjaoming@social.data.coop avatar

@bmispelon ahaha, maybe that is the reason for me to drink at least one cup of coffee before typing stuff

benjaoming,
@benjaoming@social.data.coop avatar

@bmispelon haha, thanks but it was a very weak acronym game 😂

"CRUDL" sounds like something one would say while eating a huge potato.

  • CRUDL
  • What?
  • CRUDL!
  • Sorry can you finish chewing and say that again?

I try again with CUDDL... now the two Ds are now for Delete and Detail.... it's got more rhyme 🎷

benjaoming, to django
@benjaoming@social.data.coop avatar

Here's a generic response for object creation with django-ninja:

class GenericCreatedSchema(Schema, Generic[EmbeddedType]):  
 success: bool  
 created_object: EmbeddedType  

= use the same generic response template for ALL object creation endpoints.

But even better: I can use different response types in the same API endpoint, using HTTP status codes - depending on which fields are exposed to the user.

All of this translates to OpenAPI spec automatically 💯

benjaoming, (edited )
@benjaoming@social.data.coop avatar

My proposition to use django-ninja would sound something like:

We leave behind the class-based thinking from Django Rest Framework, and instead of class inheritance, we take full advantage of types and decorators.

Our complexity and component structure can be modelled in a "flat" way. The properties and behavior of an endpoint is made easily accessible in the endpoint's definition.

The cost: Internal magic of django-ninja and Pydantic is harder to understand. But so is the Django ORM.

benjaoming,
@benjaoming@social.data.coop avatar

@tykling yes - my first venture with django-ninja was a script that automatically wrote an API spec from a Google spreadsheet definition. Reducing the API definition to only the essential parts is really powerful in itself! I liked the simple, minimal approach.

Now I'm discovering that it works well in complex settings, too.

pernillet, to random
@pernillet@mastodon.online avatar
benjaoming,
@benjaoming@social.data.coop avatar

@pernillet this basic ethical/moral stuff that they're deliberately violating... doesn't bode well for all the other levels that OpenAI is supposed to show caution and restraint.

benjaoming, to django
@benjaoming@social.data.coop avatar

Oy! Today, it's the 10 year anniversary for #Django PR#2692 🥳

It's definitely worth celebrating how the good forces were victorious against all the loud mouth conservatives/trolls. Since my office is full today, I might need to get both a primary cake and a replica cake for redundancy 🍰

Congrats and thanks to @fcurella and everyone else involved in this.

https://github.com/django/django/pull/2692

SebastianM6L, to django
@SebastianM6L@mastodon.social avatar

Why isn't

Model.objects.get_or_none()

a thing in #django ?

That would save some boilerplate code or am I wrong?

Because if there is a chance that there is no entry for the query get()will raise a DoesNotExist exception that you have to catch.

get_or_none()would be cleaner in my opinion.

benjaoming,
@benjaoming@social.data.coop avatar

@SebastianM6L you can use .first() if you don't care about MultipleObjectsReturned issues. Otherwise, I think it's best to define your own logic for your particular case. I wouldn't like the framework to "trick" people, so I think the current behavior is really good 😇

kimschulz, to Samsung Danish
@kimschulz@social.data.coop avatar

Nå men altså mine kanelsnegle gik vist lidt ampl i ovnen så det bliver svært at finde de muffinsforme de blev bagt i 🤣

video af kanelsnegle der går amok i ovn

benjaoming,
@benjaoming@social.data.coop avatar

@andreasio @kimschulz DET NEMT! MAN FILMER FRA OVEN! 🥁 🥁 🥁 👋 🚪

gvwilson, to random
@gvwilson@mastodon.social avatar

I want the equivalent of 'lint' or 'ruff' for GitHub repos. Does the repo name match a pattern? Are the right issue labels set up? Et cetera. I can write a script to do this, but if it already exists, a pointer would be welcome: how do you manage the 780 repos your org has?

benjaoming,
@benjaoming@social.data.coop avatar

@gvwilson I know that @aj has built some tooling for managing consistent labels across repos.. in case he sees this (may not be so active here)

frank, to random
@frank@frankwiles.social avatar

It's not often I laugh multiple times during a Python YouTube Video but Hynek manages to pull it off https://www.youtube.com/watch?v=ImBvrDvK-1U

benjaoming,
@benjaoming@social.data.coop avatar

@frank that was a funtastic summary, thanks for sharing!

benjaoming, to random
@benjaoming@social.data.coop avatar

Interesting. Several Canonical projects are using Discourse as their #documentation platform.

As with documentation using wikis, it's nearly the opposite of Documentation As Code. Instead of benefiting from a relationship between documentation, the software, its versioning and CI platforms, it builds a direct relation between documentation, support and community.

Here's an introduction: https://discourse.ubuntu.com/t/documentation-contributions/35868

Rendered docs: https://microstack.run/docs

benjaoming, to random Danish
@benjaoming@social.data.coop avatar

Dansk Industri og Tryg

benjaoming,
@benjaoming@social.data.coop avatar

@siggi ja :)

benjaoming,
@benjaoming@social.data.coop avatar

@siggi haha, tak, skørt at virkeligheden er så dum, at den bedst beskrives på den her måde

hugovk, to python
@hugovk@mastodon.social avatar

I just kicked off PyCon 2024 with the first talk of the Language Summit (and my first talk at PyCon!): "Should Python adopt CalVer?" It was an interesting discussion, let's see!

The view of the language summit from the lectern.

benjaoming,
@benjaoming@social.data.coop avatar

@hugovk Great overview! I guess some "cost-benefit" could be nice.

Some more scenarios can be discussed.. what if a Python 2024 release (3.24.0 or 24.0.0 or 24.01.00) is patched in 2025 (3.24.1 24.0.1 24.01.01)? Or two "minor" releases in the same year?

Many use-cases favor "LTS" releases, which typically span more than one year. It may still create confusion around or the release month, the support span.. so ultimately, we may still end up googling EOL and release plans anyways :)

ovelarsen, to random Danish
@ovelarsen@norrebro.space avatar

Vi har løsningerne. Implementer dem !

Düsseldorf, Germany: 1990 vs 2019

The Rheinufer tunnel relocated the street „Rheinuferstraße“ underground for a length of 1,928 m, allowing the construction of the beautiful Rhine Promenade.

#Ladegårdsåen #Bispeengbuen

benjaoming,
@benjaoming@social.data.coop avatar

@ovelarsen Opposite.... here's the before and after in Dresden's Elbe river shore... Waldschlösschenbrücke Bridge.

There's only two times in history that a site has ever been removed from the UNESCO World Heritage. This was one of them.

https://en.wikipedia.org/wiki/Waldschl%C3%B6sschen_Bridge

A photo of roughly the same place, after an ugly bridge was build and the land was ruined by construction work.

nanorepublica, to django
@nanorepublica@indiehackers.social avatar

📣 Common Django Project structures - Part 3
📄 A very simple setup, useful for demos or very simple prototypes
🔗 https://softwarecrafts.co.uk/100-words/day-91
,,

benjaoming,
@benjaoming@social.data.coop avatar

@nanorepublica Thanks for doing this write-up! Your part 1 and part 2 resemble my experience, too. Especially naming the project package simply project or django_project is something I've used the past years to avoid conflating the understanding with the custom application where 99% of logic lives.

If one was to take a "safe bet" at the inception of a project, I would go with "part 2" :)

benjaoming,
@benjaoming@social.data.coop avatar

@nanorepublica I've also had projects as Python packages with everything under src/<acme>/:

src/acme  
src/acme/project # Django project  
src/acme/apps/users # User handling  
src/acme/apps/pages # Wagtail stuff  
src/acme/apps/events # Events stuff  

That way, we can do DJANGO_SETTINGS_MODULE=acme.project.settings which I think is nice :)

stefan, (edited ) to fediverse
@stefan@stefanbohacek.online avatar
benjaoming,
@benjaoming@social.data.coop avatar

@stefan @stefan Another reason why Phanpy has >63% of alt texts on images, has to be that users have a constant reminder and experience of alt texts, since the text appears as a caption.

When I typed in an alt text in the normal Mastodon web client, the devil inside me used to whisper: "pssst! most people won't see that text anyways".

The example in the image is from a post by @mariatta - random hi from your follower 👋

decibyte, to stackoverflow
@decibyte@social.data.coop avatar

Funny how the "frequently asked questions" for the thing does not list the question "How do I opt out of this?" (nor the answer to it).

https://stackoverflow.co/teams/ai/

benjaoming,
@benjaoming@social.data.coop avatar

@decibyte there's also some discussion about it here => https://m.benui.ca/@ben/112396505994216742

simonjust, to random Danish
@simonjust@mstdn.dk avatar

Koldskål in the house! 😂

benjaoming,
@benjaoming@social.data.coop avatar

@simonjust Koldskålsbrok: "Hverdagskammerjunker" fra Discount 365 (eller hvad fanden de nu hedder) er fuldstændigt umulige at knuse i hånden og smager alt for meget af sukker.

Det er garanteret EU, som har ødelagt vores kammerjunker, så de ikke er til at knuse længere.

Jeg skal snakke med en advokat... en kammerjunkadvokat

anze3db, to random
@anze3db@fosstodon.org avatar

One thing that I'm missing with HTMX and Django is proper error handling.

By default HTMX swallows any response that is not a 2xx, which might leave your users hanging on an endless loading state.

Does anyone have a good solution for this that can be reused between projects?

video/mp4

benjaoming,
@benjaoming@social.data.coop avatar
  • All
  • Subscribed
  • Moderated
  • Favorites
  • JUstTest
  • kavyap
  • DreamBathrooms
  • thenastyranch
  • magazineikmin
  • tacticalgear
  • khanakhh
  • Youngstown
  • mdbf
  • slotface
  • rosin
  • everett
  • ngwrru68w68
  • Durango
  • megavids
  • InstantRegret
  • cubers
  • GTA5RPClips
  • cisconetworking
  • ethstaker
  • osvaldo12
  • modclub
  • normalnudes
  • provamag3
  • tester
  • anitta
  • Leos
  • lostlight
  • All magazines