Email or username:

Password:

Forgot your password?
226 posts total
Nikita

Needed to implement a quick draft of a website, which basically pulls data from an API and displays it neatly on the page. For some reason, I decided to make it a #JavaScript SPA. Immediately regretted it due to no built-in parsing of dates and 0-indexed months šŸ™„

Rewriting it as a thin client with a lightweight #Python (or #Go, I havenā€™t decided yet) back-end. Good morning! :blobcatgooglycofecup:

Nikita

For those, who wonder: No, my SPA is not a thin client, it can be thinner! The API accepts date as parameter, and I want for the client users to ba able to put the desired date as a query parameter. Such a pain in the butt to do this in JS, so my website will be static ā€” even better.

Nikita

Woke up, wanted to react to #GitLab removing one-year-old repositories, but they already U-turned on it. That was quick :D

Nikita

SSH commit signing has been around for over 7 months now, but GitHub is still behind on that feature (unlike @gitea and thus @codeberg)

Yet another reason to #GiveUpGitHub

Nikita

#Django devs, I need your help!

Is there a way to display a model objectā€™s data in a ModelForm as an uneditable field?

Use case: User A submits an order for User B to execute. On creation time, User A can choose an executor. User B can edit the order submitted to him, but canā€™t edit the ā€˜executorā€™ field any more. I do still want to show it in the HTML form, though.

Is there a way to cleanly implement it with ModelForm?

Plz boost because Iā€™ve been sitting at this for two hours now šŸ˜©

Show previous comments
Brian :fedora: :python:

@kytta If I understand your problem correctly, you could inject arbitrary HTML key value pairs via the widget attrs property in the ModelForm or add a conditional check that if an order exists in the form template disable the widget? Sorta like this:

{% if obj %}
<fieldset disabled><div class="control">{{ field }}</div></fieldset>
{% else %}
<div class="control">{{ field }}</div>
{% endif %}

Anthony Sorace

@kytta @ru (I have not done this particular case myself, butā€¦) You can define attrs on a widget; I *think* this is just a question of setting the ā€œreadonlyā€ attr on the one in question. Note that youā€™ll likely want to validate that field server side on submission to guard against folks editing the html directly.

Nikita

For all interested, here's how I solved it:

1. I defined the "executor" <input> as disabled and readonly
2. I made the "executor" field in the form not required
3. I also put self.object.executor inside form.initial on form render
4. On form_save(), I replace form.instance.executor with values from form.initial

May be hacky, but seems pretty bulletproof to me. And the code is pretty clean!

Thanks to @ru, @bpepple, and @a for helpful tips! āœØ

For all interested, here's how I solved it:

1. I defined the "executor" <input> as disabled and readonly
2. I made the "executor" field in the form not required
3. I also put self.object.executor inside form.initial on form render
4. On form_save(), I replace form.instance.executor with values from form.initial

Nikita

I would never imagine that picking apart old #legacy code would be a fun activity for me. But now, having replaced 30+ lines of unprofessionally written jQuery mess with two lines of backend Python code, I feel so euphoric. Took me an hour to even get the sense behind it, but itā€™s rewarding. I guess I definitely chose the right profession šŸ˜„

Finner

@kytta my primary function in my day job is reading and understanding old messy programming in sometimes obsolete controls systems and reprogramming those functions in newer controls systems using modern standards. I really enjoy it, so I know what you mean. It can be fun and quite satisfying.

Nikita

Me: *run a single MariaDB container*
Container: *requires no more than 100 MB of memory*

Docker: *eats 4GB*

I hate Docker Desktop so much :blobcatangery:

Nikita

Quite sad that this is the first time in my life that I've encountered a website that actually does respect DNT šŸ˜•

rugk

@kytta still stupid it anyway shows a popup. But BTW I heard #geizhals does that too.

Š“Ń€ŠøŠ³Š¾Ń€ŠøŠ¹ ŠšŠ»ŃŽŃˆŠ½ŠøŠŗŠ¾Š²

Medium also respects it somewhat. They'll track the crap out of you themselves, but won't show youtube embeds to "protect your privacy" šŸ¤”

Nikita

When developing a web app locally, which credentials do you use for testing?

Anonymous poll

Poll

user[name]/pass[word]
2
22.2%
admin/admin
5
55.6%
root/toor
1
11.1%
other (reply)
1
11.1%
9 people voted.
Voting ended 23 Jun 2022 at 15:07.
Nikita

TIL that the HTML attribute ā€˜bgcolorā€™ with the value ā€˜crapā€™ produces a brown-ish background on the element. There is a bizarre algorithm behind it, which is shipped with every browser because of, you guessed it, compatibility with Netscape Navigator.

stackoverflow.com/questions/83

Nikita

#AskFedi iPhone users:
A friend of mine got herself an iPhone 13 and thinks about getting a protective glass for the camera. Anyone here who can recommend or advise against it? Is there a need for one, does it peel off nicely, do the photos look different?

P. S. Please no "apple bad" replies :D

Show previous comments
birnim

@kytta Ok, no "apple bad". What about "apple overpriced"? šŸ˜‚

Ruud

@kytta The glass on the camera's is very strong. I've never used protective glass on it, never seen a scratch.

š“”š“¾š“­š“øš“µš“Æ šŸ‡ŗšŸ‡¦ :unverified:

@kytta
Get a silicon sleeve where the camera lens is submerged. That also protects when dropping.

Nikita

I don't know why, but I really like the peaceful and cozy vibes of this picture šŸ˜Œ

Nikita

Hey Fedi, do you know if there is a federated (perhaps even #ActivityPub-powered) cooking recipe hosting service? If not, let's šŸ‘ make šŸ‘ this šŸ‘ happen!

I hate modern recipe websites. All of them are full with ads and tracking. The leading recipe hosting in my country loads over 30 different trackers, and that's excluding the ads!

Show previous comments
rich

@kytta hmm, recipe sharing was the original intent of the gnutella network if I remember correctly

DELETED

@kytta In French, there's cuisine-libre.org/ which is quite good.

I know there's a Nextcloud app for that: apps.nextcloud.com/apps/cookbo

But it is not federated.

Nikita

A hundred replies later, hereā€™s what I gathered:

ā€” people seem to like the idea :D
ā€” there are other projects with similar idea of making recipes publishing more communal
ā€” there are quite a few recipe formats: Schema.org, FatHub, RecipeML, h-recipe, Cooklang
ā€” semantic markup is a must
ā€” discoverability will be tricky
ā€” Nextcloud has a cookbook app; it is unclear how it works with (federated) Nextcloud Social
ā€” name ideas: Recipedia, Cookwyrm :blobcatgoogly2:

Iā€™m quite hyped to say the least

A hundred replies later, hereā€™s what I gathered:

ā€” people seem to like the idea :D
ā€” there are other projects with similar idea of making recipes publishing more communal
ā€” there are quite a few recipe formats: Schema.org, FatHub, RecipeML, h-recipe, Cooklang
ā€” semantic markup is a must
ā€” discoverability will be tricky
ā€” Nextcloud has a cookbook app; it is unclear how it works with (federated) Nextcloud Social
ā€” name ideas: Recipedia, Cookwyrm :blobcatgoogly2:

Nikita

Yesterday I had the joy of installing Fedora (dual-boot) on my work PC. And oh boy, did Linux come a long way!

First, I donā€™t quite understand why people dislike the Fedora installer. All went pretty smooth, and the installer immediately recognized my free space and created the needed partitions. GRUB also plays pretty good with Windows.

Nikita

Second, I think Iā€™m in love with GNOME 40+. The snappiness, the style, the default app set are incredible. I was amazed how I literally didnā€™t have to install anything extra to do my job (which, to be fair, is basically RDPā€™ing into Windows machines and connecting to SMB shares).

Nikita

I have used up all my data plan for this month, so my speed is capped at 64 Kbps.

This is a friendly reminder to all web developers: Keep your bundle sizes small, only ship what you need, compress your images, YOU DON'T NEED REACT IN YOUR F-ING BLOG, test your sites on slow connections and slow phones.

You using a Galaxy S22 Ultra with an unlimited 5G plan doesn't mean everyone else does too.

Show previous comments
[DATA EXPUNGED]
brandt_

@kytta like in the old days where everything was considered against bandwidth.

and oh...some-danish-public-media-outlet. Parallax in articles is NOT cool

Blake Leonard

@kytta I should test my site with Firefox Devtools's network throttling setting

Nikita

#Django advice needed!

My setup is: I have 5 Django apps, each has 3ā€“7 models. For each model, there is a list and a create/edit view. All are based on the same base.html.

I want to have <title> be set in a LIFO manner. For example, list of ā€˜itemsā€™ inside ā€˜warehouseā€™ app would have the title ā€˜Items - Warehouse - Site nameā€™.

Right now I have to create almost identical base templates with just the title block for every app. Is there a less repetitive way?

cc: @ru @pbx

#AskFedi #BoostsWelcome

Paul :python: :django:

@kytta @ru Are these generic views? If not, I'd think you could generate an appropriate title in each of the views, putting it in the template context, and reference it in the template. This may be off-base but it's the first thing that comes to mind.

Ru (Tech) :blobcatsadlife:

@kytta Iā€™ve actually been using blocks as well at the moment. I havenā€™t cared to optimise this as I havenā€™t felt the need.

@pbx

Nikita

At this point, the only thing I miss in @Tusky is the ability to auto-set reply visibility to something different from the global toot visibility. Use case: normal toots are globally visible by default, replies are unlisted by default. Any chance that this will be implemented? :blobcateyes:

Nikita

How do you organize your files, Fediverse?

I have accumulated lots of stuff over the years: photos and videos, school and university documents, job files, private development projects, video projects, music, screenshots ā€” all of which I want to keep backed up.

The problem I have is the directory structure. How would you organize all this so that stuff is always easy to find and duplicates wonā€™t spawn?

Iā€™ve tried Johnny.Decimal, and it didnā€™t work for me. Do you have other ideas? #AskFedi

Show previous comments
Tagomago

@kytta

-Docs (personal)
-Media (personal)
-Projects (personal)
-Work

Then mostly by topic/project and/or chronologically named directories inside. Johnny Decimal looks too rigid to stick to it. Maybe it works for personal files or abstract, administrative/managerial positions. Most projects comprise several kinds of files, and sometimes a high number of them, so I put those into different directories inside the project directory. Otherwise there would be pools of files, and I don't want that.

asriyanarthur

@kytta
hello. maybe this link will be useful for you: karl-voit.at/managing-digital-
it is about managing files, not only about photo.

bojkotiMalbona

@kytta This question is really 2 in 1. How the data is organized and how it is stored/archived. W.r.t media, youā€™re aware of the lifetime limitations of optical media & flash media. So youā€™re using a hard drive to store your backups. Backup tech has become a sad state of affairs. Hard drives are cheaper than cassette tapes, but they have moving partsā€¦ heads that can crash. Not ideal.

Nikita

Any recommendations on lightweight and open-source e-book readers for #Android? EPUB and FB2 are a must, as well as dark mode and font size adjustment. I don't care about other features, really :D

#AskFedi

Go Up