summaryrefslogtreecommitdiff
path: root/pgweb/docs/models.py
AgeCommit message (Collapse)Author
2021-05-19Improve admin preview for doc page redirectJonathan S. Katz
This presents the redirection in a legible format, instead of having to click into each list item to figure out what it is.
2020-07-03Fix typo in redirect_to help textMagnus Hagander
Interestingly enough, this showed up because the migration was out of sync. Normally this means the migration has not been updated, but in this case it appears the migration is correct and the actual model is incorrect. Yet both the model and the migraiton were introduced in commit e2120f0a.
2020-04-24Introduce documentation redirects for doc pages that are renamedJonathan S. Katz
The web documentation used to suffer from a problem that if a documentation page were renamed in a newer version, any references pointing to said documentation would be lost. For example, the feature known as "Default Roles" was renamed to "Privileged Roles" but caused a change in the URL. This patch introduces the ability to create a "DocPageRedirect" by specifying the previous name of the documentation page (e.g. "default-roles.html") and the new name (e.g. "privileged-roles.html") such that the continuity is preserved between versions.
2020-03-31Set on_delete=models.CASCADE on all ForeignKey fieldsMagnus Hagander
This is the bardware compatible value that will be needed once we upgrade django later.
2019-01-26Generic unicode updatesMagnus Hagander
2019-01-17Fix whitespace and indentation, per pep8Magnus Hagander
2019-01-17Tabs, meet your new overlords: spacesMagnus Hagander
In a quest to reach pep8, use spaces to indent rather than tabs.
2018-06-29Remove unused importsMagnus Hagander
2017-05-25Invent the concept of a docs page aliasMagnus Hagander
This allows us to say that "app-pgreceivexlog.html" is actually the same as "app-pgreceivewal.html" on a different version. Turns out the templates would already render this correctly if we could just find the map, so it's a simple case of adding an additional join (that the django orm can't figure out, but we can do it in manual sql). Adds a non-django managed unique index to make sure that it's not possible to add the same alias twice in different "directions". Violating this will cause a django excpetion in the admin interface since it doesn't know about it, but as this is a very uncommon operation and admin only, we don't care about that. Finally, we don't bother issuing varnish purges for changes here, the admin is expected to handle those manually. These changes are supposed to happen very seldom, and the contents are purged automatically when the docs are loaded anyway.
2017-05-19Invent the concept of a "numtree" for versionsMagnus Hagander
This property returns a single digit numbers for versions 10 and up (10, 11 etc), and keeps the two digit number for earlier (9.0, 9.1 etc).
2016-05-19Replace interactive docs with docs bug reportingMagnus Hagander
Per discussion from a long time ago, interactive docs aren't really working out. The majority of submissions are either support questions (which then get rejected because they cannot be answered in this context) or pointing out docs incorrectnesses (which should be submitted as a docs bug instead, so they can actually be fixed in the main documentation). Old references to /interactive/ will get redirected to /static/ automatically, and we expect to keep doing that for a long time (since there are many links to them around the net).
2016-05-14Fix model warnings and deprecationsMagnus Hagander
1. ForeignKey with unique -> OneToOneField 2. IPAddressField -> GenericIPAddressField 3. Fix fields with default=datetime.now() which gives server start time, not the insert time (clearly this default was never used, and the field was always explicitly set, but it should still not be incorrectly defined)
2016-03-07Get rid of PgModel, replacing it with simple signalsMagnus Hagander
We were already using signals for everything except delete, and even in our old version of django the delete signal exists (it didn't exist when this code was first written). Django doesn't really like models to be OOP like this, so keeping PgModel would cause issues with upcoming changes in django 1.8. Using simple functions is easier, and the actual functionality is replicated straight off.
2013-08-17Make an actual foreign key between docs versions and core versionsMagnus Hagander
This was originally not done because we had a lot of old legacy data that didn't have entries in both tables. This is no longer the case, and the docloads script already enforced that it couldn't happen again. Requires SQL: ALTER TABLE core_version ADD CONSTRAINT version_unique_tree UNIQUE(tree); ALTER TABLE docs ADD CONSTRAINT docs_version_fkey FOREIGN KEY (version) REFERENCES core_version(tree);
2012-06-05Show links to other versions of docsMagnus Hagander
Main patch from Marti Raudsepp, but with some fairly extensive changes
2011-06-14Remove print statement that cannot be used when running under a serverMagnus Hagander
2011-06-14Implement basic varnish purgingMagnus Hagander
This allows all models inherited from PgModel to specify which URLs to purge by either setting a field or defining a function called purge_urls, at which point they will be purged whenever the save signal is fired. Also implements a form under /admin/purge/ that allows for manual purging. This should probably be extended in the future to show the status of the pgq slaves, but that will come later. Includes a SQL function that posts the expires to a pgq queue. For a local deployment, this can be replaced with a simple void function to turn off varnish purging.
2010-03-21Add string output for doc commentMagnus Hagander
2010-01-16Add support for docs commentsMagnus Hagander
2009-09-14A first very basic import.Magnus Hagander
Contains basic functionality, and an import of most of the static content from the old site. There is still plenty more to do...