Skip to content
This repository has been archived by the owner on Feb 24, 2021. It is now read-only.

Create Bat model #16

Merged
merged 12 commits into from
Feb 26, 2019
Merged

Create Bat model #16

merged 12 commits into from
Feb 26, 2019

Conversation

mcab
Copy link
Owner

@mcab mcab commented Feb 25, 2019

Addresses #4.

By utilizing some of PostgreSQL's special fields, we can reduce the amount of columns we would need to use for specific fields.

Things that we can keep track of:

  • Common name
  • Scientific name
  • Rarity of bat (common, seasonally common, rare)
  • Habitat patterns (hibernates, migrates, cave roots, tree roosts)
  • Size (how big in units)
  • Pups (how many pups are born per year)
  • Risk (not threatened, endangered, threatened, special concern)
  • Risk scope (if it's affected at the federal or state level)
  • Image (what the bat looks like)

Include some fields that will be used to keep track of information about
bats.
Since we'll be using PostgreSQL as our main database driver, we need to
have the driver installed for it.
This is used so that `python manage.py migrate` includes what we need.
This lets us define custom admin pages based off of our models.
@mcab
Copy link
Owner Author

mcab commented Feb 25, 2019

Things that aren't fully working:

  • Bat admin page needs a bit of a tune up.
    • Each field needs help text to describe what it does
    • Habits needs to be renamed to Habitat Patterns
    • Habitat patterns Habits need to have a way to select multiple items and not the short-hand code for it (HI, MI, etc.)
    • Size needs to go in smaller increments (.1)
    • Size requires a text field for units
    • Risk and Risk scope needs to be changed from ArrayField to just CharField, or have a way to tie each Risk scope to a particular risk
    • Bat Image needs to be editable from that screen.

need tweaks for bat edit screen

Good news is that we have Bats listed in the admin menu now!
bat on admin sidebar

We also can see the overview of all the Bats, but we might need to think of a better way to search / view them.
bat admin index page

We can properly edit images now, and have collapsible categories for
things that are of similar note.
@mcab
Copy link
Owner Author

mcab commented Feb 26, 2019

screencapture-localhost-8000-admin-bathouse-bat-edit-1-2019-02-25-20_35_53

Made the edit page a bit less long. Still need to address the range fields (for size and pups).

@mcab
Copy link
Owner Author

mcab commented Feb 26, 2019

firefox_2019-02-26_13_ssersbwl

  • Added help text for each field (hard-coded per model seems wrong, but I don't see a better solution, unless we use a snippet for each help_text or something. That's overkill.)
  • Added better selector for habits / risk / risk scope

Decided that a risk per risk scope would require a bit more robust selection + modeling, and probably out of scope for now.

Habits was actually right. I don't know what I said when thinking it should be "habitat patterns."

@mcab
Copy link
Owner Author

mcab commented Feb 26, 2019

Size is tricky. I think at this stage, we need to create another widget to allow for a specific step to be inserted, or some other solution.

@mcab mcab merged commit a8fe309 into develop Feb 26, 2019
@mcab mcab deleted the 4-create-bat-model branch February 26, 2019 18:32
@mcab mcab mentioned this pull request Feb 26, 2019
@mcab mcab self-assigned this Feb 26, 2019
@rc-li
Copy link
Collaborator

rc-li commented Feb 26, 2019

Might be a silly question, but I got error when trying to load this page on my end
image

what's the url for accessing this site?

mcab added a commit that referenced this pull request May 9, 2019
* Add Bat model

Include some fields that will be used to keep track of information about
bats. This includes migrations, and an admin interface to edit and add bats.

* Add psycopg2 dependency

Since we'll be using PostgreSQL as our main database driver, we need to
have the driver installed for it.

* Add ModelAdmin to INSTALLED_APPS

This lets us define custom admin pages based off of our models.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants