Add missing if
When generating the index page, the `stationId` variable is set when a user has requested a specific station. It shouldn't write out a value when a station isn't requested. This if should have been included in 116234d but I forgot it.
Add a management command to update cached data
This management command can be used to update data received from the API. It calls the `_get_from_cache_or_remote()` method directly, passing it `True` for `ignore_cache`. It is important that this command is updated to reflect not only new API calls, but changes to the aforementioned method as well.
Add pretty URLs
A station can now be loaded by going to `/player/[SLUG]/`. This will take priority over the `station_id` query var.
Remove unnecessary parameters to HttpResponse objects
`HttpResponse` objects use 200 as the default `status_code`. Therefore there is no reason to manually set it as well.
Also, `mimetype` is a legacy parameter; `content_type` is the proper one to use.
Additionally I am renaming the response object to `response` from `req` (request?).
Add ability to force API client to refetch data from the remote
When the `ignore_cache` parameter is set to `True`, the cache check will be skipped and the data will be refetched from the API. Just as before, the result will be cached for an hour.
Currently there is no protection against repeated calls when there is no response or result to cache.
Since I was adding a new parameter to the `_get_from_cache_or_remote` method, I decided to rename `attr` to `action` as this seemed to fit with the API terminology a little better. I also elected to improve the method's docstring to better document the parameters.
Add support for openredis
Unfortunately this service is still in private beta so I haven't tested been able to test it yet. According to the Heroku Dev Center documentation, though, the config setting will be called `OPENREDIS_URL`.
The existing tests are much improved now as they should all handle setting, unsetting, and restoring all environment variables as needed.
Add station types to client API
The `API.get_station_types()` method will fetch the list of station types from the API and cache the result for an hour.
As of this change, `get_cached_data()` is no longer needed.
Add _get_from_cache_or_remote method to client API
It appears that there will be a lot of repetition in the methods contained in the client API wrapper class. The `get_from_cache_or_remote()` method can contain all of the smarts and allow each individual method just to wrap it.
Remove unnecessary guide HTML
When the player page renders, HTML for the guide is rendered but is always replaced by the `get_guide_html` view. Also, since stations are no longer passed in through the context, they wouldn't print out anyway.
Add station to API client
The `API.get_station()` method will fetch an individual station by ID or by slug (ID takes precedence) from the API and cache the result for an hour.
Update guide view for API structure change
The station data being returned from Wally now includes station type and format as just the name. Previously it had been returning all data associated with the data models associated with each.
Remove select_related for ManyToMany field
The `ActiveShow` module contains a `ManyToManyField`. As @krolique was quick to point in, `select_related()` performs much better with foreign keys than it does with many-to-manys.
Very beginning of the user system
The login form is being added here. While it will report form validation errors, there is no actual login functionality yet, so it will report success just by filling in the fields.
Restructure base template
By adding blocks to the `body_content` block, templates can control separate areas of the page. By doing this, the top nag can be included on every page from the base template.
Add placeholders for group and space sign up pages
Unfortunately I upgraded to Mountain Lion and didn't think to install the new Xcode at the time. Now I can't use Pip yet (to begin using WTF). These are placeholder views and templates to get ready for building them out.
Fix border radius
The definition of the `border-radius` property for the primary home page buttons was overridden by default Bootstrap styles. It takes precedence if it's placed within the `.group-main .btn` declarations.
After making this change, the `font` property is left alone. By moving it along with `border-radius`, the `.btn-huge` declaration is no longer needed and can be removed completely.
Add Bootstrap mixing source file
In order to be able to include any of the Twitter Bootstrap mixins, the source file is needed. I'm not sure if others will be needed, but for now I'm just adding this one.
The version is 2.0.4.
Hide station grid's immediate children
Clean up README, part deux
GitHub-flavored Markdown treats continuous code blocks as one, regardless of how much whitespace is placed in between. This change makes things look better visually when viewing on GitHub.
This is an annoying commit
I cannot pull changes from the remote or change branches locally because these two files have Windows line endings and my system keeps replacing them with proper line endings.
This should be fun. WHEEEEE!!!!!!
Alphabetize formats and locations
When displaying station groupings in the guide, it's much better if the groupings are listed alphabetically. To do this, stations are grouped using dictionaries. The dictionaries are then converted to lists. Finally the Django template tag `dictsort` is used to sort the groupings alphabetically for display.
Change all resources to use select_related()
When fetching a list of 182 stations, 9,989 reads are done from the cache. That's way too many. The problem is that Tastypie makes a bunch of individual queries due to the behavior of the Django ORM. By using `selected_related()` for all querysets, This number will hopefully reduce significantly.
Add formats and locations to station guide
A list of stations by location is also being added to the guide. A location is defined as "City Name, State."
Revise up next logic
The previous version of the logic used for up next guests had a problem when all guests were exhausted. A `IndexError` would be raised. This new version uses a generator expression which will not only fix the error, but would also be a little more efficient as only the documents needed for processing will be loaded from the cursor. Previously the results had to be converted to a `list`.
Rename contenttype module in API to content_types
With the change of name from `cbs.contenttypes` to `cbs.content_types`, the API module should be renamed to match (plus it should have been named `contenttypes` originally).
Add backend for integrated S3 with Django's cached storage
Django's cached storage backend doesn't work with S3. django-storage's S3 backend doesn't work with cached storage. `cbs.common.backends.storage.S3CachedStorage` combines django-storage's S3 backend with Django's caches storage mixing. This will allow us to combine both, getting cache busting behavior for static assets.
Add support for overriding secure URLs for production S3 URLs
If a custom domain is set, we might want to avoid using https for URLs because the SSL certificate will present itself as cloudfront.net when using CloudFront as the CDN.