summaryrefslogtreecommitdiffstats
path: root/main/models.py
AgeCommit message (Collapse)AuthorFilesLines
2014-03-22Make filename and directory name fields accept longer valuesDan McGee1-2/+2
Signed-off-by: Dan McGee <dan@archlinux.org>
2013-11-26Capitalize URL properly in Django adminDan McGee1-1/+1
Signed-off-by: Dan McGee <dan@archlinux.org>
2013-11-26Merge branch 'cleaned-reqdby'Dan McGee1-3/+18
2013-11-11Filtered requiredby list for non-primary dependsDan McGee1-3/+18
For something like gambas3 which has a makedepend on postgresql, we end up getting every single split package listed in the required by list for postgresql. This is a bit crazy and unnecessary, so slim it down a bit when possible by using a slightly crazy groupby function and some smarts in our get_requiredby function. Signed-off-by: Dan McGee <dan@archlinux.org>
2013-11-07Drop old base64-ed PGP signature columnDan McGee1-1/+0
We've moved onto bytes only now. Signed-off-by: Dan McGee <dan@archlinux.org>
2013-11-07Move signature data from base64 string to bytes typeDan McGee1-7/+2
Signed-off-by: Dan McGee <dan@archlinux.org>
2013-11-07Add new `signature_bytes` field on package modelDan McGee1-3/+4
Now that we have a BinaryField option in Django 1.6, put it to use. Signed-off-by: Dan McGee <dan@archlinux.org>
2013-04-22Add 'required_signoffs' field to Arch modelDan McGee1-0/+2
This will indicate how many signoffs are required for packages of the given architecture. Set the default to 2 as it currently stands. Signed-off-by: Dan McGee <dan@archlinux.org>
2013-04-17Sort required by entries by dependency typeDan McGee1-2/+10
We were doing this for depends entries already, and we can do the same for required by entries via some absolutely awesome SQL query magic and injecting a few more things to our already crazy query. Signed-off-by: Dan McGee <dan@archlinux.org>
2013-04-17Various minor code cleanups and fixesDan McGee1-7/+5
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-14Remove cache_function decorator from a few spotsDan McGee1-4/+1
The benefit of these storage operations might be outweighed by the cost, especially given how infrequently these functions are called. Signed-off-by: Dan McGee <dan@archlinux.org>
2013-02-27Disable more @cache_function usageDan McGee1-2/+2
Seems the Django caching layer has changed quite a bit and is doing all sorts of funky s**t at this point. Yay for errors! Signed-off-by: Dan McGee <dan@archlinux.org>
2013-02-27Remove caching on reverse_conflictsDan McGee1-1/+1
We started seeing this in production with memcached usage and the upgrade to Django 1.5: PicklingError: Can't pickle <class 'devel.models.UserProfile_allowed_repos'>: attribute lookup devel.models.UserProfile_allowed_repos failed Without having time to investigate further, something changed, likely due to the whole user profile/configurable user model shenanigans done in Django 1.5. For now, simply don't cache this attribute to work around the problem. Signed-off-by: Dan McGee <dan@archlinux.org>
2013-02-09Change caching strategy on package.applicable_archesDan McGee1-4/+7
Rather than use the Django cache for this (aka memcached), just do it on a per-object instantiation basis. This means no external services calls except the first time to the database, which should be quite a bit faster. Signed-off-by: Dan McGee <dan@archlinux.org>
2013-02-09Revert "Reduce query count when retrieving satisfiers and providers"Dan McGee1-2/+2
This reverts commit 20b64e42672d185821cc584dfa4b133ee259a144. Django 1.5 fixed this issue and now parent objects are automatically attached to their children when queries go through the related manager. See "Caching of related model instances" in the release notes. Signed-off-by: Dan McGee <dan@archlinux.org>
2013-02-05Update exception to DeveloperKey.DoesNotExistDan McGee1-1/+1
We aren't looking up users; we are looking up developer keys. Signed-off-by: Dan McGee <dan@archlinux.org>
2013-02-03Use DeveloperKey model on package page and reportsDan McGee1-2/+4
This introduces the new model to the package page so subkey signings show up as attributed to the original developer. We also teach the mismatched signatures report to recognize all keys and subkeys of a given developer, cutting down on some of the bogus results. Signed-off-by: Dan McGee <dan@archlinux.org>
2013-01-20Fix error in get_requiredby() when checking providesDan McGee1-0/+1
The query refactor in commit 1b1b516bd removed a queryset I didn't realize was getting used elsewhere in the function. Signed-off-by: Dan McGee <dan@archlinux.org>
2013-01-20Query performance enhancements in get_requiredby()Dan McGee1-5/+6
For packages with particularly long lists of provides (e.g. perl), the query was getting a bit out of control with the list of names passed in. However, changing it to simply do a subquery resulted in some really poor planning by PostgreSQL. Doing this as a custom 'WHERE' clause utilizing the 'UNION ALL' SQL operator works very well. Signed-off-by: Dan McGee <dan@archlinux.org>
2012-12-31Minor coding style tweaksDan McGee1-1/+3
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-12-31Add 'created' field to packages modelDan McGee1-0/+3
This will be used to eventually implement the UI side of FS#13441, but to do that, we first need the data. Signed-off-by: Dan McGee <dan@archlinux.org>
2012-12-28Retrieve arch and repo too when calling reverse_conflictsDan McGee1-1/+1
Since we need these in the template for any details links, we might as well pull them back from the database in one query rather than three. Signed-off-by: Dan McGee <dan@archlinux.org>
2012-12-28Reduce query count when retrieving satisfiers and providersDan McGee1-2/+2
Django doesn't attach the parent object to the child objects, even when queried through the related manager. This causes up to 3 extra queries: one to retrieve the package again, and one each for arch and repo retrieval. For a package like archboot, this drops the number of necessary queries for the package page from 805 to 222 (yes, this is still too high) and cuts the time spent waiting on the database from 505ms to 262ms. Signed-off-by: Dan McGee <dan@archlinux.org>
2012-12-28Remove old todo list modelsDan McGee1-63/+0
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-12-05get_latest_by cleanupsDan McGee1-1/+1
Fix some that referenced non-existent attributes, and add the attribute to other models. Signed-off-by: Dan McGee <dan@archlinux.org>
2012-11-27Don't cache package properties as aggressivelyDan McGee1-3/+0
For package signatures, it turns out it is way cheaper to just parse the signature again rather than going though all the decorator and cache_function_key business. This speeds up the mismatched signatures report significantly once this is removed. For base_package, given that we only call it once from our package details template, it makes little sense to cache the result. Signed-off-by: Dan McGee <dan@archlinux.org>
2012-11-16Use python set comprehension syntax supported in 2.7Dan McGee1-1/+1
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-10-27Cleanup meta model attributesDan McGee1-3/+2
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-09-30Remote errant print() statementDan McGee1-1/+0
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-09-30PEP8 cleanups for main/modelsDan McGee1-0/+9
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-09-04Filter out spam flag requests on package details pageDan McGee1-1/+1
No need to show these as a matching request. Signed-off-by: Dan McGee <dan@archlinux.org>
2012-08-21Don't blow up when pgp signature data is '' on a packageDan McGee1-0/+2
We handled None/NULL correctly, but not the empty string. Fix this corner case. Signed-off-by: Dan McGee <dan@archlinux.org>
2012-08-21Mark nullable fields as blank on package modelDan McGee1-2/+2
This helps when creating test packages through the Django admin. Signed-off-by: Dan McGee <dan@archlinux.org>
2012-08-16Ensure reverse conflicts match architecture if applicableDan McGee1-0/+4
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-08-09Migrate flag request version info to new formatDan McGee1-2/+6
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-08-08Make use of new ctypes ALPM APIDan McGee1-7/+48
We can use this when filtering down lists of depends, required by, conflicts, etc. to ensure we are honoring the version specifications the same way pacman would. Signed-off-by: Dan McGee <dan@archlinux.org>
2012-08-07Add reverse conflicts to package detailsDan McGee1-0/+10
This is a place where calling vercmp could come in really handy. Signed-off-by: Dan McGee <dan@archlinux.org>
2012-08-05Smarter handling of multilib packages in "Versions Elsewhere"Dan McGee1-1/+9
We can do some manipulation of the pkgname to ensure multilib packages show up here, as well as showing the non-multilib versions in the list when viewing the multilib packages. Signed-off-by: Dan McGee <dan@archlinux.org>
2012-08-04Make adjustments for optional -> deptype conversionDan McGee1-2/+7
Very little dealt directly with this field. Signed-off-by: Dan McGee <dan@archlinux.org>
2012-07-31Update several bits and pieces for staging packagesDan McGee1-11/+24
This will prevent [staging] packages from cluttering normal user's view on the website, but allow us to still import everything from this repository for developer use. Signed-off-by: Dan McGee <dan@archlinux.org>
2012-07-25Remove custom utc_now() function, use django.utils.timezone.now()Dan McGee1-2/+3
This was around from the time when we handled timezones sanely and Django did not; now that we are on 1.4 we no longer need our own code to handle this. Signed-off-by: Dan McGee <dan@archlinux.org>
2012-05-19Drop old PackageDepend modelDan McGee1-71/+0
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-05-19Switch to usage of new Depend objectDan McGee1-3/+4
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-05-19Simplify get_best_satisfier and get_providersDan McGee1-27/+24
We always passed values in that came off the containing package object; we can access these directly in the methods themselves. Signed-off-by: Dan McGee <dan@archlinux.org>
2012-05-02Ensure order_by default value is cleared when using distinct()Dan McGee1-3/+4
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-04-22Add an index on packages last update columnDan McGee1-1/+1
Not sure why we don't have this already, given both the home page, the packages page when ordered by last update, and the generated feeds would see immediate benefit from it. Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-20UserProfile model and fields shuffleDan McGee1-56/+2
Move this model into the devel/ application, and move the PGPKeyField which is used only by these models into the application as well. This involves updating some old migrations along the way to ensure we don't reference a field class that no longer exists. Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-03Include category when linking to bug reportsDan McGee1-1/+1
Also change the default category to something legit. Signed-off-by: Dan McGee <dan@archlinux.org>
2012-03-26Rename 'packagedepend_set' attribute to 'depends'Dan McGee1-2/+2
We do this for every other related package attribute, so do it here too. Signed-off-by: Dan McGee <dan@archlinux.org>
2012-03-24Revert "Add some dev dashboard info regarding signed package count"Dan McGee1-4/+0
This reverts commit 797185faed0555efb88a1e6a18e447548a9935fd. Now that all packages in the Arch repos are signed, this column isn't very useful as it just reflects the total package count. Conflicts: packages/views.py -> packages/views/search.py Signed-off-by: Dan McGee <dan@archlinux.org>