Commit Graph

107 Commits

Author SHA1 Message Date
Dan McGee
ee6002c911 Django 1.6 upgrade, deprecation cleanup
PendingDeprecationWarning: commit_on_success is deprecated in favor of atomic.

Signed-off-by: Dan McGee <dan@archlinux.org>
2013-11-06 21:17:27 -06:00
Dan McGee
dad70d0d7c Add a 'last touched by' column to todolist detail view
This allows you to see very easily who last manipulated a package
todolist item in case you have a need to know.

Signed-off-by: Dan McGee <dan@archlinux.org>
2013-05-10 18:44:25 -05:00
Dan McGee
b7b2474064 Various minor code cleanups and fixes
Most of these were suggested by PyCharm, and include everything from
little syntax issues and other bad smells to dead or bad code.

Signed-off-by: Dan McGee <dan@archlinux.org>
2013-04-16 22:12:01 -05:00
Dan McGee
64da94fbc9 Only show incomplete todolists to unauthenticated users
Signed-off-by: Dan McGee <dan@archlinux.org>
2013-03-11 18:55:39 -05:00
Dan McGee
6172b6dd09 Make todolists fully public
Remove the login_required decorator from the index and detail views to
allow everyone to see the same thing. Of course, when I say "same" here,
unauthenticated users don't see the same links developers do to mark
packages complete and incomplete.

Signed-off-by: Dan McGee <dan@archlinux.org>
2013-03-11 18:48:31 -05:00
Dan McGee
00b9084303 Remove public todolists view
Replace this with a redirect to the developer todolist index page.

Signed-off-by: Dan McGee <dan@archlinux.org>
2013-03-11 18:24:56 -05:00
Dan McGee
7a5b06c3e7 Fix IntegrityError in corner case todolist update
We were seeing this in production:

    IntegrityError: duplicate key value violates unique constraint "todolists_todolistpackage_todolist_id_700d1b623414814c_uniq"
    DETAIL:  Key (todolist_id, pkgname, arch_id)=(206, ruby-cairo, 2) already exists.

This is due to a corner case where a package was originally on a
todolist and the underlying package object disappeared, so the todolist
entry was unlinked and pkg_id set to NULL. Later, this package came
back, but our get_or_create tried to create an object that violated our
unique constraint because of the missing pkg_id.

Call get_or_create with the minimum necessary bits to find the todolist
package object, and pass the rest of the values via defaults to avoid
this problem. Additionally, relink any todolist entries up to a package
in the repositories if one is available.

Signed-off-by: Dan McGee <dan@archlinux.org>
2013-03-07 16:16:58 -06:00
Dan McGee
f85cc0482a Merge branch 'django-1.5'
Conflicts:
	requirements.txt
	requirements_prod.txt
2013-02-26 18:45:14 -06:00
Dan McGee
5566d43a77 Use 'update_fields' model.save() kwarg
This was added in Django 1.5 and allows saving only a subset of a
model's fields. It makes sense in a few cases to utilize it.

Signed-off-by: Dan McGee <dan@archlinux.org>
2013-02-09 16:50:45 -06:00
Dan McGee
ca4106a7c0 Ensure todolists are consistently sorted
This is for the public view page; we had no order_by() call so lists
could be displayed in seemingly random order.

Signed-off-by: Dan McGee <dan@archlinux.org>
2013-02-08 22:17:02 -06:00
Dan McGee
e9e1c07165 Show staging version on todolist view page
If one exists, it is easy enough to show it here so in-progress
todolists can easily be cross-checked with the current state of the
repository.

Signed-off-by: Dan McGee <dan@archlinux.org>
2013-01-22 16:47:43 -06:00
Dan McGee
f106379b53 Clean up and make several migrations modern
This moves most migrations to the v2 format that have been presenting
some issues. One missing depends_on relationship has been added, and we
allow an index to not be dropped if it does not exist due to the
shittyness in sqlite3 actually keeping indexes across DDL on that table.

Signed-off-by: Dan McGee <dan@archlinux.org>
2013-01-15 21:29:30 -06:00
Dan McGee
66850026ca Use content_type and not mimetype on HttpResponse()
Bug #16519 in Django deprecates mimetype, so update our code
accordingly.

Signed-off-by: Dan McGee <dan@archlinux.org>
2013-01-13 22:34:33 -06:00
Dan McGee
6fe28b4206 Add last_modified field to todolist packages
Signed-off-by: Dan McGee <dan@archlinux.org>
2013-01-12 16:33:31 -06:00
Dan McGee
eea59cd12b Set user on todolist packages when flag status changes
This will allow us to see who last changed the status of a todolist
item.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-12-31 11:36:29 -06:00
Dan McGee
7952fe0ede Mark todolist packages as removed rather than deleting them
This makes it easier to see the progression of a todolist and its
contents easier since we are no longer losing the data.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-12-31 11:31:35 -06:00
Dan McGee
827b426b4d Fix list_pkgbases view call
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-12-31 11:04:41 -06:00
Dan McGee
95394bc4fa Fix dependency issue found by south migrationcheck command
Due to pgp_signature being added to the Package model, we need to depend
on this later change as well.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-12-31 10:28:43 -06:00
Dan McGee
c37fe10728 Minor coding style tweaks
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-12-31 10:24:21 -06:00
Dan McGee
5a09e335ae Add 'removed' field to todolist packages
This will be utilized to soft-delete items from the list if the packages
are modified, rather than deleting them outright.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-12-31 09:52:28 -06:00
Dan McGee
58a4ecb0ba Small admin tweaks for todolists filtering
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-12-31 09:42:06 -06:00
Dan McGee
39a603bf65 Defer the 'raw' field when listing todolists
A lot like skipping fetching of the news content; we definitely don't
need this just to list the todolists on index pages.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-12-29 12:26:50 -06:00
Dan McGee
ee507a5b81 Add a todolist package details link template tag
Given the way we retrieve certain related objects, it makes more sense
to use a custom tag here rather than our generic package details link
tag. When viewing a large todolist, this saves significantly on the
number of queries we need to build the page.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-12-28 14:48:29 -06:00
Dan McGee
29be1e0603 Set slug on todolist creation
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-12-28 14:48:29 -06:00
Dan McGee
0c94cc4465 Use todolist slugs for all URLs
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-12-28 14:48:29 -06:00
Dan McGee
1dc6b867f4 Populate the todolist slug field and mark non-null
This is ripped off from commit 7c92ddbd3c when we added slugs to
News objects.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-12-28 14:48:29 -06:00
Dan McGee
46a51a99cc Add todolists slug field
This will be used to make more descriptive URLs for our todolists. The
`null=True` bit will be removed once a data migration is added to add
slugs to all previously created todolists.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-12-28 14:48:29 -06:00
Dan McGee
2ff967c3d9 Todolist URLs map to old_id now, not id
This is a short-term fix before adding a slug field to todo lists as we
did to news a while back.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-12-28 14:48:29 -06:00
Dan McGee
c8ece67cec Convert to using new todolist models everywhere
This is a rather widespread set of changes converting usage to the new
todo list and todo list package model recently introduced. The data
migration is not included in this commit. After this commit, the old
model should no longer be referenced anywhere.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-12-28 14:48:29 -06:00
Dan McGee
c7658ca4cd Add data migration for todolists
This moves the data from the old models into the new ones. Note that IDs
are not preserved across the move, but we do store the old ID in the
old_id column so we don't break every link out there.

Links will become slugs in a future commit, so there should be no
ambiguity when linking via number vs string.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-12-28 09:20:18 -06:00
Dan McGee
f07a5862c9 Add packages method to new Todolist model
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-12-28 09:19:19 -06:00
Dan McGee
f167d6e6e8 Add todolist admin for new model
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-12-28 09:19:19 -06:00
Dan McGee
8be27a5caf Add new todolists and todolist package model
Move the todolist model from main to the todolists application, and make
a few minor tweaks to field names along the way. Also add a 'raw' field
that will hold the originally input text data from the creator or last
modifier of the todolist.

Add pkgname, pkgbase, arch, and repo fields to a new todolist package
model, which will supplement the former foreign key to an actual package
object. This will prevent todolist package objects from ever being
deleted as they can be now, which is not intuitive.

Also change the current boolean 'complete' flag to a 'status' enum that
can hold other values. For now, we add 'In-progress' to the mix.

Finally, add a 'user' field, and a 'comments' field that will be
utilized later by the UI.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-12-28 09:19:17 -06:00
Dan McGee
e761db4cc5 Add initial todolists models migration
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-12-27 19:59:59 -06:00
Dan McGee
160a08bba5 Improve performance of todolists query
Use some standard SQL and split the query into two different parts to
save a lot of unnecessary sorting and field retrieval at the database
level. The `CASE WHEN complete THEN 1 ELSE 0 END` syntax should be
accepted by any database that implements proper SQL; it was tested in
PostgreSQL and sqlite3 without issues.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-11-20 18:17:48 -06:00
Dan McGee
9e9157d0a8 Use python set comprehension syntax supported in 2.7
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-11-16 16:37:53 -06:00
Dan McGee
c1a6a87e23 Add arch and repo filter to todolist packages
This matches what we do on signoffs. Also beef up the styling a bit and
add the dynamically updated package count info.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-07-25 00:45:36 -05:00
Dan McGee
76c37ce3ac Replace deprecated direct_to_template() with render() shortcut
Now that Django actually provides a concise way to use a RequestContext
object without instantiating it, we can use that rather than the old
function-based generic view that worked well to do the same.
Additionally, these function-based generic views will be gone in Django
1.5, so might as well make the move now.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-07-24 19:57:20 -05:00
Dan McGee
5b176fc672 Add blank description to todo list creation and editing
This is a field shown on the general_form.html, and shows up as
@@@INVALID@@@ in development environments.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-07-23 21:48:26 -05:00
Dan McGee
a5f5557493 Use python json module directly in place of simplejson
As of Python 2.6, this is a builtin module that has all the same
functions and capabilities of the Django simplejson module. Additionally
simplejson is deprecated in the upcoming Django 1.5 release.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-05-12 09:32:30 -05:00
Dan McGee
badc535aeb Ensure order_by default value is cleared when using distinct()
Otherwise the queryset returns nonsensical results. I find the design of
this less than obvious but so be it; we can ensure the results work
regardless of a default ordering on the model.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-05-02 09:37:46 -05:00
Dan McGee
dc94eade03 Incomplete-only todolists optimization
We can push this down to the database if we know in advance we only need
the incomplete lists. This helps our call on the developer dashboard
quite a bit; the time of the single query in question drops from >1300ms
to around 40ms.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-27 09:12:26 -05:00
Dan McGee
9684e7c095 Prevent selection of many useless fields when getting todolists
This is a bit of a hack, but makes the resulting resultset returned from
the database a lot smaller and kills off all the columns we don't care
about and would never look at.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-07 14:55:07 -05:00
Dan McGee
b8c20439c0 Change Django urls.py import
Until Django 1.3, the functions include(), patterns() and url() plus
handler404, handler500 were located in a django.conf.urls.defaults
module.

In Django 1.4, they live in django.conf.urls.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-03-23 19:54:40 -05:00
Dan McGee
6b16b9487a Adjust page and content caching lengths and decorators
Remove never_cache from many places now that we don't actually need it
since we aren't caching by default. Adjust our cache_function decorator
times be shorter values, and also randomize them a bit to make cache
invalidations not all line up.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-01-05 13:03:00 -06:00
Dan McGee
7b7dcfaa7c Add new todolist pkgbase list view
This is for use after rebuilds when moving packages out of the staging
and testing repositories.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-01-04 12:15:29 -06:00
Dan McGee
0db2830b8f Make maintainer lookup on todo lists fast
This is rather sick to look at. Sorry, Django gives me no other choice.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-03 23:30:16 -05:00
Dan McGee
8f3c60c8de Don't include staging packages in todolists
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-23 20:27:21 -05:00
Dan McGee
bf4d344c18 Fix missed list -> todolist variable rename
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-05-04 12:54:14 -05:00
Dan McGee
064813560c Show more info about todolists on developer dashboard
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-09 16:34:10 -05:00