Is Django capable of this?

Hello All,

I’ve created a web application that calculates the life insurance, income protection and disability needs someone might need. I’ve used HTML to create the form fields, which then pass into my views.py file to perform the calculations before the result is shown on the results page (another html page).

It’s functional (still more work needed) from a calculation standpoint, but from a user design point it can still be cleaned up.

For example, I have html fields that enable entry of up to 3 kids by the user. Of course, some clients will have children, yet some will not (plus they might have more than three!). People without kids shouldn’t have to spend time filling in those fields.

Another example, is if someone is married, they may want to provide financially for their partner in the event of their death - therefore I have a field asking for the partner’s annual income. Yet single people also should have to spend time filling in this field.

Given I don’t need to store any user information (at this stage), I’ve opted not to use the models and database functionality. This tool is designed to be quick and simple for the user.

I have searched to see if conditional fields in html/javascript are a thing (ie: use radio buttons to make fields appear or disappear based on conditions), but overall do you think I am trying to get django to do too much here? And I need to rethink which language I use for the project?

Any input helpful! I can of course also provide the link to project (it’s running on Heroku atm).

Making elements appear and disappear is something regularly (and easily) done with JavaScript.

You can also dynamically add or remove fields using JavaScript. (That gets a little messier when integrating it with Django, but not terribly so.)

You can also simply identify fields as not being required. They may show up on the page, but don’t need to have any data supplied for them. (That can be done on the Django side in the form definition.)

None of this is outside what Django / JavaScript can do.

It also sounds like all the calculations can be performed in the browser in JavaScript. You don’t even necessarily need to submit that data to the server if you’re not storing it there. I’ve seen many “financial-guidance”-type tools that exist solely as JavaScript.

Hey Ken, Thanks for the reply.
Hmmm - I thought you might say that! I’ve been predominantly learning Python, so will take a little bit of adaptability to transform this into Javascript I’d say.
I think you’re spot on regarding all being in browser.
Much appreciated for your reply.

1 Like