-
byI got locations saving to notes properly. Next up allowing you to update locations when editing an entry. When saving I initially ran into the following error:
spatalite no such function: lwgeom_version
The issue was that Django's PointField default projection is 4326, which is used for spherical references e.g. Google Earth. However, I'm displaying a flat service (an OSM Map), which uses a different projection 3857.Β I fixed this by changing my database to match my most common display.from django.contrib.gis.db import models as geo_models ... point = geo_models.PointField(geography=True, srid=3857)
-
byFirst steps in displaying location in the Tanzawa admin interface. Default point is Mount Tonodake in the Tanzawa mountain range. Still using the default OSM map included with GeoDjango.
I imagine this will be a Leaflet powered map in the end. I've got a couple of different ideas surrounding the location interface:- 1. I'm probably not going to display the full address form and instead have a single unified search form + map when no location is set.
- 2. Once an address is set, I may show it in plain text below the map. Perhaps there with an "edit" link to manually override the address for whatever reason.
- 3. I'll probably do an initial release as-is (using OSM) and then focus one of my later sprints on really polishing the mapping interface.
-
byHandling "related" data about an entry is proving to be a bit more difficult than anticipated. It could be the way I've chosen to validate data. For my micropub endpoint I'm using DRF for request validation and then transform and pass that data to the Django Form I use when posting with the admin interface. The Django Form is important because it's where I prepare the actual records that get saved into the database.
Handling this complex data with DRF in micropub feels natural β mostly because DRF Serializers handle nested data natively and microformat data is nested. Django Forms are made for regular forms (single level) and don't handle nested data.
Flattening all nested "related" data (like locations) and putting it into a single form isn't a good long-term solution. That said, I do flatten nested data for content as it's required to create an entry. However using both Forms (for base entry data) and DRF serializers (for related data) in both my admin views and micropub endpoint seems like a bad architecture as I'm mixing concerns.
Rather I think it's I need to start introducing Formsets for related data for my webforms. And then have my micropub endpoint continue doing what it's currently doing: sanity-check Β the request, transform it into format that matches my web form request, and then process as usual. This will also keep the data flowing aΒ single direction:
micrpub request: Micropub -> DRF -> Form Input -> Form -> DB
admin request: Form Input -> Form -> DB -
byStarted working on support for checkins (posted via backend micropub only) and adding locations to any post kind. I'm not sure how I'll expose adding a location to a post. One way would be get your current location. The other would be to let you just pick a point on a map. Or maybe default to your current location and let you adjust it?
Since my coordinates are all stored as a geo-django PointField, my hope is that it will allow me to create fun little apps on top of Tanzawa. "Make me a rollup of my checkins in Yokohama", "Show me my photos from Texas", and so forth. -
byAs you may be able to tell from the previous post I just launched Bookmark support in Tanzawa. I'm contemplating if I shouldn't add a dedicated "bookmarks" page that just makes a long list of bookmarks, but for now it's good enough.
I realized one of the hardest parts about microformatting your html is making sure you haven't broken it in some subtle way. Mine were broken. I added some tests that verify a) I fixed them and b) they won't get broken again. -
byI've got bookmarks working - it's been mostly a copy/paste of the reply templates and generalizing the views to share as much as possible.
One thing I noticed was that while myΒ extract method works with sites with proper microformat or schema data - it doesn't work for sites without either. So tomorrow I'll modify it to default to the page title and then update that value based on parsed meta-data.Adding a bookmark in Tanzawa -
byAdded support for replies to my micropub endpoint today. Super simple. Adding support for bookmarks shouldn't take but a day or two as it's mostly the same as replies. Switching to Tanzawa is getting closer and closer.
-
byBreaking the admin into TurboFrames and it feels like I'm rewriting the entire app. It's a good opportunity to refactor templates and views, but man do I feel like a hamster running on a wheel while I figure out the implementation patterns.
-
byReworked my template a bit and it seems that comments are now coming through!
Reply from Tanzawa in moderation -
byI can now extract the reply data for microformat and schema.org schemas when I reply. Editing and RSS is also working nicely as well. I'm sending webmentions, but I think my template needs some tweaking as the comment is coming through.
Mixing Turbo (for replies) and regular page loads (for status/articles) is starting to show it's limits. I think after I get replies shipped, I need to step back and refactor my admin template to go full-in with Turbo.