Open TangoYankee opened 6 years ago
I can see why you'd suggested a Tool
and Cleanup_Tool
model. The thought process makes sense.
But unless tools are things we do something with in the app, they function as options. This would mean listing the tools as a choice field on a model.
The spreadsheet suggests that we're posting our Cleanup events there, along with a EquipmentOrder
type of model (something that asks for equipment) for the tools it would take to clean it up.
But are we expecting users to fill out that information? Because those details sound like something an official or representative of the city would need to approve, not something our users could post on a cleanup event before then. Examples:
If someone knows the answer to this, post it. I'll dig around on the public works site to see what their process is for these tools.
After Saturday's meeting here's where we are with Public Works:
SupplyOrder
. Tim is working out the user workflow on it.As for modeling, the SupplyOrder
will need:
Cleanup
relation, which contains all relevant event data such as host, date and location.pickup_date
and dropoff_date
tools
as a JSONFieldThe JSONField will contain key/value pairs for example rake: 4
. This makes it easy for the frontend client. The form data would go directly into the database and sending it to google Sheets would be equally simple without a lot of overhead. See Google Docs for info about how the read/write works: https://developers.google.com/sheets/api/guides/values
I'll post an example based on discussion here: https://github.com/openoakland/TrashTalk/pull/156
Public Works V. Trashtalk process: @Protosac I'm not sure whether you still have questions about the process of requesting tools. My understanding is that residents can make tool requests to the city, regardless of whether they're part of an organization. We are simply creating a process that integrates with TrashTalk and can be built out better than the current process. The city then decides whether to approve the request.
From my brief introduction of JSONFields, it appears to require: 1 . Each cleanup to have the JSON data written to it 2 . An alternative way to store quantity information, as the basic JSON will requires manipulation to store quantity data.
My Suggestion: Modeled on internet-order
Based on tonights conversation here's what I recommend (in addition to any other fields you'll need to add):
class SupplyOrder(TimestampedModel):
cleanup = models.ForeignKey('cleanup', on_delete=models.CASCADE)
tools = models.ManyToManyField('Tool')
class Tool(models.Model):
quantity = models.IntegerField()
If you require categories, that's best done as a choice field, not a model. See the Location
model for example.
Given that this is presently already working, would you be opposed to us just leaving it as it is?
If we change to a choice field we would have to:
We would be losing out on:
2 models is good, we lose none of the benefits you listed. Categories are just fixed, broad descriptors at this point. Any necessary details should go on the tool description.
Add a management command to populate data, and avoid fixtures. This eliminates the need to maintain them every time the database changes.
Models: 1 . Tools
2 . Cleanup_Tools
3 . Cleanup