Commit Graph

41 Commits

Author SHA1 Message Date
Dan McGee
71e57570c2 Pylint suggested and other cleanups
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-11 19:29:15 -05:00
Dan McGee
6fe08cd689 Utilize Django 1.3 'on_delete' feature on several foreign keys
The most important one here is PROTECT to keep people from making
bone-headed plays and deleting an Arch or Repo and every package along
with it. We can use this in a few other places, as well as some
carefully placed SET_NULL indicators.

Note that nothing here pushes deletion responsibilities down to the
database, although that will probably happen in a future commit.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-07 17:04:00 -05:00
Dan McGee
77842a6c76 Consolidate caching black magic
Get the stuff used to retrieve and refresh the latest date values all in
the same place, and make it a bit more beautiful by refactoring it all
into a common set of methods.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-07 17:03:13 -05:00
Dan McGee
d766595965 Add some migrations to convert database to UTC time
This follows the earlier commit where we make sure any value going to or
being pulled from the database is UTC.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-07 17:03:06 -05:00
Dan McGee
01db07bad8 Use UTC datetime objects everywhere
Rather than the twisted mix of local times and UTC times we currently have.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-07 17:03:00 -05:00
Dan McGee
9f4902f9c9 Ensure feed GUIDs are unchanging and unique
Implement 'tag:' style URIs for the GUID field on our RSS feeds. This
ensures new package updates show up as new, and we aren't jumping back
and forth between generated GUIDs having 'http://' and 'https://'
prefixes.

Much of the work here is to attempt to keep old news GUIDs constant so
we don't once again make everything show up as new in newsreaders.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-07 17:01:16 -05:00
Dan McGee
b66f11dedf Clean up news redirect argument
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-14 23:49:17 -06:00
Dan McGee
176d161902 Fix old news URLs not redirecting properly
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-10 14:43:32 -06:00
Dan McGee
c18cd21e53 Remove automatic ID column definitions
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-08 11:49:37 -06:00
Dan McGee
080278adea Move news urls into own file
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-13 14:44:07 -06:00
Dan McGee
97d1e4164b Connect post_save signals where they will always be triggered
We need to do this in the models.py files, otherwise the post_save signal
might not be connected right away on launch of the application. Move them
over there, add a dispatch_uid so it only gets hooked up once, and do some
other function moving around so we don't have circular imports.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-13 18:11:28 -05:00
Dan McGee
7def999b0a Fix migration dependencies exposed after moving models
When we moved some models from one app to another, we didn't do anything to
ensure the tables were created at all initially. Enforce this by adding the
minimal required dependencies- those migrations in the 'main' model that
last touched the involved models moving between apps.

Noticed-by: Angel Velasquez <angvp@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-29 15:16:39 -05:00
Dan McGee
1b6cf5261c Auto-populate slug on news item creation
And make sure it is unique through a few queries and some magic.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-21 09:10:02 -05:00
Dan McGee
41dc37c812 Update news views to use slug instead of ID
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-21 09:10:02 -05:00
Dan McGee
7c92ddbd3c Add migrations to populate the news slug and make it non-null
These should get us all set to have more useful URLs for the news items.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-21 09:10:02 -05:00
Dan McGee
190d0fc154 Add news slug field
Initially, this needs to allow null so that we can add in slugs for all of
our old news items.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-21 09:09:01 -05:00
Dan McGee
a288066faf Update news permission required string
When moving the news model and updating the content type, I forgot to update
these strings to reflect the new permission name. Whoops.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-20 10:33:31 -05:00
Dan McGee
8a3bd1ad8a Spruce up news admin view
Add last modified date as a column, and fix up some other small display,
sorting, and ordering issues.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-15 09:04:00 -05:00
Dan McGee
1a18ca4771 Add last modified date to news
This will come in handy when determining whether resources are out of date,
such as our news RSS feed. Also bump the Date fields to DateTime fields for
sake of sorting and if we have more than one news item on the same date.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-14 17:39:17 -05:00
Dan McGee
f8b5f0c4ae Show news in admin
And be able to do filtering/sorting/etc. with it.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-08 08:07:33 -05:00
Dan McGee
8117e9b877 Paginate the news list view
This view was getting huge with ~500 items on it, and most people are not
really interested in seeing every single news item. Use the drop in
pagination and add some controls that still allow browsing to any page of
the list.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-08 00:46:08 -05:00
Dan McGee
f637a1eb67 Move news model to an appropriate place
Never would have guessed it should actually be in news/models.py.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-08 00:23:55 -05:00
Dan McGee
4e193afcea Put news under south control
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-08 00:15:30 -05:00
Dan McGee
872af225a9 Use direct_to_template in all remaining possible places
Rather than the need to include RequestContext() calls directly, we can
just use direct_to_template to do all the work for us.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-03 13:45:13 -05:00
Dan McGee
ad162d74db Format all news items using markdown
Implements FS#13741. A preview function is also added so working with news
items is easier to make sure you get the formatting right.

This will result in some older news items looking a bit weird if they didn't
put linebreaks in all the right places, we can fix a few of these as we
notice them.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-07-06 20:16:10 -05:00
Dan McGee
41a5d1d566 Defer loading news content when listing news items
No need to pull back some 500 news articles when we just want the basics of
title, date, and author. Speaking of author, we might as well load that at
the same time too.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-07-02 20:37:06 -05:00
Dan McGee
081ed6c866 Add 'never_cache' decorator in a bunch of places
Now that we cache everything, we need to ensure anyone doing edits and
such gets the live data and not some cached version that was already
updated and is now stale. Add the never_cache decorator to any of the
CUD screens as well as a few others that might benefit from always being
regenerated.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-22 12:09:22 -05:00
Dan McGee
67f6bc546e Remove AutoUserMiddleware
This was having some serious effects on caching as we would always have to
access the user in the session, marking every page with a "Vary: Cookie"
header. This is the start of stamping that out. The way we get the user for
news item creation is now more similar to that from the todo lists, but not
quite. That should be adjusted to be more like the news item creation.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-20 23:31:34 -05:00
Dan McGee
548ed9dc75 News: make add/edit page form larger
Make both the title entry and the text area a lot larger so it is easier to
add and edit news items from the developer side.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-02-17 22:22:21 -06:00
Dan McGee
d709604102 Remove archweb prefix from all imports
Unnecessary, and lets us standardize on not using it everywhere.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-02-10 00:29:27 -06:00
Ismael Carnales
48904e4857 modified import paths from archweb_dev to archweb 2009-11-09 22:24:34 -02:00
Dusty Phillips
7d8feb3370 drop some unused imports 2008-10-05 21:41:08 -04:00
Dusty Phillips
a00f85e133 port news to django 1.0 using generic views 2008-10-05 21:06:00 -04:00
Dusty Phillips
65e45d5f69 fix permission bug on news 2008-07-30 12:59:09 -04:00
Dusty Phillips
c1d28bce33 use a nicer decorator 2008-06-27 16:50:01 -04:00
eliott
9b7b512254 Moved models around 2008-03-08 00:13:41 -08:00
eliott
89659cef5f Removed import no longer used. 2007-12-29 16:53:03 -08:00
eliott
3e297efad8 Massive retab fest.
Also added vim command comment to the end of files.
2007-12-29 16:42:55 -08:00
eliott
15ceff77fe Modified render_template and renamed it to render_response (consistent with
archweb_pub conventions).
Moved pkgmaint_guide to a template.
2007-12-29 15:34:02 -08:00
eliott
bd9a99d791 renamed imports 2007-12-22 16:21:21 -05:00
eliott
39a548fd26 Initial import for public release...
Special Note
  Prior to git import, approx 90% of the code was done by Judd Vinet. Thanks Judd!
2007-11-03 03:45:10 -04:00