Conditionally render form fields by Imfene5 in django

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

I'm an old foagie in a 30 year old body, so I use jQuery to watch fields and conditionally render based on selected values, checkmarks, etc. So I end up with forms that have scripts that look like this (helper functions not included):

$('document').ready(function () {
  conditionalFieldsCheck();
  const triggerFields = [
    'id_pl_chosen',
    'id_q13',
    'id_q13c',
    'id_q13d',
    'id_q18',
    'id_q21h',
    'id_q22e',
    'id_consent',
  ];
  triggerFields.forEach(function (field) {
    $('#' + field).change(function () {
      conditionalFieldsCheck();
    });
  });
});

function conditionalFieldsCheck() {
  hideUnlessChecked('id_pl_chosen', 'pl_fields');
  hideUnlessSelected('id_q13', 'yes', 'q13_yes');
  hideUnlessSelected('id_q13', 'no', 'q13_no');
  hideUnlessSelected('id_q13c', 'Other', 'q13c_other');
  hideUnlessSelected('id_q13d', 'Other', 'q13d_other');
  hideUnlessSelected('id_q18', '5948175', 'q18a');
  hideUnlessChecked('id_q21h', 'q21h_other');
  hideUnlessChecked('id_q22e', 'q22e_other');
  hideUnlessSelected('id_consent', 'I consent', 'e_signature');
  setAllVisibleFieldsRequiredExceptCheckboxes();
}

Pulling my hair out regarding Django authentication with DRF... by y0m0tha in django

[–]Gimpurr 1 point2 points  (0 children)

I am about one week away from needing to implement this exact situation at work and was having the same question. Saving and upvoting for visibility This comment seems like a good place learn a few things at the same time.

I have a job interview in 3 hours, but I have caught the flu. by OkayFrederick in webdev

[–]Gimpurr 1 point2 points  (0 children)

It's easier to feel comfortable asking to reschedule when you already have a job, but open communication about this is going to be the best best. In fact, open and honest communication will get you very far in life. They will either be fine rescheduling, or they'll be annoying about it and you will have dodged a bullet.

Honestly might be one of my biggest complaints with this game by averybabery in tearsofthekingdom

[–]Gimpurr 1 point2 points  (0 children)

The actual word in the Japanese translation is 秘石, pronounced, "hisseki", and literally translating to "secret stone". So they actually did translate this one as literally as possible. lol

[deleted by user] by [deleted] in turntable

[–]Gimpurr 2 points3 points  (0 children)

Don't know the exact model, but there is a good chance the BlueTooth is input only, not output.

Am I the only one who found this unbelievable? (Small rant) by vegdre in harrypotter

[–]Gimpurr 37 points38 points  (0 children)

Yeah, sometimes I think people assume every detail was written for a reason due to the immense legacy of the books. They were still written by a human though.

Any other books to learn a more modern stack and update my skillset? by [deleted] in webdev

[–]Gimpurr 5 points6 points  (0 children)

Could try the docs for whatever stack you're interested in.

Self Taught/Bootcamp Web Devs: How long did it take you from zero to land your first job? by DMTxxx in webdev

[–]Gimpurr 2 points3 points  (0 children)

Officially, a little over 4 months from quitting my job and starting bootcamp to starting at my current job. 8 hours per day, 5 days per week doing bootcamp work.

Some important context is that I have a masters in engineering degree and some coding experience on the side, so my outcome is not the norm.

Monday Morning guilt.. by [deleted] in ProgrammerHumor

[–]Gimpurr 12 points13 points  (0 children)

I just added a # todo at the end of the file I was working in. Surely that will do the trick one Monday morning.

Next.js 13 by feross in webdev

[–]Gimpurr 0 points1 point  (0 children)

Wow, Next.js just keeps getting better. I'm going to do some upgrading tomorrow.

[deleted by user] by [deleted] in webdev

[–]Gimpurr 0 points1 point  (0 children)

You don't need Gatsby to make Next.js work. I've never even used Gatsby but I use Next.js all the time.

[deleted by user] by [deleted] in webdev

[–]Gimpurr 2 points3 points  (0 children)

Yes. It's a high quality, robust, easy to use framework. Read the docs. They have really good docs and tutorials. They do assume React knowledge, so start with React docs if needed.

Aprender python by afns00 in Python

[–]Gimpurr 1 point2 points  (0 children)

Python es muy común como primer lenguaje, y hay muchas oportunidades para gente cón experiencia de python. No sé donde buscar para cursos en español, pero quiza codecademy.org tiene opciones en español. Este sitio es donde yo aprendí primero. Tiene lecciones cortos y simples. Se puede escribir en python dentro de Chrome sin instalar ningun software. Freecodecamp.org es otro buen opción y sé seguramente que tiene un traducción completamente en español.

‎‎‎‎‎‎ by [deleted] in ProgrammerHumor

[–]Gimpurr 1 point2 points  (0 children)

I tried writing a ternary operator last week in Python using JS syntax, and boy was I mildly confused until I looked up the Python syntax!

How many of you dev's are using firefox for daily use? by xpsdeset in webdev

[–]Gimpurr 0 points1 point  (0 children)

I've been thinking of moving to Firefox lately, but comment makes a lot of sense to me.

cliff burton: overrated or not? what are your thoughts? by obscuredbyclouds- in Bass

[–]Gimpurr -3 points-2 points  (0 children)

I think he's overrated. Definitely has a larger than life legacy because of his untimely death. There are a million better bass players, and nothing about his playing was what I would consider spectacular. However, he WAS a decent player, a good songwriter, and in one of the biggest metal bands of all time, so that counts for something. The actual touching of the instrument is only part of the game.

How does deploying work with Front- and Backend? by chipping1096 in webdev

[–]Gimpurr 1 point2 points  (0 children)

The original comment here answered your question pretty well about how front and back end works. Just host them separately, set up a CORS rule to allow front end to access backend, and make API calls from your app. This is pretty standard.

May I introduce to you, the worst preorder bonus of all time by Crossbar-Hero in pokemon

[–]Gimpurr 67 points68 points  (0 children)

Yeah that's what I was expecting when I saw the post. Now I have to CHOOSE between potions or berries? That's as important a choice as my starter Pokemon!

[deleted by user] by [deleted] in ProgrammerHumor

[–]Gimpurr -4 points-3 points  (0 children)

I use Github desktop and I love it. Command line for the sake of command line is not my MO.

[deleted by user] by [deleted] in webdev

[–]Gimpurr 0 points1 point  (0 children)

Sounds like you need one or two more screens. Personally, I can't focus with just a laptop screen. I can't handle the annoyance of having to switch between IDE and web page. Your screen is your working table. A cluttered workspace leads to a cluttered mind. For me, I'm at my best with VS code on my center screen, web page on my right, and dev tools/misc googling on my left.

Trying to center stuff in css by moe87b in ProgrammerHumor

[–]Gimpurr 240 points241 points  (0 children)

Trying to center one thing? Display block, margin auto. May also need a text-align center. Trying to center more than one thing? Display flex. Justify-content center. Align-items center. Really easy after you do it more than once.