79386444

Date: 2025-01-25 09:15:07
Score: 1
Natty:
Report link

I did a Google search for "django csv" and arrived here.

As questions have been merged it is difficult to relate the answers to the question asked.

Oddly there is no guidance on the approach taken to the model.

Firstly the model in the question has a price but the import doesn't. This would lead to a serious problem on import.

Do you provide a default price, in which case the database may be corrupted with inaccurate data or set the model to allow null for the price?

Either of these options make the database pretty useless.

Secondly the structure of the model makes searching for a product extremely difficult.

In the model the serial number has been incorporated into the generic name when it may be better to keep them separate.

Separate fields for gear type, gear ratio, direction and color would make searching for a product much easier (and if you're not going to search why use a database with separate fields anyway?)

And then there's "input shaft output shaft" ...

Do you have gear boxes without them? Can you have a gear box with one without the other?

A more sensible approach would be to model how many inputs and outputs and restrict these values to at least one.

Given these guidances it would be possible to match a Django model to a csv import and make sense of the answers.

Reasons:
  • Long answer (-1):
  • No code block (0.5):
  • Contains question mark (0.5):
  • Low reputation (1):
Posted by: Cloudberry