-
byMapping is coming along nicely. Today I got markers to move by clicking the map, serializing changes to geo-json for saving, and integrated leaflet-geosearch.Β
Next I'd like to automatically fill in the address when available, but in order to do so, I must first normalize the Nominatim addressdetail response to match up with my fields.A look at moving and searching for locations -
byΒ After making it so I can update my location for an entry, I started to integrate Leaflet, rather than use the default GeoDjango OSM widget. It's my first time working with Leaflet, so it's a bit slow going.
I've managed to get basic display of the map working as well as clicking to move the point. I think if I can get the point to be powered by some GeoJSON in a hidden textarea, I should be able to once again set and update locations on entries.Leaflet in Tanzawa -
The Week #35
by- The biggest thing to happen this week was Leo graduating from from the "higkari-gumi" at his pre-pre-school. I couldn't attend, but saw a small video. He was so proud of himself. He got a cool medal, a hat, and a certificate that we've framed. He starts pre-school full-time at the same school next month β he's so ready for it. My only concern is keeping his english ability when he's playing in Japanese all day. His output in English is already "behind" that of his Japanese (as expected, since we live in Japan) β I just hope it just doesn't regress.
- We're finally back down to double-digit covid cases in Kanagawa again. We haven't been in this range since probably November or December. We're not out of the woods yet, but starting to see light at the end of the tunnel. If only they could speed up the vaccinations here, they're off to a snail pace.
- In my entire life I've owned 3 suits. 2 suits I got when I first graduated from the Men's Warehouse and became way too big for me once I moved to Japan ( it's common for people to lose weight when they move to Japan because a combination of smaller portion sizes and taking trains/buses everywhere instead of driving). Those 2 suits fell apart almost immediately. The other suit I got as a replacement for my sister-in-law's wedding 11 or 12 years ago. The white shirt I bought with it was getting pretty gross so I went out and replaced them this week. I don't think I've ever owned this many dress shirts at a single time. Now I just need an occasion to wear them. (Even as a salaryman, I never wear a suit - even when going in to the office (which I haven't for over a year)).
- I'm starting to blog (even more) with Tanzawa. As it gets more feature complete it's easier for me to blog with it than it is Wordpress.
- Around a month ago I bought tanzawa.blog. It will be the home of the Tanzawa project (maybe hosting???) once it's ready for release general consumption. In the mean time, I've redirected tanzawa.blog to tanzawa.jamesvandyne.com
-
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. -
Response to
byHowever, itβs not just about raw size, but about an βethos of smallβ. Itβs caring about the users of your site: that your pages download fast, are easy to read, have interesting content, and donβt load scads of JavaScript for Google or Facebookβs trackers.
I bookmarked this post over on the Tanzawa blog, but I felt this post was worth a proper response on my regular blog.
Ben's thinking about the small web overlaps a lot with what I think: the small web is beautiful. Not just small size (so it's fast, uses less power and so forth), but as he says an "ethos of small". He expands to say we should use smaller images and fewer scripts. (Consistent, no-nonsense, efficient and lazy loading images were actually a major motivating factor for me starting Tanzawa)
While Ben extends this ethos of small about caring about your users - I feel it goes a step further than that.
An "ethos of small" is about respecting your readers. Respect that they may not be on the latest and greatest machine. Respect they might be on a limit Internet plan. Respect they might be running on battery. Respect their (and your) privacy.The small web is about "just enough". Just enough code. Just enough html/css/Javascript. Just enough infrastructure. We are the small web: Just enough.
-
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. -
π The small web is beautiful
byHowever, itβs not just about raw size, but about an βethos of smallβ. Itβs caring about the users of your site: that your pages download fast, are easy to read, have interesting content, and donβt load scads of JavaScript for Google or Facebookβs trackers.
Ben really hit the nail on the head with this one. The small web really lines up with my goals for Tanzawa β maybe this desire to return to a smaller, more independent web is part of a larger trend?