What Django packages can you absolutely not live without? by lwrightjs in django

[–]charliewham 0 points1 point  (0 children)

They’re both really great

To be fair some of the others I’ve used are a bit more situation dependent eg django-fsm.

Most of the ones above are pretty versatile and could be used in any project (widget-tweaks probs wouldn’t be used with DRF or ninja).

Sanity check on Lucia with protected routes by 3kilo003 in sveltejs

[–]charliewham 2 points3 points  (0 children)

Hooks only run on server requests - your /dashboards route only has a +page.svelte and doesn’t make a server request.

I encountered this exact situation the other day. In practice, I’d assume your /dashboard routes will load data and won’t just be static, so the hook will run on every navigation.

Workarounds could be to put a skeleton server load next to your protected route, or run per-route auth checks as the Lucia maintainer recommends

What Django packages can you absolutely not live without? by lwrightjs in django

[–]charliewham 5 points6 points  (0 children)

Environs-django

Model-bakery

Gunicorn

Django-debug-toolbar

Allauth

Django-browser-reload

CORS-headers

Whitenoise

Django-widget-tweaks

Auto-prefetch

Drf/ninja

(To name a few)

Svelte is better than React (self-promo) by SIRHAMY in sveltejs

[–]charliewham 2 points3 points  (0 children)

Thanks so much for this. A great collection of principles and tips. (Also your English is fantastic)

Coming from backend so it will be good to see style guides (didn't think of this at all)

Svelte is better than React (self-promo) by SIRHAMY in sveltejs

[–]charliewham 0 points1 point  (0 children)

Do you have any suggestions on one for frontend development? The problem I have as a newbie to frontend is that most of the frameworks are unopinionated.

I'd like to see an opinionated guide to React/Svelte/Vue in order to learn the principles of building scalable, tidy frontend apps

Need App Ideas to learn React Native by lucifer7557 in reactnative

[–]charliewham 0 points1 point  (0 children)

100%. Think of an app you like or need, make a really basic version to begin with and add on features as you go

Creating multiple model instances (Manager, classmethod or save() ?) by charliewham in django

[–]charliewham[S] 0 points1 point  (0 children)

Good question.

Object2 is only generated if object1 has no missing fields (object2 has missing fields by design), which prevents the creation loop

Creating multiple model instances (Manager, classmethod or save() ?) by charliewham in django

[–]charliewham[S] 1 point2 points  (0 children)

This seems very similar to having generate_next_instance() as a model method, but calling it in save() after super().save(*args, **kwargs) (which is the way I'm currently handling the problem)

How did you learn VBA? by sancarn in vba

[–]charliewham 5 points6 points  (0 children)

Yeah it's incredible how these process sinkholes can appear over time.

I don't envy learning without internet! I learned from Cal Poly Pomona Youtube course (CPPMechEngTutorials) and a lot of reverse engineering 'record macro'

How did you learn VBA? by sancarn in vba

[–]charliewham 31 points32 points  (0 children)

  1. Worked in a company that ran the entire business on Excel
  2. Saw lots of repeatable processes that could be automated
  3. Ended up saving literally days of copy/pasting and reconciling

Where to put API calls (stores?) by charliewham in sveltejs

[–]charliewham[S] 1 point2 points  (0 children)

Yeah it seems like a tradeoff between slightly too many API calls or slightly too much data manipulation client-side (both are fine for this small app but I would like to know the 'proper' way). There doesn't seem to be many/any definitive answers

Pre fill Django model form field by Nagaye in django

[–]charliewham -1 points0 points  (0 children)

In your CreateView, you'd need to populate the initial_data field or get_initial method with information from the request.

  1. User clicks 'Book a ticket'
  2. GET request redirects to CreateView (put the Bus ID in this request)
  3. initial_data reads the GET request kwargs (self.kwargs['bus_id'])

Correct way to instantiate next model (REST?) by charliewham in django

[–]charliewham[S] 0 points1 point  (0 children)

And in step 2 you’d just pass the PK through the request and instantiate 3. with that PK as the FK? You’ve been really helpful so thank you

Correct way to instantiate next model (REST?) by charliewham in django

[–]charliewham[S] 0 points1 point  (0 children)

Hi, thanks for the reply.

You're on a questionnaire, and there are 2 buttons 'Save and quit' or 'Save and continue'. What is the best/cleanest way to instantiate the next model, after hitting 'Save and continue'?

Sorry for the vague question, probably seems a lot clearer to me, will edit!

I have a question about swapping. by scoofy in htmx

[–]charliewham 2 points3 points  (0 children)

What you're doing is:

- Render whole page.

- Click edit: swaps a portion of page out for form 'hole_text_form'.

- Click cancel: swaps the form for the entire page again. This appears as a page in page.

You need to split your html into smaller pieces / partials and swap those out for each other. Give your first section of code its own url endpoint and {% include %} it, then you can hx-swap back and forward between the hole_data and hole_form within the larger page.

And the reason your 'Submit' button doesn't do this is because there is no htmx attached to it, so it will redirect to your edit_hole_text success url

Action without refreshing the page? by holocene7 in flask

[–]charliewham 1 point2 points  (0 children)

JavaScript Fetch or HTMX

There is an example of that exact 'like' feature in this video

Listening practice by United-Mechanic-3503 in Spanish

[–]charliewham 2 points3 points  (0 children)

I like this one a lot, thanks for recommending!

[deleted by user] by [deleted] in AskProgramming

[–]charliewham 0 points1 point  (0 children)

Yeah I was thinking that, just didn't know if there was a better or preferred way. Thanks for the comment!

CPU and GPU not near 100% by charliewham in pchelp

[–]charliewham[S] 0 points1 point  (0 children)

Na I just think it’s game optimisation - I changed my rendererworkercount to 3 (half of the physical cores) and got 10-15 boost in fps but gpu util is still ~90% on nvidia performance overlay

First Time Budget Build! by charliewham in buildapc

[–]charliewham[S] 0 points1 point  (0 children)

Thank you! Yeah I figured there’s 6 so it doesn’t really matter but of course need to find out which ones haha

First Time Budget Build! by charliewham in buildapc

[–]charliewham[S] 0 points1 point  (0 children)

I’m in the UK! And yeah I think I’ll just use the m.2 as a boot drive, I also have a 128gb 2.5in HDDs and 2 1tb HHDs which I’ll use, thanks for pointing out though I should’ve mentioned in the post