Every repository with this icon (
Every repository with this icon (
Home
Hello!
Here are the interesting things in the nameremoved source code:
the Link Registry
Flatpages, their navigation tool and their use in the Link Registry
the Bonjour command
Chunks
/nameremoved/chunks/
There’s a static copy of the django-chunks app that I’m using. I couldn’t figure out how to link a living svn copy into a git archive or whatever I don’t get it yet and git still kind of makes my head hurt.
Uploading comics as DATE-slug.extension
/nameremoved/comics/models.py:upload_to()
I’m using the fancy custom upload_to() you can do in Django 1.0 … in this case, comics upload to comics/YEAR-MONTH-DAY-slug-of-title-field.extension which I think even covers the “overwrites old files” behaviour I want but maybe not. I should really be testing this stuff.
Sequence field in comics that auto-updates
/nameremoved/comics/models.py:update_comic_sequence()
In post_save I go through every comic and update the Sequence field. This makes doing a loaddata kind of excruciating but
wow does it make looking up individual comics a lot easier.
Storylines in the comics
/nameremoved/comics/models.py:Comic:starts_storyline
Storylines are defined as extra fields (almost always Null and Blank) that the archive page detects to start a new processing loop. I could probably also make a “jump to start of storyline” box pretty easily with a Comic.comics.public().filter(starts_storyline=True)…
Contributions and Contributors (and the Report)
/nameremoved/contributions/templates/admin/contributions/report.html
Contributions are when people other than me help with a comic, either by suggesting the story or drawing it or whatever. A contribution has an extra footer in the admin change_form.html where listed are the comics associated with it. There’s also a special report of “suggestion” type Contributions that haven’t been used yet. I like to look at that and think hard about what to draw next.
Contributors are people who have made repeated or notable contributions to the comic, they get a special section on the Contribution page.
Memcache status view
/nameremoved/utils/mstat.py
I stole this, no, borrowed this, from Fredrik Lundh … it would be nice to have an even fancier view and I wish I could see the list of keys but whatever.
Ha ha it was broken until I changed the name of the file to mstat.py from memcache.py because it was stomping on the memcache module.
sqldebug and other tools
sqldebug
/nameremoved/utils/context/sqldebug.py
The sqldebug code I use is straight from Django Snippets but I use {{ if sqldebug }} for all my debug template stuff since I can never be bothered to set my INTERNAL_IPS setting.
This is important because I run ads on the site and have the google analytics bug, neither of which should be loading while I’m in debug mode.
localsettings template
/nameremoved/localsettings.py.template
This is the best way I’ve seen to do the settings on multiple systems.
render with request
/nameremoved/utils/__init__.py:render_with_request()
This is the standard render_to_response but with a RequestContext that everyone has to write because who knows why it’s not built in.
flatpages get MEDIA_URL
/nameremoved/utils/templatetags/flatpage.py:media_url()
Another thing borrowed from Django Snippets . This just does a replace on {{ MEDIA_URL }} inside flatpage content.
THAT’S ALL
There is nothing else interesting about the code.







