Remove django-shorturls with my own implementation, since it's incompatible with Django 2 and unmaintained
This commit is contained in:
parent
27e0cb9a34
commit
098284a617
18 changed files with 252 additions and 184 deletions
2
Pipfile
2
Pipfile
|
@ -34,7 +34,6 @@ xrd = "*"
|
|||
django-push = "*"
|
||||
pyyaml = "*"
|
||||
django-annoying = "*"
|
||||
django-shorturls = "*"
|
||||
accept-types = "*"
|
||||
django-analytical = "*"
|
||||
django-model-utils = "*"
|
||||
|
@ -47,6 +46,7 @@ hiredis = "*"
|
|||
django-cors-headers = "*"
|
||||
pytest-django = "*"
|
||||
"argon2-cffi" = "*"
|
||||
python-baseconv = "*"
|
||||
|
||||
|
||||
[dev-packages]
|
||||
|
|
297
Pipfile.lock
generated
297
Pipfile.lock
generated
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"_meta": {
|
||||
"hash": {
|
||||
"sha256": "81ebb49766d8eff61ba665dc794078637f5fc9980e59f6cb7038fa5d993c7a95"
|
||||
"sha256": "266f9ea66b0c2e5de023d3adbb665c72ad8260e22222a3db871eeab310ba5f8b"
|
||||
},
|
||||
"host-environment-markers": {
|
||||
"implementation_name": "cpython",
|
||||
|
@ -11,7 +11,7 @@
|
|||
"platform_python_implementation": "CPython",
|
||||
"platform_release": "17.5.0",
|
||||
"platform_system": "Darwin",
|
||||
"platform_version": "Darwin Kernel Version 17.5.0: Fri Jan 12 23:22:48 PST 2018; root:xnu-4570.50.243~12/RELEASE_X86_64",
|
||||
"platform_version": "Darwin Kernel Version 17.5.0: Mon Mar 5 22:58:50 PST 2018; root:xnu-4570.51.1~2/RELEASE_X86_64",
|
||||
"python_full_version": "3.6.4",
|
||||
"python_version": "3.6",
|
||||
"sys_platform": "darwin"
|
||||
|
@ -80,10 +80,10 @@
|
|||
},
|
||||
"bleach": {
|
||||
"hashes": [
|
||||
"sha256:cf567e7ed30ea5e05b31231d88ae170af1c5544758b9d7bebbc20590b7c30b1e",
|
||||
"sha256:38fc8cbebea4e787d8db55d6f324820c7f74362b70db9142c1ac7920452d1a19"
|
||||
"sha256:b8fa79e91f96c2c2cd9fd1f9eda906efb1b88b483048978ba62fef680e962b34",
|
||||
"sha256:eb7386f632349d10d9ce9d4a838b134d4731571851149f9cc2c05a9a837a9a44"
|
||||
],
|
||||
"version": "==2.1.2"
|
||||
"version": "==2.1.3"
|
||||
},
|
||||
"cachecontrol": {
|
||||
"hashes": [
|
||||
|
@ -100,35 +100,35 @@
|
|||
},
|
||||
"cffi": {
|
||||
"hashes": [
|
||||
"sha256:5d0d7023b72794ea847725680e2156d1d01bc698a9007fccce46d03c904fe093",
|
||||
"sha256:86903c0afab4a3390170aca61f753f5adad8ffff947030719ee44dedc5b68403",
|
||||
"sha256:7d35678a54da0d3f1bc30e3a58a232043753d57c691875b5a75e4e062793bc9a",
|
||||
"sha256:824cac33906be5c8e976f0d950924d88ec058989ef9cd2f77f5cd53cec417635",
|
||||
"sha256:6ca52651f6bd4b8647cb7dee15c82619de3e13490f8e0bc0620830a2245b51d1",
|
||||
"sha256:a183959a4b1e01d6172aeed356e2523ec8682596075aa6cf0003fe08da959a49",
|
||||
"sha256:9532c5bc0108bd0fe43c0eb3faa2ef98a2db60fc0d4019f106b88d46803dd663",
|
||||
"sha256:96652215ef328262b5f1d5647632bd342ac6b31dfbc495b21f1ab27cb06d621d",
|
||||
"sha256:6c99d19225e3135f6190a3bfce2a614cae8eaa5dcaf9e0705d4ccb79a3959a3f",
|
||||
"sha256:12cbf4c04c1ad07124bfc9e928c01e282feac9ec7dd72a18042d4fc56456289a",
|
||||
"sha256:69c37089ccf10692361c8d14dbf4138b00b46741ffe9628755054499f06ed548",
|
||||
"sha256:b8d1454ef627098dc76ccfd6211a08065e6f84efe3754d8d112049fec3768e71",
|
||||
"sha256:cd13f347235410c592f6e36395ee1c136a64b66534f10173bfa4df1dc88f47d0",
|
||||
"sha256:0640f12f04f257c4467075a804a4920a5d07ef91e11c525fc65d715c08231c81",
|
||||
"sha256:89a8d05b96bdeca8fdc89c5fa9469a357d30f6c066262e92c0c8d2e4d3c53cae",
|
||||
"sha256:a67c430a9bde73ae85b0c885fcf41b556760e42ea74c16dc70431a349989b448",
|
||||
"sha256:7a831170b621e98f45ed1d5758325be19619a593924127a0a47af9a72a117319",
|
||||
"sha256:796d0379102e6da5215acfcd20e8e69cca9d97309215b4ce088fe175b1c2f586",
|
||||
"sha256:0fe3b3d571543a4065059d1d3d6d39f4ca6da0f2207ad13547094522e32ead46",
|
||||
"sha256:678135090c311780382b1dd3f828f715583ea8a69687ed053c047d3cec6625d6",
|
||||
"sha256:f4992cd7b4c867f453d44c213ee29e8fd484cf81cfece4b6e836d0982b6fa1cf",
|
||||
"sha256:6d191fb20138fe1948727b20e7b96582b7b7e676135eabf72d910e10bf7bfa65",
|
||||
"sha256:ec208ca16e57904dd7f4c7568665f80b1f7eb7e3214be014560c28def219060d",
|
||||
"sha256:b3653644d6411bf4bd64c1f2ca3cb1b093f98c68439ade5cef328609bbfabf8c",
|
||||
"sha256:f4719d0bafc5f0a67b2ec432086d40f653840698d41fa6e9afa679403dea9d78",
|
||||
"sha256:87f837459c3c78d75cb4f5aadf08a7104db15e8c7618a5c732e60f252279c7a6",
|
||||
"sha256:df9083a992b17a28cd4251a3f5c879e0198bb26c9e808c4647e0a18739f1d11d"
|
||||
"sha256:1b0493c091a1898f1136e3f4f991a784437fac3673780ff9de3bcf46c80b6b50",
|
||||
"sha256:87f37fe5130574ff76c17cab61e7d2538a16f843bb7bca8ebbc4b12de3078596",
|
||||
"sha256:1553d1e99f035ace1c0544050622b7bc963374a00c467edafac50ad7bd276aef",
|
||||
"sha256:151b7eefd035c56b2b2e1eb9963c90c6302dc15fbd8c1c0a83a163ff2c7d7743",
|
||||
"sha256:edabd457cd23a02965166026fd9bfd196f4324fe6032e866d0f3bd0301cd486f",
|
||||
"sha256:ba5e697569f84b13640c9e193170e89c13c6244c24400fc57e88724ef610cd31",
|
||||
"sha256:79f9b6f7c46ae1f8ded75f68cf8ad50e5729ed4d590c74840471fc2823457d04",
|
||||
"sha256:b0f7d4a3df8f06cf49f9f121bead236e328074de6449866515cea4907bbc63d6",
|
||||
"sha256:4c91af6e967c2015729d3e69c2e51d92f9898c330d6a851bf8f121236f3defd3",
|
||||
"sha256:7a33145e04d44ce95bcd71e522b478d282ad0eafaf34fe1ec5bbd73e662f22b6",
|
||||
"sha256:95d5251e4b5ca00061f9d9f3d6fe537247e145a8524ae9fd30a2f8fbce993b5b",
|
||||
"sha256:b75110fb114fa366b29a027d0c9be3709579602ae111ff61674d28c93606acca",
|
||||
"sha256:ae5e35a2c189d397b91034642cb0eab0e346f776ec2eb44a49a459e6615d6e2e",
|
||||
"sha256:fdf1c1dc5bafc32bc5d08b054f94d659422b05aba244d6be4ddc1c72d9aa70fb",
|
||||
"sha256:9d1d3e63a4afdc29bd76ce6aa9d58c771cd1599fbba8cf5057e7860b203710dd",
|
||||
"sha256:be2a9b390f77fd7676d80bc3cdc4f8edb940d8c198ed2d8c0be1319018c778e1",
|
||||
"sha256:ed01918d545a38998bfa5902c7c00e0fee90e957ce036a4000a88e3fe2264917",
|
||||
"sha256:857959354ae3a6fa3da6651b966d13b0a8bed6bbc87a0de7b38a549db1d2a359",
|
||||
"sha256:2ba8a45822b7aee805ab49abfe7eec16b90587f7f26df20c71dd89e45a97076f",
|
||||
"sha256:a36c5c154f9d42ec176e6e620cb0dd275744aa1d804786a71ac37dc3661a5e95",
|
||||
"sha256:e55e22ac0a30023426564b1059b035973ec82186ddddbac867078435801c7801",
|
||||
"sha256:3eb6434197633b7748cea30bf0ba9f66727cdce45117a712b29a443943733257",
|
||||
"sha256:ecbb7b01409e9b782df5ded849c178a0aa7c906cf8c5a67368047daab282b184",
|
||||
"sha256:770f3782b31f50b68627e22f91cb182c48c47c02eb405fd689472aa7b7aa16dc",
|
||||
"sha256:d5d8555d9bfc3f02385c1c37e9f998e2011f0db4f90e250e5bc0c0a85a813085",
|
||||
"sha256:3c85641778460581c42924384f5e68076d724ceac0f267d66c757f7535069c93",
|
||||
"sha256:e90f17980e6ab0f3c2f3730e56d1fe9bcba1891eeea58966e89d352492cc74f4"
|
||||
],
|
||||
"version": "==1.11.4"
|
||||
"version": "==1.11.5"
|
||||
},
|
||||
"chardet": {
|
||||
"hashes": [
|
||||
|
@ -146,16 +146,17 @@
|
|||
},
|
||||
"django": {
|
||||
"hashes": [
|
||||
"sha256:ac4c797a328a5ac8777ad61bcd00da279773455cc78b4058de2a9842a0eb6ee8",
|
||||
"sha256:22383567385a9c406d8a5ce080a2694c82c6b733e157922197e8b393bb3aacd9"
|
||||
"sha256:fd186d544c7c2f835668cf11f77be071307c9eb22615a5b3a16bdb14c8357f41",
|
||||
"sha256:74077d7309b48b97dacdac2dfb35c968028becf00a7a684e7f29b2af1b980edc"
|
||||
],
|
||||
"version": "==1.11.10"
|
||||
"version": "==1.11.11"
|
||||
},
|
||||
"django-activeurl": {
|
||||
"hashes": [
|
||||
"sha256:7ebc4a34f91e18f29eb02bfac503057d69b4e1b6f9e8dd1297798387876e54da"
|
||||
"sha256:ad5498bf589afaa117fe1c80d1a4fdbef29185cee47517254cd8f273b8a0140d",
|
||||
"sha256:ebb3f2746fdc76fee2095b75cad713e746378393c6c2b8e36455919a780acd50"
|
||||
],
|
||||
"version": "==0.1.11"
|
||||
"version": "==0.1.12"
|
||||
},
|
||||
"django-agent-trust": {
|
||||
"hashes": [
|
||||
|
@ -207,10 +208,10 @@
|
|||
},
|
||||
"django-cors-headers": {
|
||||
"hashes": [
|
||||
"sha256:4e02be61ffaaab5917f1fd7cc3c305c4fb7ccd0156a649c96f49bc0a09c5f572",
|
||||
"sha256:451bc37a514792c2b46c52362368f7985985933ecdbf1a85f82652579a5cbe01"
|
||||
"sha256:0e9532628b3aa8806442d4d0b15e56112e6cfbef3735e13401935c98b842a2b4",
|
||||
"sha256:c7ec4816ec49416517b84f317499d1519db62125471922ab78d670474ed9b987"
|
||||
],
|
||||
"version": "==2.1.0"
|
||||
"version": "==2.2.0"
|
||||
},
|
||||
"django-debug-toolbar": {
|
||||
"hashes": [
|
||||
|
@ -241,10 +242,10 @@
|
|||
},
|
||||
"django-otp": {
|
||||
"hashes": [
|
||||
"sha256:06047e6f20e1527363ced31e4e8ea090f531cb33f4acd1bcaa6358a2efc05dbe",
|
||||
"sha256:b1b0166717e35363e8b8fba7d23e5a3e4f175b4893b2e1b68ac8bd3e1908c6a9"
|
||||
"sha256:0016baa0f11544aa3a709d1b4fca13d607397ae41025bdc4fdb8a7e80a39973c",
|
||||
"sha256:fd9e787779c053ba77e47a6907539c01e8db41b09f99722793317ed9a4183b32"
|
||||
],
|
||||
"version": "==0.4.2"
|
||||
"version": "==0.4.3"
|
||||
},
|
||||
"django-otp-agents": {
|
||||
"hashes": [
|
||||
|
@ -273,12 +274,6 @@
|
|||
],
|
||||
"version": "==1.0.1"
|
||||
},
|
||||
"django-shorturls": {
|
||||
"hashes": [
|
||||
"sha256:382ff617b36fea04981b30457377a46f2034d0940a40a20c6f637c55ea0bda93"
|
||||
],
|
||||
"version": "==2.0.0"
|
||||
},
|
||||
"ecdsa": {
|
||||
"hashes": [
|
||||
"sha256:40d002cf360d0e035cf2cb985e1308d41aaa087cbfc135b2dc2d844296ea546c",
|
||||
|
@ -328,36 +323,36 @@
|
|||
},
|
||||
"lxml": {
|
||||
"hashes": [
|
||||
"sha256:41f59cbdab232f11680d5d4dec9f2e6782fd24d78e37ee833447702e34e675f4",
|
||||
"sha256:e7e41d383f19bab9d57f5f3b18d158655bcd682e7e723f441b9e183e1e35a6b5",
|
||||
"sha256:155521c337acecf8202091cff85bb9f709f238130ebadf04280fb1db11f5ad8b",
|
||||
"sha256:d2c985d2460b81c6ca5feb8b86f1bc594ad59405d0bdf68626b85852b701553c",
|
||||
"sha256:950e63387514aa1b881eba5ac6cb2ec51a118b3dafe99dd80ca19d8fb0142f30",
|
||||
"sha256:470d7ce41e8047208ba1a376560bad17f1468df1f3097bc83902b26cfafdbb0c",
|
||||
"sha256:e608839a5ee2180164424ccf279c8e2d9bbe8816d002c58fd97d6b621ba4aa94",
|
||||
"sha256:87a66bcadac270fc010cb029022a93fc722bf1204a8b03e782d4c790f0edf7ca",
|
||||
"sha256:2dedfeeecc2d5a939cf622602f5a1ce443ca82407f386880f739f1a9f08053ad",
|
||||
"sha256:ba05732e4bcf59e948f61588851dcf620fd60d5bbd9d704203e5f59bbaa60219",
|
||||
"sha256:2190266059fec3c5a55f9d6c30532c64c6d414d3228909c0af573fe4907e78d1",
|
||||
"sha256:dd291debfaa535d9cb6cee8d7aca2328775e037d02d13f1634e57f49bc302cc4",
|
||||
"sha256:29a36e354c39b2e24bc4ee103de53417ebb80f976a6ab9e8d093d559e2ac03e1",
|
||||
"sha256:e37427d5a27eefbcfc48847e0b37f348113fac7280bc857421db39ffc6372570",
|
||||
"sha256:b106d4d2383382399ad82108fd187e92f40b1c90f55c2d36bbcb1c44bcf940fc",
|
||||
"sha256:0ee07da52d240f1dc3c83eef5cd5f1b7f018226c1121f2a54d446645779a6d17",
|
||||
"sha256:3b33549fb8f91b38a7500078242b03cca513f3412a2cdae722e89bf83f95971d",
|
||||
"sha256:4c12e90886d9c53ab434c8d0cebea122321cce19614c3c6b6d1a7700d7cc6212",
|
||||
"sha256:79322000279cda10b53c374d53ca632ead3bc51c6aebf8e62c8fa93a4d08b750",
|
||||
"sha256:6cba398eb37e0631e60e0e080c101cfe91769b2c8267105b64b4625e2581ea21",
|
||||
"sha256:49a655956f8de69e1258bc0fcfc43eb3bd1e038655784d77d1869b4b81444e37",
|
||||
"sha256:af8a5373241d09b8fc53e0490e1719ce5dc90a21b19db89b6596c1adcdd52270",
|
||||
"sha256:e6b6698415c7e8d227a47a3b1038e1b37c2b438a1b48c2db7ad9e74ddbcd1149",
|
||||
"sha256:155c916cf2645b4a8f2bd5d09065e92d1b67b8d464bdc001e0b524af84bedf6f",
|
||||
"sha256:fa7320679ced5e25b20203d157280680fc84eb783b6cc650cb0c98e1858b7dd3",
|
||||
"sha256:4187c4b0cefc3353181db048c51f42c489d9ac51e40b86c4851dc0671372971d",
|
||||
"sha256:d5d29663e979e83b3fc361e97200f959cddb3a14797391d15273d84a5a8ae44b",
|
||||
"sha256:940caef1ec7c78e0c34b0f6b94fe42d0f2022915ffc78643d28538a5cfd0f40e"
|
||||
"sha256:0af9c9267b1257319d49e9c1e9abbf92a99f965bee3c4733e0f0f7578985182d",
|
||||
"sha256:62bfcd0629991e1c1257ffd28df2ab31a5c44da4c06823c26ec0f472723a84ca",
|
||||
"sha256:1d1e45584353e4d563685874707fc8c85cdd11b0ef3b79d77bb38046134d68a9",
|
||||
"sha256:29697224b2df76edf7c2de9bcd90a26dd28fe85c5fd7f0171cae84f8383b227e",
|
||||
"sha256:988d55112f196e12341b7c5138841c2b4f21f871eaa8f138c6ac4c46f28899f9",
|
||||
"sha256:57be98177ce784495dff53f40620995ad0a56456246ed9d51977e595de58e12e",
|
||||
"sha256:36ffb216e2f361a5a0a7e219aea6cd44da11c64061baed273944aae21223186c",
|
||||
"sha256:d0dc3e5737adcc9a23fd3d3d3072b887fefb48143309563f412ef7b0ebdfdb30",
|
||||
"sha256:7769ac9203ebe6d8db16904c54d57d77360fcc1926ed7afaa86b04050e4afa5b",
|
||||
"sha256:4c21d7304d37715e6aed756e4d0c374c99c9bb1fa8d64f546b95474b17ac23de",
|
||||
"sha256:0aa44ffdeaaf6ba45d61980bb2c07e87d4dcac7a8b5b9d458124bc1adcda5233",
|
||||
"sha256:71ac6dac6835de75aaf531cae9ffa447dae0783ba1f43bf6eaccfad3680a5b9c",
|
||||
"sha256:88583c6565c9299f617238a500f1a47510bac54daff7872d6a343f13361b659e",
|
||||
"sha256:2812bc45a7f53f366217b76a1c53e6728fbfa7f7524d16a321ea8f7131428bd1",
|
||||
"sha256:124a9d529eec5e10f307eb237df3efc43dd1fb7ebdb5da5e480c4ed372648b6b",
|
||||
"sha256:f04b184984c23e0caac3c55eac2fe2dbb88726a5a1b35e23715eff6f29a4705c",
|
||||
"sha256:d06260e6102b2f18dbee3736185cd6a2e1c88c0fad782bf8e9d7a7a1b24e02b0",
|
||||
"sha256:0cddc6cde79e1932efc71d9974a4418184ad0b8ca46c633ad772b2c5eaf36b3c",
|
||||
"sha256:9e08918b744b89d30750eca8598f37ae75b16202870db678fde970d85afed3e3",
|
||||
"sha256:b46f31e806f6884bd1053ad1d78ecaca6d1bc5dd94a1b783a6ff0bb4b3a60962",
|
||||
"sha256:dd98d4f88ce0abda2b02c1542d1de22dd342023f3ba09874bd95841283f29433",
|
||||
"sha256:8f52c4c8f1cf15419193026e731f34a3260a3ce7977b875ba1eb2517b8a3f660",
|
||||
"sha256:c18f316cad969111b1ff9e84c82fbc9ae6f25f35701118182d384585940cdf80",
|
||||
"sha256:95b82fdfdaac71640b281da6b9a2c3700177ba5190a786881b184de744ad55de",
|
||||
"sha256:cef79715f2335bfc1ef7082bcb8b2bac87271431653455221a9127fde146208c",
|
||||
"sha256:4626d699551f66687e5f7e7f9b79bfce611e12edebfb9fec276e2df8ec46541e",
|
||||
"sha256:cf63f590090404c52f179b7ceacb7cd549de3a1697bcfe2f79be180b2801d109",
|
||||
"sha256:7d96fbb5f23a62300aa9bef7d286cd61aca8902357619c8708c0290aba5df73f"
|
||||
],
|
||||
"version": "==4.1.1"
|
||||
"version": "==4.2.0"
|
||||
},
|
||||
"markdown": {
|
||||
"hashes": [
|
||||
|
@ -380,9 +375,9 @@
|
|||
},
|
||||
"msgpack-python": {
|
||||
"hashes": [
|
||||
"sha256:23f688905bb9fbf00faa7346e72a72e670e68f3f5d94aeea5c123dd0e07de49c"
|
||||
"sha256:378cc8a6d3545b532dfd149da715abae4fda2a3adb6d74e525d0d5e51f46909b"
|
||||
],
|
||||
"version": "==0.5.2"
|
||||
"version": "==0.5.6"
|
||||
},
|
||||
"pillow": {
|
||||
"hashes": [
|
||||
|
@ -438,39 +433,35 @@
|
|||
},
|
||||
"psycopg2": {
|
||||
"hashes": [
|
||||
"sha256:594aa9a095de16614f703d759e10c018bdffeafce2921b8e80a0e8a0ebbc12e5",
|
||||
"sha256:1cf5d84290c771eeecb734abe2c6c3120e9837eb12f99474141a862b9061ac51",
|
||||
"sha256:0344b181e1aea37a58c218ccb0f0f771295de9aa25a625ed076e6996c6530f9e",
|
||||
"sha256:25250867a4cd1510fb755ef9cb38da3065def999d8e92c44e49a39b9b76bc893",
|
||||
"sha256:317612d5d0ca4a9f7e42afb2add69b10be360784d21ce4ecfbca19f1f5eadf43",
|
||||
"sha256:9d6266348b15b4a48623bf4d3e50445d8e581da413644f365805b321703d0fac",
|
||||
"sha256:ddca39cc55877653b5fcf59976d073e3d58c7c406ef54ae8e61ddf8782867182",
|
||||
"sha256:988d2ec7560d42ef0ac34b3b97aad14c4f068792f00e1524fa1d3749fe4e4b64",
|
||||
"sha256:7a9c6c62e6e05df5406e9b5235c31c376a22620ef26715a663cee57083b3c2ea",
|
||||
"sha256:7a75565181e75ba0b9fb174b58172bf6ea9b4331631cfe7bafff03f3641f5d73",
|
||||
"sha256:94e4128ba1ea56f02522fffac65520091a9de3f5c00da31539e085e13db4771b",
|
||||
"sha256:92179bd68c2efe72924a99b6745a9172471931fc296f9bfdf9645b75eebd6344",
|
||||
"sha256:b9358e203168fef7bfe9f430afaed3a2a624717a1d19c7afa7dfcbd76e3cd95c",
|
||||
"sha256:009e0bc09a57dbef4b601cb8b46a2abad51f5274c8be4bba276ff2884cd4cc53",
|
||||
"sha256:d3ac07240e2304181ffdb13c099840b5eb555efc7be9344503c0c03aa681de79",
|
||||
"sha256:40fa5630cd7d237cd93c4d4b64b9e5ed9273d1cfce55241c7f9066f5db70629d",
|
||||
"sha256:6c2f1a76a9ebd9ecf7825b9e20860139ca502c2bf1beabf6accf6c9e66a7e0c3",
|
||||
"sha256:37f54452c7787dbdc0a634ca9773362b91709917f0b365ed14b831f03cbd34ba",
|
||||
"sha256:8f5942a4daf1ffac42109dc4a72f786af4baa4fa702ede1d7c57b4b696c2e7d6",
|
||||
"sha256:bf708455cd1e9fa96c05126e89a0c59b200d086c7df7bbafc7d9be769e4149a3",
|
||||
"sha256:82c40ea3ac1555e0462803380609fbe8b26f52620f3d4f8eb480cfd8ceed8a14",
|
||||
"sha256:207ba4f9125a0a4200691e82d5eee7ea1485708eabe99a07fc7f08696fae62f4",
|
||||
"sha256:0cd4c848f0e9d805d531e44973c8f48962e20eb7fc0edac3db4f9dbf9ed5ab82",
|
||||
"sha256:57baf63aeb2965ca4b52613ce78e968b6d2bde700c97f6a7e8c6c236b51ab83e",
|
||||
"sha256:2954557393cfc9a5c11a5199c7a78cd9c0c793a047552d27b1636da50d013916",
|
||||
"sha256:7c31dade89634807196a6b20ced831fbd5bec8a21c4e458ea950c9102c3aa96f",
|
||||
"sha256:1286dd16d0e46d59fa54582725986704a7a3f3d9aca6c5902a7eceb10c60cb7e",
|
||||
"sha256:697ff63bc5451e0b0db48ad205151123d25683b3754198be7ab5fcb44334e519",
|
||||
"sha256:fc993c9331d91766d54757bbc70231e29d5ceb2d1ac08b1570feaa0c38ab9582",
|
||||
"sha256:9d64fed2681552ed642e9c0cc831a9e95ab91de72b47d0cb68b5bf506ba88647",
|
||||
"sha256:5c3213be557d0468f9df8fe2487eaf2990d9799202c5ff5cb8d394d09fad9b2a"
|
||||
"sha256:aeaba399254ca79c299d9fe6aa811d3c3eac61458dee10270de7f4e71c624998",
|
||||
"sha256:1d90379d01d0dc50ae9b40c863933d87ff82d51dd7d52cea5d1cb7019afd72cd",
|
||||
"sha256:36030ca7f4b4519ee4f52a74edc4ec73c75abfb6ea1d80ac7480953d1c0aa3c3",
|
||||
"sha256:7cbc3b21ce2f681ca9ad2d8c0901090b23a30c955e980ebf1006d41f37068a95",
|
||||
"sha256:b178e0923c93393e16646155794521e063ec17b7cc9f943f15b7d4b39776ea2c",
|
||||
"sha256:fe6a7f87356116f5ea840c65b032af17deef0e1a5c34013a2962dd6f99b860dd",
|
||||
"sha256:6f302c486132f8dd11f143e919e236ea4467d53bf18c451cac577e6988ecbd05",
|
||||
"sha256:888bba7841116e529f407f15c6d28fe3ef0760df8c45257442ec2f14f161c871",
|
||||
"sha256:932a4c101af007cb3132b1f8a9ffef23386acc53dad46536dc5ba43a3235ae02",
|
||||
"sha256:179c52eb870110a8c1b460c86d4f696d58510ea025602cd3f81453746fccb94f",
|
||||
"sha256:33f9e1032095e1436fa9ec424abcbd4c170da934fb70e391c5d78275d0307c75",
|
||||
"sha256:092a80da1b052a181b6e6c765849c9b32d46c5dac3b81bf8c9b83e697f3cdbe8",
|
||||
"sha256:f3d3a88128f0c219bdc5b2d9ccd496517199660cea021c560a3252116df91cbd",
|
||||
"sha256:19983b77ec1fc2a210092aa0333ee48811fd9fb5f194c6cd5b927ed409aea5f8",
|
||||
"sha256:027ae518d0e3b8fff41990e598bc7774c3d08a3a20e9ecc0b59fb2aaaf152f7f",
|
||||
"sha256:363fbbf4189722fc46779be1fad2597e2c40b3f577dc618f353a46391cf5d235",
|
||||
"sha256:d74cf9234ba76426add5e123449be08993a9b13ff434c6efa3a07caa305a619f",
|
||||
"sha256:32702e3bd8bfe12b36226ba9846ed9e22336fc4bd710039d594b36bd432ae255",
|
||||
"sha256:8eb94c0625c529215b53c08fb4e461546e2f3fc96a49c13d5474b5ad7aeab6cf",
|
||||
"sha256:8ebba5314c609a05c6955e5773c7e0e57b8dd817e4f751f30de729be58fa5e78",
|
||||
"sha256:27467fd5af1dcc0a82d72927113b8f92da8f44b2efbdb8906bd76face95b596d",
|
||||
"sha256:b68e89bb086a9476fa85298caab43f92d0a6af135a5f433d1f6b6d82cafa7b55",
|
||||
"sha256:0b9851e798bae024ed1a2a6377a8dab4b8a128a56ed406f572f9f06194e4b275",
|
||||
"sha256:733166464598c239323142c071fa4c9b91c14359176e5ae7e202db6bcc1d2eb5",
|
||||
"sha256:ad75fe10bea19ad2188c5cb5fc4cdf53ee808d9b44578c94a3cd1e9fc2beb656",
|
||||
"sha256:8966829cb0d21a08a3c5ac971a2eb67c3927ae27c247300a8476554cc0ce2ae8",
|
||||
"sha256:8bf51191d60f6987482ef0cfe8511bbf4877a5aa7f313d7b488b53189cf26209"
|
||||
],
|
||||
"version": "==2.7.3.2"
|
||||
"version": "==2.7.4"
|
||||
},
|
||||
"py": {
|
||||
"hashes": [
|
||||
|
@ -487,38 +478,38 @@
|
|||
},
|
||||
"pycryptodome": {
|
||||
"hashes": [
|
||||
"sha256:444053c24b336daa7f84bf872df7a6b9950697559926aea5775f5aa757b67a3e",
|
||||
"sha256:29d3a581cfcc68ca66f7c5d4830944556ddca9e2747e214bde8028972bb1901f",
|
||||
"sha256:7bda0f395fd8ef6b1fa7cded00d5cca72005ff158fc30703e1337fe32fbf2102",
|
||||
"sha256:bdd8581dae617b9fbe6e8dbdd96590c02fc33eebc411b0273fd62b4d468d0bb7",
|
||||
"sha256:89a0a233ed3a216ae117323d8fb0da38f1ca344dc1021559e38416cce23592a0",
|
||||
"sha256:5d390f8c6562173b913f0359cd87d5bc2e3245cc88ec4edf59d8c52107f24d29",
|
||||
"sha256:44ad06faf5ee589c1127a18610695a65815ed5db724b58687294ee907ec546ba",
|
||||
"sha256:c8922f187fcac3b2afa6d200ef00cd4e69719799b54b4f2f2741b2e4c96ccd61",
|
||||
"sha256:2aeded7095564b8a068402531c7407517cd714a0fe9872f76c69bd4400b07613",
|
||||
"sha256:c88e9a04d3ed89689bc76ce0a90b018cdd4edb94ab99ce31264f2e15bad9d752",
|
||||
"sha256:64a0cccf590546e7de602378f21482cb06cd1a1995cdfb121b123394c48b05c3",
|
||||
"sha256:21fd74571b3579cbf36792916ad76a4ecf91581a112bb78ec48e20389dcdb912",
|
||||
"sha256:11ca73effcc15596b62d601a6b3c48ea607fb5219546d406312520d63c446bf5",
|
||||
"sha256:ce3110812d8823c3182fc7f841031387ee6fda27d8696da8949a99b026048e7e",
|
||||
"sha256:29e8d3770bc0a0366093eb693ca40c5be56ed5a7ca214af5156a0b2e23053549",
|
||||
"sha256:d9ae42a88c716a7ca9a53966562968921883211b6390eeab22e5b735dbc49f49",
|
||||
"sha256:d3136fe71a37882ca457bea5917f1db5431f18f1bd91b0f7c4cec57ac4d57016",
|
||||
"sha256:0ebbcdbd21b5d8569c5b44137e2071d28c14a7460afdd8b1f6398a1548c4773a",
|
||||
"sha256:5ce44a755be8aef369d1057a38bff01501db0b89ba38c3292578f42ed401f355",
|
||||
"sha256:1d3065b741ec8d269327e4487eacd187e0bf909e7a73d0a959da1a0918b16fa9",
|
||||
"sha256:cb81302f3295a14722f6c26c44ab4023d66f8394db4c316ccf5658dbada2ac91",
|
||||
"sha256:4fd2584719895ff041cf48766014ef6b5a170f5caf0e2dc735837b182e78d081",
|
||||
"sha256:c5dd29e9f1b733e74311bf95d0e544e91bd1d14bc0366e8f443562d8d9920b7d"
|
||||
"sha256:fd2ca8126841cee1bedc1d8e1bb5e9bfe3f0624f9858b580f8bd4309421c2b27",
|
||||
"sha256:08b0af4035b036d3fa051148e1d44ab8e4260e87daca2c34e29fd1ba883a890b",
|
||||
"sha256:c0ea075b462ddd2135002ed9df72925e08629e750b9f37c21a2076602fab23a8",
|
||||
"sha256:6881f7c099e64600eaf5baabec6a83db24db695f00d64f472fd583736f652bee",
|
||||
"sha256:eb3b3608764a0203d3f8b74ee2566d6bcda53c8afc2d70596f2ee5031e049f04",
|
||||
"sha256:74bcd74b580f486f67ea71b9f86aa405cf2a454ddddc3ec03d8274c2f9cb6949",
|
||||
"sha256:ae8a135010e73b9be3a058177fc2bea5a0210ef06f4ec98a08096f4f95f01eb7",
|
||||
"sha256:8c7c50269092127d19db4004c4bd5814daa158428947d2074ef94dc2c4c363e3",
|
||||
"sha256:a14521d67f082f76dea5d63affa70923ef6228151d56d2e8320baaabb31b0488",
|
||||
"sha256:cfa669956db31bfc5aad26dc1625b218e3f0200f4b52f1f36985488d86a55d93",
|
||||
"sha256:02ad39528c6e856acfc04af7b86106b58806b56b067548be7213016510f44142",
|
||||
"sha256:bb2c04525ababc2e74e09250e2a13ff01153ce49b2418be88d75d7656673e98e",
|
||||
"sha256:684045e3b34d646b3888cb334a051ff11f9e393482fed95e9914d155a592348c",
|
||||
"sha256:d76e04b988dadb4893f68ca1ff189ae37c4766cbd3cbed39d764e63bf2d2874f",
|
||||
"sha256:9bcf1157ba987081a3a52db3a2f5e358e7cafe3321ed3efa9c4f8d94ca1cf230",
|
||||
"sha256:215e1d99e389ebe910e5a12c85a1974eba88e2fc23256913e9eff5a34f7361a9",
|
||||
"sha256:78b537993b3baeb1e0f0ae6546cbbf859f71aec5815ff234f8b496fdc8be862d",
|
||||
"sha256:3f792eb9ff211445712824c30c1f59970f79339bcc4e0b0e2903445d20f99685",
|
||||
"sha256:d6263002baf78f92ed1a5bd1112b695eed3d1b03813a516a1443a5ad41e70d09",
|
||||
"sha256:73ea3973983eaa096c6f2857185d9cd1d89586cf69478ff4ddbf6a4df9068d78",
|
||||
"sha256:90c1c08431ccf8d6385b5071e5d3f7ecbf85dbd1cbd45439fe136bc514c73136",
|
||||
"sha256:008e0bfc02f8c409fbe31a1dd1ff3aa18b5c109b47a05603ca734506a7b3a8cb",
|
||||
"sha256:b7957736f5e868416b06ff033f8525e64630c99a8880b531836605190b0cac96"
|
||||
],
|
||||
"version": "==3.4.11"
|
||||
"version": "==3.5.1"
|
||||
},
|
||||
"pytest": {
|
||||
"hashes": [
|
||||
"sha256:95fa025cd6deb5d937e04e368a00552332b58cae23f63b76c8c540ff1733ab6d",
|
||||
"sha256:6074ea3b9c999bd6d0df5fa9d12dd95ccd23550df2a582f5f5b848331d2e82ca"
|
||||
"sha256:062027955bccbc04d2fcd5d79690947e018ba31abe4c90b2c6721abec734261b",
|
||||
"sha256:117bad36c1a787e1a8a659df35de53ba05f9f3398fb9e4ac17e80ad5903eb8c5"
|
||||
],
|
||||
"version": "==3.4.0"
|
||||
"version": "==3.4.2"
|
||||
},
|
||||
"pytest-django": {
|
||||
"hashes": [
|
||||
|
@ -527,6 +518,12 @@
|
|||
],
|
||||
"version": "==3.1.2"
|
||||
},
|
||||
"python-baseconv": {
|
||||
"hashes": [
|
||||
"sha256:b12c75330660a06af546fea1e4f06fe4ca8147753ca69589171b119f6f834012"
|
||||
],
|
||||
"version": "==1.2.0"
|
||||
},
|
||||
"python-jose": {
|
||||
"hashes": [
|
||||
"sha256:3b35cdb0e55a88581ff6d3f12de753aa459e940b50fe7ca5aa25149bc94cb37b",
|
||||
|
@ -550,17 +547,17 @@
|
|||
},
|
||||
"pytz": {
|
||||
"hashes": [
|
||||
"sha256:80af0f3008046b9975242012a985f04c5df1f01eed4ec1633d56cc47a75a6a48",
|
||||
"sha256:feb2365914948b8620347784b6b6da356f31c9d03560259070b2f30cff3d469d",
|
||||
"sha256:59707844a9825589878236ff2f4e0dc9958511b7ffaae94dc615da07d4a68d33",
|
||||
"sha256:d0ef5ef55ed3d37854320d4926b04a4cb42a2e88f71da9ddfdacfde8e364f027",
|
||||
"sha256:c41c62827ce9cafacd6f2f7018e4f83a6f1986e87bfd000b8cfbd4ab5da95f1a",
|
||||
"sha256:8cc90340159b5d7ced6f2ba77694d946fc975b09f1a51d93f3ce3bb399396f94",
|
||||
"sha256:dd2e4ca6ce3785c8dd342d1853dd9052b19290d5bf66060846e5dc6b8d6667f7",
|
||||
"sha256:699d18a2a56f19ee5698ab1123bbcc1d269d061996aeb1eda6d89248d3542b82",
|
||||
"sha256:fae4cffc040921b8a2d60c6cf0b5d662c1190fe54d718271db4eb17d44a185b7"
|
||||
"sha256:ed6509d9af298b7995d69a440e2822288f2eca1681b8cce37673dbb10091e5fe",
|
||||
"sha256:f93ddcdd6342f94cea379c73cddb5724e0d6d0a1c91c9bdef364dc0368ba4fda",
|
||||
"sha256:61242a9abc626379574a166dc0e96a66cd7c3b27fc10868003fa210be4bff1c9",
|
||||
"sha256:ba18e6a243b3625513d85239b3e49055a2f0318466e0b8a92b8fb8ca7ccdf55f",
|
||||
"sha256:07edfc3d4d2705a20a6e99d97f0c4b61c800b8232dc1c04d87e8554f130148dd",
|
||||
"sha256:3a47ff71597f821cd84a162e71593004286e5be07a340fd462f0d33a760782b5",
|
||||
"sha256:5bd55c744e6feaa4d599a6cbd8228b4f8f9ba96de2c38d56f08e534b3c9edf0d",
|
||||
"sha256:887ab5e5b32e4d0c86efddd3d055c1f363cbaa583beb8da5e22d2fa2f64d51ef",
|
||||
"sha256:410bcd1d6409026fbaa65d9ed33bf6dd8b1e94a499e32168acfc7b332e4095c0"
|
||||
],
|
||||
"version": "==2017.3"
|
||||
"version": "==2018.3"
|
||||
},
|
||||
"pyyaml": {
|
||||
"hashes": [
|
||||
|
|
|
@ -8,6 +8,7 @@ from slugify import slugify
|
|||
from textwrap import shorten
|
||||
from urllib.parse import urljoin
|
||||
|
||||
from lemonshort.short_url import short_url
|
||||
from meta.models import ModelMeta
|
||||
from model_utils.models import TimeStampedModel
|
||||
from users.models import Profile
|
||||
|
@ -148,6 +149,10 @@ class Entry(ModelMeta, TimeStampedModel):
|
|||
args.append(self.slug)
|
||||
return reverse('entries:entry_amp', args=args)
|
||||
|
||||
@property
|
||||
def short_url(self):
|
||||
return short_url(self)
|
||||
|
||||
@property
|
||||
def slug(self):
|
||||
return slugify(self.name)
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
{% extends 'lemoncurry/layout.html' %}
|
||||
{% load shorturl static %}
|
||||
{% load static %}
|
||||
|
||||
{% block head %}
|
||||
<link rel="amphtml" href="{{ entry.amp_url }}" />
|
||||
<link rel="shortlink" href="{% shorturl entry %}" />
|
||||
<link rel="shortlink" href="{{ entry.short_url }}" />
|
||||
{% endblock %}
|
||||
|
||||
{% block styles %}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
{% load absolute_url favtags friendly_url humanize jsonify lemoncurry_tags markdown shortlink theme_colour %}<!doctype html>
|
||||
{% load absolute_url favtags friendly_url humanize jsonify lemoncurry_tags markdown theme_colour %}<!doctype html>
|
||||
<html ⚡ lang="en" class="h-entry">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>{{ entry.title }} ~ {% site_name %}</title>
|
||||
<link rel="canonical" href="{% absolute_url entry.url %}">
|
||||
{% shortlink entry as short %}<link rel="shortlink" href="{% absolute_url short %}" />
|
||||
<link rel="shortlink" href="{% absolute_url entry.short_url %}" />
|
||||
<meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1">
|
||||
<script class="p-json-ld" type="application/ld+json">
|
||||
{{ entry.json_ld | jsonify }}
|
||||
|
@ -132,9 +132,9 @@
|
|||
amp
|
||||
</a>
|
||||
|
||||
<a class="u-url" href="{% absolute_url short %}">
|
||||
<a class="u-url" href="{% absolute_url entry.short_url %}">
|
||||
🔗
|
||||
{{ short | friendly_url }}
|
||||
{{ entry.short_url | friendly_url }}
|
||||
</a>
|
||||
|
||||
{% for c in entry.cats.all %}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{% load bleach friendly_url humanize jsonify markdown shortlink %}<article class="card h-entry">
|
||||
{% load bleach friendly_url humanize jsonify markdown %}<article class="card h-entry">
|
||||
{% if entry.photo %}<img class="card-img-top u-photo" src="{{ entry.photo.url }}" />{% endif %}
|
||||
|
||||
{% if entry.in_reply_to %}{% with reply=entry.reply_context %}
|
||||
|
@ -39,9 +39,9 @@
|
|||
<i class="fas fa-bolt"></i>
|
||||
amp
|
||||
</a>
|
||||
{% shortlink entry as short %}<a class="u-url" href="{{ short }}">
|
||||
<a class="u-url" href="{{ entry.short_url }}">
|
||||
<i class="fas fa-link"></i>
|
||||
{{ short | friendly_url }}
|
||||
{{ entry.short_url | friendly_url }}
|
||||
</a>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -81,12 +81,12 @@ INSTALLED_APPS = [
|
|||
'django_rq',
|
||||
'favicon',
|
||||
'meta',
|
||||
'shorturls',
|
||||
|
||||
'lemoncurry',
|
||||
'entries',
|
||||
'home',
|
||||
'lemonauth',
|
||||
'lemonshort',
|
||||
'micropub',
|
||||
'users',
|
||||
'webmention',
|
||||
|
@ -240,8 +240,8 @@ DEBUG_TOOLBAR_CONFIG = {
|
|||
'SHOW_TOOLBAR_CALLBACK': 'lemoncurry.debug.show_toolbar',
|
||||
}
|
||||
|
||||
# django-shorturls
|
||||
# https://pypi.python.org/pypi/django-shorturls
|
||||
# lemonshort
|
||||
SHORT_BASE_URL = '/s/'
|
||||
SHORTEN_MODELS = {
|
||||
'e': 'entries.entry',
|
||||
}
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
from django import template
|
||||
from django.template import Context
|
||||
from lemoncurry import utils
|
||||
|
||||
register = template.Library()
|
||||
|
||||
|
||||
@register.simple_tag
|
||||
def shortlink(obj):
|
||||
return utils.shortlink(obj)
|
|
@ -40,7 +40,7 @@ urlpatterns = [
|
|||
url('^admin/', otp_admin_site.urls),
|
||||
url('^auth/', include('lemonauth.urls')),
|
||||
url('^micropub', include('micropub.urls')),
|
||||
url('^s/', include('shorturls.urls')),
|
||||
url('^s/', include('lemonshort.urls')),
|
||||
url('^webmention', include('webmention.urls')),
|
||||
|
||||
url(r'^django-rq/', include('django_rq.urls')),
|
||||
|
|
|
@ -6,8 +6,6 @@ from django.http import HttpResponse, JsonResponse
|
|||
from django.http import HttpResponseForbidden, HttpResponseBadRequest
|
||||
from django.utils.html import strip_tags
|
||||
from os.path import join
|
||||
from shorturls import default_converter as converter
|
||||
from shorturls.templatetags.shorturl import ShortURL
|
||||
from types import SimpleNamespace
|
||||
from urllib.parse import urlencode, urljoin
|
||||
|
||||
|
@ -53,14 +51,6 @@ def choose_type(request, content, reps=REPS):
|
|||
return HttpResponse(status=406)
|
||||
|
||||
|
||||
def shortlink(obj):
|
||||
prefix = ShortURL(None).get_prefix(obj)
|
||||
tinyid = converter.from_decimal(obj.pk)
|
||||
if hasattr(settings, 'SHORT_BASE_URL') and settings.SHORT_BASE_URL:
|
||||
return urljoin(settings.SHORT_BASE_URL, prefix + tinyid)
|
||||
return '/' + prefix + tinyid
|
||||
|
||||
|
||||
def bad_req(message):
|
||||
return HttpResponseBadRequest(message, content_type='text/plain')
|
||||
|
||||
|
|
1
lemonshort/__init__.py
Normal file
1
lemonshort/__init__.py
Normal file
|
@ -0,0 +1 @@
|
|||
default_app_config = 'lemonshort.apps.LemonshortConfig'
|
5
lemonshort/apps.py
Normal file
5
lemonshort/apps.py
Normal file
|
@ -0,0 +1,5 @@
|
|||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class LemonshortConfig(AppConfig):
|
||||
name = 'lemonshort'
|
15
lemonshort/convert.py
Normal file
15
lemonshort/convert.py
Normal file
|
@ -0,0 +1,15 @@
|
|||
from baseconv import BaseConverter
|
||||
from string import ascii_lowercase, ascii_uppercase
|
||||
|
||||
# We have to create this collection ourselves because we want uppercase then
|
||||
# lowercase, and string.ascii_letters is lowercase then uppercase.
|
||||
chars = ascii_uppercase + ascii_lowercase
|
||||
conv = BaseConverter(chars)
|
||||
|
||||
|
||||
def abc_to_id(abc):
|
||||
return int(conv.decode(abc))
|
||||
|
||||
|
||||
def id_to_abc(id):
|
||||
return conv.encode(id)
|
16
lemonshort/short_url.py
Normal file
16
lemonshort/short_url.py
Normal file
|
@ -0,0 +1,16 @@
|
|||
from django.apps import apps
|
||||
from django.conf import settings
|
||||
|
||||
from .convert import id_to_abc
|
||||
|
||||
prefixes = {}
|
||||
|
||||
|
||||
def short_url(entity):
|
||||
if not prefixes:
|
||||
for k, m in settings.SHORTEN_MODELS.items():
|
||||
prefixes[apps.get_model(m)] = k
|
||||
base = '/'
|
||||
if hasattr(settings, 'SHORT_BASE_URL'):
|
||||
base = settings.SHORT_BASE_URL
|
||||
return base + prefixes[type(entity)] + id_to_abc(entity.id)
|
0
lemonshort/tests/__init__.py
Normal file
0
lemonshort/tests/__init__.py
Normal file
30
lemonshort/tests/convert.py
Normal file
30
lemonshort/tests/convert.py
Normal file
|
@ -0,0 +1,30 @@
|
|||
from .. import convert
|
||||
|
||||
|
||||
def test_abc_to_id():
|
||||
samples = {
|
||||
'A': 0,
|
||||
'B': 1,
|
||||
'Y': 24,
|
||||
'a': 26,
|
||||
'b': 27,
|
||||
'y': 50,
|
||||
'BA': 52,
|
||||
'BAB': 2705,
|
||||
}
|
||||
for abc, id in samples.items():
|
||||
assert convert.abc_to_id(abc) == id
|
||||
|
||||
|
||||
def test_id_to_abc():
|
||||
samples = {
|
||||
1: 'B',
|
||||
24: 'Y',
|
||||
26: 'a',
|
||||
52: 'BA',
|
||||
78: 'Ba',
|
||||
104: 'CA',
|
||||
130: 'Ca',
|
||||
}
|
||||
for id, abc in samples.items():
|
||||
assert convert.id_to_abc(id) == abc
|
10
lemonshort/urls.py
Normal file
10
lemonshort/urls.py
Normal file
|
@ -0,0 +1,10 @@
|
|||
from django.conf import settings
|
||||
from django.conf.urls import url
|
||||
|
||||
from .views import unshort
|
||||
|
||||
app_name = 'lemonshort'
|
||||
urlpatterns = tuple(
|
||||
url(r'^{0!s}(?P<tiny>\w+)$'.format(k), unshort, kwargs={'model': m})
|
||||
for k, m in settings.SHORTEN_MODELS.items()
|
||||
)
|
9
lemonshort/views.py
Normal file
9
lemonshort/views.py
Normal file
|
@ -0,0 +1,9 @@
|
|||
from django.apps import apps
|
||||
from django.shortcuts import get_object_or_404, redirect
|
||||
|
||||
from .convert import abc_to_id
|
||||
|
||||
|
||||
def unshort(request, model, tiny):
|
||||
entity = get_object_or_404(apps.get_model(model), pk=abc_to_id(tiny))
|
||||
return redirect(entity, permanent=True)
|
Loading…
Reference in a new issue