diff --git a/core/widgets/__init__.py b/core/widgets/__init__.py new file mode 100644 index 0000000..6d4caf8 --- /dev/null +++ b/core/widgets/__init__.py @@ -0,0 +1 @@ +__author__ = 'fergalm' diff --git a/core/widgets/upload.py b/core/widgets/upload.py new file mode 100644 index 0000000..b69b707 --- /dev/null +++ b/core/widgets/upload.py @@ -0,0 +1,4 @@ +from django.forms.widgets import ClearableFileInput + +class FileUploadWidget(ClearableFileInput): + pass \ No newline at end of file diff --git a/dss/settings.py b/dss/settings.py index 9236a81..2f68e45 100644 --- a/dss/settings.py +++ b/dss/settings.py @@ -15,7 +15,7 @@ ADMINS = ( ) MANAGERS = ADMINS -AUTH_PROFILE_MODULE = 'spa.models.UserProfile' +AUTH_PROFILE_MODULE = 'spa.UserProfile' DATABASES = { 'default': { @@ -125,6 +125,7 @@ INSTALLED_APPS = ( 'django.contrib.admin', 'django.contrib.admindocs', 'djcelery', + 'crispy_forms', 'pipeline', 'avatar', 'notification', diff --git a/initial_data.json b/initial_data.json new file mode 100644 index 0000000..f2a61ef --- /dev/null +++ b/initial_data.json @@ -0,0 +1 @@ +[{"pk": 16, "model": "contenttypes.contenttype", "fields": {"model": "avatar", "name": "avatar", "app_label": "avatar"}}, {"pk": 27, "model": "contenttypes.contenttype", "fields": {"model": "comment", "name": "comment", "app_label": "spa"}}, {"pk": 4, "model": "contenttypes.contenttype", "fields": {"model": "contenttype", "name": "content type", "app_label": "contenttypes"}}, {"pk": 11, "model": "contenttypes.contenttype", "fields": {"model": "crontabschedule", "name": "crontab", "app_label": "djcelery"}}, {"pk": 40, "model": "contenttypes.contenttype", "fields": {"model": "emailaddress", "name": "email address", "app_label": "emailconfirmation"}}, {"pk": 41, "model": "contenttypes.contenttype", "fields": {"model": "emailconfirmation", "name": "email confirmation", "app_label": "emailconfirmation"}}, {"pk": 29, "model": "contenttypes.contenttype", "fields": {"model": "event", "name": "event", "app_label": "spa"}}, {"pk": 2, "model": "contenttypes.contenttype", "fields": {"model": "group", "name": "group", "app_label": "auth"}}, {"pk": 10, "model": "contenttypes.contenttype", "fields": {"model": "intervalschedule", "name": "interval", "app_label": "djcelery"}}, {"pk": 30, "model": "contenttypes.contenttype", "fields": {"model": "label", "name": "label", "app_label": "spa"}}, {"pk": 7, "model": "contenttypes.contenttype", "fields": {"model": "logentry", "name": "log entry", "app_label": "admin"}}, {"pk": 26, "model": "contenttypes.contenttype", "fields": {"model": "mix", "name": "mix", "app_label": "spa"}}, {"pk": 31, "model": "contenttypes.contenttype", "fields": {"model": "mixlike", "name": "mix like", "app_label": "spa"}}, {"pk": 32, "model": "contenttypes.contenttype", "fields": {"model": "mixplay", "name": "mix play", "app_label": "spa"}}, {"pk": 19, "model": "contenttypes.contenttype", "fields": {"model": "notice", "name": "notice", "app_label": "notification"}}, {"pk": 20, "model": "contenttypes.contenttype", "fields": {"model": "noticequeuebatch", "name": "notice queue batch", "app_label": "notification"}}, {"pk": 18, "model": "contenttypes.contenttype", "fields": {"model": "noticesetting", "name": "notice setting", "app_label": "notification"}}, {"pk": 17, "model": "contenttypes.contenttype", "fields": {"model": "noticetype", "name": "notice type", "app_label": "notification"}}, {"pk": 21, "model": "contenttypes.contenttype", "fields": {"model": "observeditem", "name": "observed item", "app_label": "notification"}}, {"pk": 39, "model": "contenttypes.contenttype", "fields": {"model": "openidnonce", "name": "open id nonce", "app_label": "openid"}}, {"pk": 38, "model": "contenttypes.contenttype", "fields": {"model": "openidstore", "name": "open id store", "app_label": "openid"}}, {"pk": 13, "model": "contenttypes.contenttype", "fields": {"model": "periodictask", "name": "periodic task", "app_label": "djcelery"}}, {"pk": 12, "model": "contenttypes.contenttype", "fields": {"model": "periodictasks", "name": "periodic tasks", "app_label": "djcelery"}}, {"pk": 1, "model": "contenttypes.contenttype", "fields": {"model": "permission", "name": "permission", "app_label": "auth"}}, {"pk": 25, "model": "contenttypes.contenttype", "fields": {"model": "recurrence", "name": "recurrence", "app_label": "spa"}}, {"pk": 33, "model": "contenttypes.contenttype", "fields": {"model": "release", "name": "release", "app_label": "spa"}}, {"pk": 34, "model": "contenttypes.contenttype", "fields": {"model": "releaseaudio", "name": "release audio", "app_label": "spa"}}, {"pk": 9, "model": "contenttypes.contenttype", "fields": {"model": "tasksetmeta", "name": "saved group result", "app_label": "djcelery"}}, {"pk": 5, "model": "contenttypes.contenttype", "fields": {"model": "session", "name": "session", "app_label": "sessions"}}, {"pk": 6, "model": "contenttypes.contenttype", "fields": {"model": "site", "name": "site", "app_label": "sites"}}, {"pk": 36, "model": "contenttypes.contenttype", "fields": {"model": "socialaccount", "name": "social account", "app_label": "socialaccount"}}, {"pk": 35, "model": "contenttypes.contenttype", "fields": {"model": "socialapp", "name": "social app", "app_label": "socialaccount"}}, {"pk": 37, "model": "contenttypes.contenttype", "fields": {"model": "socialtoken", "name": "social token", "app_label": "socialaccount"}}, {"pk": 15, "model": "contenttypes.contenttype", "fields": {"model": "taskstate", "name": "task", "app_label": "djcelery"}}, {"pk": 8, "model": "contenttypes.contenttype", "fields": {"model": "taskmeta", "name": "task state", "app_label": "djcelery"}}, {"pk": 3, "model": "contenttypes.contenttype", "fields": {"model": "user", "name": "user", "app_label": "auth"}}, {"pk": 22, "model": "contenttypes.contenttype", "fields": {"model": "userprofile", "name": "user profile", "app_label": "spa"}}, {"pk": 28, "model": "contenttypes.contenttype", "fields": {"model": "venue", "name": "venue", "app_label": "spa"}}, {"pk": 14, "model": "contenttypes.contenttype", "fields": {"model": "workerstate", "name": "worker", "app_label": "djcelery"}}, {"pk": 23, "model": "contenttypes.contenttype", "fields": {"model": "_activity", "name": "_ activity", "app_label": "spa"}}, {"pk": 24, "model": "contenttypes.contenttype", "fields": {"model": "_lookup", "name": "_ lookup", "app_label": "spa"}}, {"pk": "162503896bf8a72c2bbdbbd5b6c1d154", "model": "sessions.session", "fields": {"expire_date": "2012-08-29T12:02:19", "session_data": "YTY1MTgyNGE5NGM2MDAwNjM1MTFiOTcyZmMwYTg1ZjczOWMwMDkzOTqAAn1xAShVEl9hdXRoX3Vz\nZXJfYmFja2VuZHECVSlkamFuZ28uY29udHJpYi5hdXRoLmJhY2tlbmRzLk1vZGVsQmFja2VuZHED\nVQ1fYXV0aF91c2VyX2lkcQSKAQF1Lg==\n"}}, {"pk": "7db9a1c642bd0e87223e73644877b061", "model": "sessions.session", "fields": {"expire_date": "2012-08-29T12:01:52", "session_data": "YWYzM2FhYTAzMGVlODNhM2NhZWViYjBlZmRjYmQxYjViM2RkMjkwZjqAAn1xAS4=\n"}}, {"pk": "a1e93c36ae8d236b3812e2e089eca589", "model": "sessions.session", "fields": {"expire_date": "2012-08-29T12:01:52", "session_data": "YWYzM2FhYTAzMGVlODNhM2NhZWViYjBlZmRjYmQxYjViM2RkMjkwZjqAAn1xAS4=\n"}}, {"pk": "a99901eb48c7b3c4fce44cfee90821a5", "model": "sessions.session", "fields": {"expire_date": "2012-08-29T12:01:52", "session_data": "YWYzM2FhYTAzMGVlODNhM2NhZWViYjBlZmRjYmQxYjViM2RkMjkwZjqAAn1xAS4=\n"}}, {"pk": "d393bac6122938719c8da08ee5997a8f", "model": "sessions.session", "fields": {"expire_date": "2012-08-29T12:01:52", "session_data": "YWYzM2FhYTAzMGVlODNhM2NhZWViYjBlZmRjYmQxYjViM2RkMjkwZjqAAn1xAS4=\n"}}, {"pk": 1, "model": "sites.site", "fields": {"domain": "example.com", "name": "example.com"}}, {"pk": 1, "model": "notification.noticetype", "fields": {"default": 2, "description": "avatar have been updated", "display": "Avatar Updated", "label": "avatar_updated"}}, {"pk": 2, "model": "notification.noticetype", "fields": {"default": 2, "description": "a friend has updated his avatar", "display": "Friend Updated Avatar", "label": "avatar_friend_updated"}}, {"pk": 1, "model": "spa._lookup", "fields": {"description": "Daily"}}, {"pk": 2, "model": "spa._lookup", "fields": {"description": "Weekly"}}, {"pk": 3, "model": "spa._lookup", "fields": {"description": "Monthly"}}, {"pk": 1, "model": "spa.recurrence", "fields": {}}, {"pk": 2, "model": "spa.recurrence", "fields": {}}, {"pk": 3, "model": "spa.recurrence", "fields": {}}, {"pk": 1, "model": "spa.mix", "fields": {"upload_date": "2012-04-17T17:46:26", "local_file": "mixes/June2010.mp3", "description": "Marbert Rocell - Beats Like Birds\r\nMoto Clara - Silently\r\nBroad Bean Band - OkiDoki (Fish Go Deep Mix)\r\nJay Shepheard - Umzug\r\nThe Juan MacLean - Happy House\r\nScope - Runnin' The Game\r\nJayson Brothers - The Game\r\nSezer Uysal & Everen Ulosoy - Singing In The Bathtub\r\nLatour - Blue\r\nPol_On - Toga\r\nArmando - Don't Take It\r\nDaniel Paul - Outta Space\r\nFlight Facilities feat Giselle - Crave You\r\nPhonique feat Erlend Oye - Casualties (Morgan Geist remix)", "title": "June 2010", "mix_image": "mix-images/fergalmoran/crazymix.jpg", "is_active": true, "download_url": "mixes/June2010.mp3", "user": 1, "stream_url": "mixes/June2010.mp3"}}, {"pk": 9, "model": "spa.mix", "fields": {"upload_date": "2012-05-06T23:03:51", "local_file": "mixes/Deepsouthsounds/Andre Lodemann - Fragments Podcast.mp3", "description": "01. Latecomer - Cosmic Cart - Faces Records\r\n02. Andre Lodemann - Going To The Core feat. Nathalie Claude - BWR\r\n03. Prommer & Barck - Sleeping Beauty (Broken Reform Rmx) - Derwin\r\n04. Franck Roger - Hustling Peoples - Real Tone\r\n05. Acos Coolkas - Dont Fly Away (Jimpster Dub) - Audio Tonic\r\n06. Manuel Tur - About To Fall - Mild Pitch\r\n07. Kevin Saunderson feat. Inner City - Future (Kenny Larkin Tension Mix) AL Edit\r\n08. Paul Loraine - Envy (Funk DVoid Remix) - Bigger Deer\r\n09. Magic Mountain High - Schnitzel Box 1 - Untitled 1 - Workshop\r\n10. Ian Pooley - Indigo - Pokerflat\r\n11. Charles Webster feat. Thandi Draai - Fight For Freedom (Atjazz Astro Remix) - Miso", "title": "Andre Lodemann \"Fragments\"", "mix_image": "mix-images/Deepsouthsounds/lodemann.jpg", "is_active": true, "download_url": "NOTHING", "user": 1, "stream_url": "NOTHING"}}, {"pk": 11, "model": "spa.mix", "fields": {"upload_date": "2012-05-13T19:45:57", "local_file": "mixes/Deepsouthsounds/Brawther - BackToBasics Podcast 01.mp3", "description": "taken from back to basics podcast1", "title": "Brawther \"back to basics\"", "mix_image": "mix-images/Deepsouthsounds/brawther.jpg", "is_active": true, "download_url": "/", "user": 1, "stream_url": "/"}}, {"pk": 12, "model": "spa.mix", "fields": {"upload_date": "2012-05-14T22:09:30", "local_file": "mixes/Deepsouthsounds/chillout mix - Bruen.mp3", "description": "1.tom midleton - optimysic\r\n2.digby jones - pina colada\r\n3.crazy p - you've lost that loving feeling\r\n4.jakatta - one fine day\r\n5.st.germain - sure thing\r\n6.moby - porcelain\r\n7.max melvin - whatever\r\n8.bliss - dontlook back (fug mix)\r\n9.ulrich schnauss - passing by\r\n10.groove armada - fireside favorite\r\n11.bullitnuts - heavy air\r\n12.aim - just passin thru\r\n13.crazy p - play it cool\r\n", "title": "Robert Bruen \"chilled\"", "mix_image": "mix-images/Deepsouthsounds/chillout mix 1 Album Art.jpg", "is_active": true, "download_url": "/", "user": 1, "stream_url": "/"}}, {"pk": 16, "model": "spa.mix", "fields": {"upload_date": "2012-05-24T18:00:22", "local_file": "mixes/Deepsouthsounds/deep love tigerskin.mp3", "description": "mp3", "title": "tigerskin", "mix_image": "", "is_active": true, "download_url": "/", "user": 1, "stream_url": "/"}}, {"pk": 17, "model": "spa.mix", "fields": {"upload_date": "2012-05-27T10:02:31", "local_file": "mixes/Deepsouthsounds/house_lo.mp3", "description": "teste", "title": "Test", "mix_image": "", "is_active": true, "download_url": "", "user": 1, "stream_url": ""}}, {"pk": 1, "model": "spa.label", "fields": {"name": "Test Label 1"}}, {"pk": 2, "model": "spa.label", "fields": {"name": "BEEF Recordings"}}, {"pk": 3, "model": "spa.label", "fields": {"name": "Rauschzeit"}}, {"pk": 4, "model": "spa.label", "fields": {"name": "Lost My Dog"}}, {"pk": 1, "model": "spa.release", "fields": {"embed_code": "", "release_image": "release-images/4f8ea02e-e2dd-11e1-a30e-00163e1b2ddf/artworks-000028156348-q5glvm-t200x200.jpg", "release_label": 2, "release_date": "2012-08-19", "is_active": true, "release_title": "Got To Pray (Moodymanc's higher state mix)", "user": 1, "release_description": "Out next week on BEEF recordings... this is the first of 3 mixes I did for the mighty Nikola Gala, the other two for later release... The release pack includes a great mix by the BEEF head honchos Shades of Grey too... :) As ever, all support is very much appreciated!", "release_artist": "Nikola Gala"}}, {"pk": 2, "model": "spa.release", "fields": {"embed_code": "", "release_image": "release-images/9b028332-e2e1-11e1-a0bb-00163e1b2ddf/artworks-000028220406-hhpwae-t200x200.jpg", "release_label": 3, "release_date": "2012-09-01", "is_active": true, "release_title": "Own Thing ", "user": 1, "release_description": "\"Rauschzeit\" flushes your ears with warm and deep sounds\r\n- dizziness caused by an oldschool bass and available to you only on an analog record - VINYL !\r\n\r\nThe first release features the Berlin Vinyl-Dj Tagtr\u00c3\u00a4umer\u00c2\u00b2\r\nand is supported by amazing remixes by Oscar and Philipp Ort.\r\nReleased by: Rauschzeit\r\nRelease/catalogue number: RZ001\r\nRelease date: Sep 1, 2012 ", "release_artist": "Tagtr\u00c3\u00a4umer\u00c2\u00b2"}}, {"pk": 3, "model": "spa.release", "fields": {"embed_code": "", "release_image": "release-images/e8b6e0c8-e2e1-11e1-a39a-00163e1b2ddf/artworks-000028156319-usvb8y-t200x200.jpg", "release_label": 4, "release_date": "2012-09-03", "is_active": true, "release_title": "Inner City EP ", "user": 1, "release_description": "Dale Howard makes his second appearance on Lost My Dog following the 'Merrt EP\u00e2 earlier in 2012. The 'Inner City EP\u00e2 offers 4 more shining examples of Dale's take on garage-influenced house music, with huge basslines and skipping beats paving the way for vintage synth stabs.\r\n\r\nIt's a sound which has seen him hit the top of the sales charts for labels including Neurotraxx Deluxe, Off Recordings and Fear Of Flying. Dale has future releases penned for Noir and Morris Audio, as well as his own Static Audio imprint.\r\n\r\nLinks:\r\nhttps://www.facebook.com/dalehowardmusic\r\nhttp://www.lostmydog.net\r\nhttp://www.facebook.com/lostmydog\r\nReleased by: Lost My Dog\r\nRelease/catalogue number: LMD063\r\nRelease date: Sep 3, 2012 ", "release_artist": "Dale Howard "}}, {"pk": 1, "model": "socialaccount.socialapp", "fields": {"key": "154504534677009", "secret": "8eb42253ef42e3133ee76348255c2d78", "site": 1, "name": "Facebook", "provider": "facebook"}}, {"pk": 2, "model": "socialaccount.socialapp", "fields": {"key": "qmvJ6tptgd8G9T9WYp6P3Q", "secret": "ts6bYmZdnYxj7EscOvfz7YTwHu7r8OVGTkZWKhYqex8", "site": 1, "name": "Twitter", "provider": "twitter"}}, {"pk": 19, "model": "auth.permission", "fields": {"codename": "add_logentry", "name": "Can add log entry", "content_type": 7}}, {"pk": 20, "model": "auth.permission", "fields": {"codename": "change_logentry", "name": "Can change log entry", "content_type": 7}}, {"pk": 21, "model": "auth.permission", "fields": {"codename": "delete_logentry", "name": "Can delete log entry", "content_type": 7}}, {"pk": 4, "model": "auth.permission", "fields": {"codename": "add_group", "name": "Can add group", "content_type": 2}}, {"pk": 5, "model": "auth.permission", "fields": {"codename": "change_group", "name": "Can change group", "content_type": 2}}, {"pk": 6, "model": "auth.permission", "fields": {"codename": "delete_group", "name": "Can delete group", "content_type": 2}}, {"pk": 1, "model": "auth.permission", "fields": {"codename": "add_permission", "name": "Can add permission", "content_type": 1}}, {"pk": 2, "model": "auth.permission", "fields": {"codename": "change_permission", "name": "Can change permission", "content_type": 1}}, {"pk": 3, "model": "auth.permission", "fields": {"codename": "delete_permission", "name": "Can delete permission", "content_type": 1}}, {"pk": 7, "model": "auth.permission", "fields": {"codename": "add_user", "name": "Can add user", "content_type": 3}}, {"pk": 8, "model": "auth.permission", "fields": {"codename": "change_user", "name": "Can change user", "content_type": 3}}, {"pk": 9, "model": "auth.permission", "fields": {"codename": "delete_user", "name": "Can delete user", "content_type": 3}}, {"pk": 46, "model": "auth.permission", "fields": {"codename": "add_avatar", "name": "Can add avatar", "content_type": 16}}, {"pk": 47, "model": "auth.permission", "fields": {"codename": "change_avatar", "name": "Can change avatar", "content_type": 16}}, {"pk": 48, "model": "auth.permission", "fields": {"codename": "delete_avatar", "name": "Can delete avatar", "content_type": 16}}, {"pk": 10, "model": "auth.permission", "fields": {"codename": "add_contenttype", "name": "Can add content type", "content_type": 4}}, {"pk": 11, "model": "auth.permission", "fields": {"codename": "change_contenttype", "name": "Can change content type", "content_type": 4}}, {"pk": 12, "model": "auth.permission", "fields": {"codename": "delete_contenttype", "name": "Can delete content type", "content_type": 4}}, {"pk": 31, "model": "auth.permission", "fields": {"codename": "add_crontabschedule", "name": "Can add crontab", "content_type": 11}}, {"pk": 32, "model": "auth.permission", "fields": {"codename": "change_crontabschedule", "name": "Can change crontab", "content_type": 11}}, {"pk": 33, "model": "auth.permission", "fields": {"codename": "delete_crontabschedule", "name": "Can delete crontab", "content_type": 11}}, {"pk": 28, "model": "auth.permission", "fields": {"codename": "add_intervalschedule", "name": "Can add interval", "content_type": 10}}, {"pk": 29, "model": "auth.permission", "fields": {"codename": "change_intervalschedule", "name": "Can change interval", "content_type": 10}}, {"pk": 30, "model": "auth.permission", "fields": {"codename": "delete_intervalschedule", "name": "Can delete interval", "content_type": 10}}, {"pk": 37, "model": "auth.permission", "fields": {"codename": "add_periodictask", "name": "Can add periodic task", "content_type": 13}}, {"pk": 38, "model": "auth.permission", "fields": {"codename": "change_periodictask", "name": "Can change periodic task", "content_type": 13}}, {"pk": 39, "model": "auth.permission", "fields": {"codename": "delete_periodictask", "name": "Can delete periodic task", "content_type": 13}}, {"pk": 34, "model": "auth.permission", "fields": {"codename": "add_periodictasks", "name": "Can add periodic tasks", "content_type": 12}}, {"pk": 35, "model": "auth.permission", "fields": {"codename": "change_periodictasks", "name": "Can change periodic tasks", "content_type": 12}}, {"pk": 36, "model": "auth.permission", "fields": {"codename": "delete_periodictasks", "name": "Can delete periodic tasks", "content_type": 12}}, {"pk": 22, "model": "auth.permission", "fields": {"codename": "add_taskmeta", "name": "Can add task state", "content_type": 8}}, {"pk": 23, "model": "auth.permission", "fields": {"codename": "change_taskmeta", "name": "Can change task state", "content_type": 8}}, {"pk": 24, "model": "auth.permission", "fields": {"codename": "delete_taskmeta", "name": "Can delete task state", "content_type": 8}}, {"pk": 25, "model": "auth.permission", "fields": {"codename": "add_tasksetmeta", "name": "Can add saved group result", "content_type": 9}}, {"pk": 26, "model": "auth.permission", "fields": {"codename": "change_tasksetmeta", "name": "Can change saved group result", "content_type": 9}}, {"pk": 27, "model": "auth.permission", "fields": {"codename": "delete_tasksetmeta", "name": "Can delete saved group result", "content_type": 9}}, {"pk": 43, "model": "auth.permission", "fields": {"codename": "add_taskstate", "name": "Can add task", "content_type": 15}}, {"pk": 44, "model": "auth.permission", "fields": {"codename": "change_taskstate", "name": "Can change task", "content_type": 15}}, {"pk": 45, "model": "auth.permission", "fields": {"codename": "delete_taskstate", "name": "Can delete task", "content_type": 15}}, {"pk": 40, "model": "auth.permission", "fields": {"codename": "add_workerstate", "name": "Can add worker", "content_type": 14}}, {"pk": 41, "model": "auth.permission", "fields": {"codename": "change_workerstate", "name": "Can change worker", "content_type": 14}}, {"pk": 42, "model": "auth.permission", "fields": {"codename": "delete_workerstate", "name": "Can delete worker", "content_type": 14}}, {"pk": 118, "model": "auth.permission", "fields": {"codename": "add_emailaddress", "name": "Can add email address", "content_type": 40}}, {"pk": 119, "model": "auth.permission", "fields": {"codename": "change_emailaddress", "name": "Can change email address", "content_type": 40}}, {"pk": 120, "model": "auth.permission", "fields": {"codename": "delete_emailaddress", "name": "Can delete email address", "content_type": 40}}, {"pk": 121, "model": "auth.permission", "fields": {"codename": "add_emailconfirmation", "name": "Can add email confirmation", "content_type": 41}}, {"pk": 122, "model": "auth.permission", "fields": {"codename": "change_emailconfirmation", "name": "Can change email confirmation", "content_type": 41}}, {"pk": 123, "model": "auth.permission", "fields": {"codename": "delete_emailconfirmation", "name": "Can delete email confirmation", "content_type": 41}}, {"pk": 55, "model": "auth.permission", "fields": {"codename": "add_notice", "name": "Can add notice", "content_type": 19}}, {"pk": 56, "model": "auth.permission", "fields": {"codename": "change_notice", "name": "Can change notice", "content_type": 19}}, {"pk": 57, "model": "auth.permission", "fields": {"codename": "delete_notice", "name": "Can delete notice", "content_type": 19}}, {"pk": 58, "model": "auth.permission", "fields": {"codename": "add_noticequeuebatch", "name": "Can add notice queue batch", "content_type": 20}}, {"pk": 59, "model": "auth.permission", "fields": {"codename": "change_noticequeuebatch", "name": "Can change notice queue batch", "content_type": 20}}, {"pk": 60, "model": "auth.permission", "fields": {"codename": "delete_noticequeuebatch", "name": "Can delete notice queue batch", "content_type": 20}}, {"pk": 52, "model": "auth.permission", "fields": {"codename": "add_noticesetting", "name": "Can add notice setting", "content_type": 18}}, {"pk": 53, "model": "auth.permission", "fields": {"codename": "change_noticesetting", "name": "Can change notice setting", "content_type": 18}}, {"pk": 54, "model": "auth.permission", "fields": {"codename": "delete_noticesetting", "name": "Can delete notice setting", "content_type": 18}}, {"pk": 49, "model": "auth.permission", "fields": {"codename": "add_noticetype", "name": "Can add notice type", "content_type": 17}}, {"pk": 50, "model": "auth.permission", "fields": {"codename": "change_noticetype", "name": "Can change notice type", "content_type": 17}}, {"pk": 51, "model": "auth.permission", "fields": {"codename": "delete_noticetype", "name": "Can delete notice type", "content_type": 17}}, {"pk": 61, "model": "auth.permission", "fields": {"codename": "add_observeditem", "name": "Can add observed item", "content_type": 21}}, {"pk": 62, "model": "auth.permission", "fields": {"codename": "change_observeditem", "name": "Can change observed item", "content_type": 21}}, {"pk": 63, "model": "auth.permission", "fields": {"codename": "delete_observeditem", "name": "Can delete observed item", "content_type": 21}}, {"pk": 115, "model": "auth.permission", "fields": {"codename": "add_openidnonce", "name": "Can add open id nonce", "content_type": 39}}, {"pk": 116, "model": "auth.permission", "fields": {"codename": "change_openidnonce", "name": "Can change open id nonce", "content_type": 39}}, {"pk": 117, "model": "auth.permission", "fields": {"codename": "delete_openidnonce", "name": "Can delete open id nonce", "content_type": 39}}, {"pk": 112, "model": "auth.permission", "fields": {"codename": "add_openidstore", "name": "Can add open id store", "content_type": 38}}, {"pk": 113, "model": "auth.permission", "fields": {"codename": "change_openidstore", "name": "Can change open id store", "content_type": 38}}, {"pk": 114, "model": "auth.permission", "fields": {"codename": "delete_openidstore", "name": "Can delete open id store", "content_type": 38}}, {"pk": 13, "model": "auth.permission", "fields": {"codename": "add_session", "name": "Can add session", "content_type": 5}}, {"pk": 14, "model": "auth.permission", "fields": {"codename": "change_session", "name": "Can change session", "content_type": 5}}, {"pk": 15, "model": "auth.permission", "fields": {"codename": "delete_session", "name": "Can delete session", "content_type": 5}}, {"pk": 16, "model": "auth.permission", "fields": {"codename": "add_site", "name": "Can add site", "content_type": 6}}, {"pk": 17, "model": "auth.permission", "fields": {"codename": "change_site", "name": "Can change site", "content_type": 6}}, {"pk": 18, "model": "auth.permission", "fields": {"codename": "delete_site", "name": "Can delete site", "content_type": 6}}, {"pk": 106, "model": "auth.permission", "fields": {"codename": "add_socialaccount", "name": "Can add social account", "content_type": 36}}, {"pk": 107, "model": "auth.permission", "fields": {"codename": "change_socialaccount", "name": "Can change social account", "content_type": 36}}, {"pk": 108, "model": "auth.permission", "fields": {"codename": "delete_socialaccount", "name": "Can delete social account", "content_type": 36}}, {"pk": 103, "model": "auth.permission", "fields": {"codename": "add_socialapp", "name": "Can add social app", "content_type": 35}}, {"pk": 104, "model": "auth.permission", "fields": {"codename": "change_socialapp", "name": "Can change social app", "content_type": 35}}, {"pk": 105, "model": "auth.permission", "fields": {"codename": "delete_socialapp", "name": "Can delete social app", "content_type": 35}}, {"pk": 109, "model": "auth.permission", "fields": {"codename": "add_socialtoken", "name": "Can add social token", "content_type": 37}}, {"pk": 110, "model": "auth.permission", "fields": {"codename": "change_socialtoken", "name": "Can change social token", "content_type": 37}}, {"pk": 111, "model": "auth.permission", "fields": {"codename": "delete_socialtoken", "name": "Can delete social token", "content_type": 37}}, {"pk": 79, "model": "auth.permission", "fields": {"codename": "add_comment", "name": "Can add comment", "content_type": 27}}, {"pk": 80, "model": "auth.permission", "fields": {"codename": "change_comment", "name": "Can change comment", "content_type": 27}}, {"pk": 81, "model": "auth.permission", "fields": {"codename": "delete_comment", "name": "Can delete comment", "content_type": 27}}, {"pk": 85, "model": "auth.permission", "fields": {"codename": "add_event", "name": "Can add event", "content_type": 29}}, {"pk": 86, "model": "auth.permission", "fields": {"codename": "change_event", "name": "Can change event", "content_type": 29}}, {"pk": 87, "model": "auth.permission", "fields": {"codename": "delete_event", "name": "Can delete event", "content_type": 29}}, {"pk": 88, "model": "auth.permission", "fields": {"codename": "add_label", "name": "Can add label", "content_type": 30}}, {"pk": 89, "model": "auth.permission", "fields": {"codename": "change_label", "name": "Can change label", "content_type": 30}}, {"pk": 90, "model": "auth.permission", "fields": {"codename": "delete_label", "name": "Can delete label", "content_type": 30}}, {"pk": 76, "model": "auth.permission", "fields": {"codename": "add_mix", "name": "Can add mix", "content_type": 26}}, {"pk": 77, "model": "auth.permission", "fields": {"codename": "change_mix", "name": "Can change mix", "content_type": 26}}, {"pk": 78, "model": "auth.permission", "fields": {"codename": "delete_mix", "name": "Can delete mix", "content_type": 26}}, {"pk": 91, "model": "auth.permission", "fields": {"codename": "add_mixlike", "name": "Can add mix like", "content_type": 31}}, {"pk": 92, "model": "auth.permission", "fields": {"codename": "change_mixlike", "name": "Can change mix like", "content_type": 31}}, {"pk": 93, "model": "auth.permission", "fields": {"codename": "delete_mixlike", "name": "Can delete mix like", "content_type": 31}}, {"pk": 94, "model": "auth.permission", "fields": {"codename": "add_mixplay", "name": "Can add mix play", "content_type": 32}}, {"pk": 95, "model": "auth.permission", "fields": {"codename": "change_mixplay", "name": "Can change mix play", "content_type": 32}}, {"pk": 96, "model": "auth.permission", "fields": {"codename": "delete_mixplay", "name": "Can delete mix play", "content_type": 32}}, {"pk": 73, "model": "auth.permission", "fields": {"codename": "add_recurrence", "name": "Can add recurrence", "content_type": 25}}, {"pk": 74, "model": "auth.permission", "fields": {"codename": "change_recurrence", "name": "Can change recurrence", "content_type": 25}}, {"pk": 75, "model": "auth.permission", "fields": {"codename": "delete_recurrence", "name": "Can delete recurrence", "content_type": 25}}, {"pk": 97, "model": "auth.permission", "fields": {"codename": "add_release", "name": "Can add release", "content_type": 33}}, {"pk": 98, "model": "auth.permission", "fields": {"codename": "change_release", "name": "Can change release", "content_type": 33}}, {"pk": 99, "model": "auth.permission", "fields": {"codename": "delete_release", "name": "Can delete release", "content_type": 33}}, {"pk": 100, "model": "auth.permission", "fields": {"codename": "add_releaseaudio", "name": "Can add release audio", "content_type": 34}}, {"pk": 101, "model": "auth.permission", "fields": {"codename": "change_releaseaudio", "name": "Can change release audio", "content_type": 34}}, {"pk": 102, "model": "auth.permission", "fields": {"codename": "delete_releaseaudio", "name": "Can delete release audio", "content_type": 34}}, {"pk": 64, "model": "auth.permission", "fields": {"codename": "add_userprofile", "name": "Can add user profile", "content_type": 22}}, {"pk": 65, "model": "auth.permission", "fields": {"codename": "change_userprofile", "name": "Can change user profile", "content_type": 22}}, {"pk": 66, "model": "auth.permission", "fields": {"codename": "delete_userprofile", "name": "Can delete user profile", "content_type": 22}}, {"pk": 82, "model": "auth.permission", "fields": {"codename": "add_venue", "name": "Can add venue", "content_type": 28}}, {"pk": 83, "model": "auth.permission", "fields": {"codename": "change_venue", "name": "Can change venue", "content_type": 28}}, {"pk": 84, "model": "auth.permission", "fields": {"codename": "delete_venue", "name": "Can delete venue", "content_type": 28}}, {"pk": 67, "model": "auth.permission", "fields": {"codename": "add__activity", "name": "Can add _ activity", "content_type": 23}}, {"pk": 68, "model": "auth.permission", "fields": {"codename": "change__activity", "name": "Can change _ activity", "content_type": 23}}, {"pk": 69, "model": "auth.permission", "fields": {"codename": "delete__activity", "name": "Can delete _ activity", "content_type": 23}}, {"pk": 70, "model": "auth.permission", "fields": {"codename": "add__lookup", "name": "Can add _ lookup", "content_type": 24}}, {"pk": 71, "model": "auth.permission", "fields": {"codename": "change__lookup", "name": "Can change _ lookup", "content_type": 24}}, {"pk": 72, "model": "auth.permission", "fields": {"codename": "delete__lookup", "name": "Can delete _ lookup", "content_type": 24}}, {"pk": 1, "model": "auth.user", "fields": {"username": "admin", "first_name": "", "last_name": "", "is_active": true, "is_superuser": true, "is_staff": true, "last_login": "2012-08-15T12:02:19", "groups": [], "user_permissions": [], "password": "pbkdf2_sha256$10000$lsSKdWneAZjn$VKly553yPHDZi5CUVCHv56I8Szxrjrmk6TS1/0JxuuM=", "email": "admin@deepsouthsounds.com", "date_joined": "2012-08-15T12:00:32"}}, {"pk": 6, "model": "admin.logentry", "fields": {"action_flag": 1, "action_time": "2012-08-15T12:11:48", "object_repr": "The Crucial Party", "object_id": "2", "change_message": "", "user": 1, "content_type": 29}}, {"pk": 5, "model": "admin.logentry", "fields": {"action_flag": 2, "action_time": "2012-08-15T12:09:12", "object_repr": "Go Deep", "object_id": "1", "change_message": "Changed event_description and event_recurrence.", "user": 1, "content_type": 29}}, {"pk": 4, "model": "admin.logentry", "fields": {"action_flag": 1, "action_time": "2012-08-15T12:05:40", "object_repr": "Go Deep", "object_id": "1", "change_message": "", "user": 1, "content_type": 29}}, {"pk": 3, "model": "admin.logentry", "fields": {"action_flag": 1, "action_time": "2012-08-15T12:04:48", "object_repr": "Recurrence object", "object_id": "3", "change_message": "", "user": 1, "content_type": 25}}, {"pk": 2, "model": "admin.logentry", "fields": {"action_flag": 1, "action_time": "2012-08-15T12:04:44", "object_repr": "Recurrence object", "object_id": "2", "change_message": "", "user": 1, "content_type": 25}}, {"pk": 1, "model": "admin.logentry", "fields": {"action_flag": 1, "action_time": "2012-08-15T12:04:40", "object_repr": "Recurrence object", "object_id": "1", "change_message": "", "user": 1, "content_type": 25}}, {"pk": 1, "model": "spa.userprofile", "fields": {"avatar_image": "", "display_name": "", "user": 1, "avatar_type": ""}}, {"pk": 1, "model": "spa.venue", "fields": {"venue_image": "venue-images/5344256c-e2fc-11e1-a282-00163e1b2ddf/Pavilion_Upstairs_1-894x600.jpg", "venue_address": "Carey's Lane", "user": 1, "venue_name": "The Pavillion"}}, {"pk": 1, "model": "spa.event", "fields": {"event_description": "\r\n\r\n\r\n\r\n\r\n\r\n\r\n
\"Fish \r\n

Deep soulful house with Greg and Shane on that Bozak mixer. All sorts of disco deviancy, soul explorations and rhythmic revelations

\r\n

Visit the artists website:

\r\n

www.fishgodeep.com

\r\n

 

\r\n

 

\r\n
", "attendees": [1], "event_time": "22:00:00", "event_title": "Go Deep", "event_recurrence": 3, "date_created": "2012-08-15", "event_date": "2012-08-31", "event_venue": 1}}, {"pk": 2, "model": "spa.event", "fields": {"event_description": "\r\n\r\n\r\n\r\n\r\n\r\n\r\n
\"The\r\n

A Cosmic Carousel of Sights and Sounds… “Sometimes in life you just got to Party”.

\r\n

Bored with the same old routine? Looking for a new night out? Then fret not folks, this could be the solution to all your problems.
The Crucial party is here to save your Soul, bring you closer to your inner child, make you shake like shakira and smile like a beauty queen.We feel that it’s time for a revolution,a dancing revolution, a social revolution,a visual revolution. So we say “Let’s make Party. Lets make Good Times”  and you say “Yes we can can”.
Every saturday the Crucial Party will be a culture club full of eye candy and stage axe, jukebox jugglers & visual attacks,poptastical treats from 60’s to new beats.
Music for Young Guns, Soul sista’s, Jazzy bro’s and Groovy twisters.
But this is not just about the tunes,we feel we can touch you in places never touched before.

\r\n

We feel It just might be  what you are needing. Karma For the People from under the steeple.
Its a Hot-pot of Lovers Rocking, Afro Poppin’, Turbo Boogie , Slam Dunk Funk,
Jezebels & Jokers, Soothsayers, Rebel city Playa’s and City Folk.

\r\n

Then it might be time to move your body to the rhythm of love and come join us at the Pav every saturday. So get on down to party down. 

\r\n

 

\r\n
", "attendees": [1], "event_time": "12:06:31", "event_title": "The Crucial Party", "event_recurrence": 2, "date_created": "2012-08-15", "event_date": "2012-08-15", "event_venue": 1}}] \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 9f53a9a..aa48d97 100644 --- a/requirements.txt +++ b/requirements.txt @@ -13,5 +13,6 @@ django-socialauth>=0.1.2c django-tastypie>=0.9.11 django-tinymce>=1.5.1b2 git+git://github.com/PaulUithol/backbone-tastypie.git#egg=backbone-tastypie +git+git://github.com/maraujop/django-crispy-forms.git#django-crispy-forms django-grappelli humanize \ No newline at end of file diff --git a/spa/admin.py b/spa/admin.py index 32a23ec..bb183f9 100644 --- a/spa/admin.py +++ b/spa/admin.py @@ -1,4 +1,5 @@ from django.contrib import admin +from spa.models.Recurrence import Recurrence from spa.models.Release import Release from spa.models.Event import Event from spa.models.Label import Label @@ -20,3 +21,4 @@ admin.site.register(Release, DefaultAdmin) admin.site.register(ReleaseAudio) admin.site.register(Venue) admin.site.register(Event) +admin.site.register(Recurrence) diff --git a/spa/api/v1/CommentResource.py b/spa/api/v1/CommentResource.py index 59c117a..b417a84 100644 --- a/spa/api/v1/CommentResource.py +++ b/spa/api/v1/CommentResource.py @@ -32,5 +32,5 @@ class CommentResource(BackboneCompatibleResource): def dehydrate(self, bundle): bundle.data['avatar_image'] = bundle.obj.user.get_profile().get_avatar_image(150) bundle.data['user_url'] = bundle.obj.user.get_absolute_url() - bundle.data['user_name'] = bundle.obj.user.get_profile().nice_name() + bundle.data['user_name'] = bundle.obj.user.get_profile().nice_name() or bundle.obj.user.get_profile().display_name return bundle \ No newline at end of file diff --git a/spa/api/v1/UserResource.py b/spa/api/v1/UserResource.py new file mode 100644 index 0000000..4f12fb7 --- /dev/null +++ b/spa/api/v1/UserResource.py @@ -0,0 +1,21 @@ +from django.conf.urls import url +from tastypie.authorization import Authorization +from spa.api.v1.BackboneCompatibleResource import BackboneCompatibleResource +from spa.models import UserProfile + +class UserResource(BackboneCompatibleResource): + class Meta: + queryset = UserProfile.objects.all() + authorization = Authorization() + + def dehydrate(self, bundle): + bundle.data['display_name'] = bundle.obj.display_name + bundle.data['first_name'] = bundle.obj.first_name + bundle.data['last_name'] = bundle.obj.last_name + bundle.data['email'] = bundle.obj.email + return bundle + + def override_urls(self): + return [ + url(r"^(?P%s)/(?P[\w\d_.-]+)/$" % self._meta.resource_name, self.wrap_view('dispatch_detail'), name="api_dispatch_detail"), + ] \ No newline at end of file diff --git a/spa/forms.py b/spa/forms.py new file mode 100644 index 0000000..8960d6d --- /dev/null +++ b/spa/forms.py @@ -0,0 +1,73 @@ +from crispy_forms.bootstrap import FormActions +from crispy_forms.layout import Submit, Fieldset, Layout +from django import forms +from django.contrib.auth.models import User + +from django.forms.models import ModelForm +from crispy_forms.helper import FormHelper +from spa.models.UserProfile import UserProfile + +class UserForm(ModelForm): + avatar_image_select = forms.ChoiceField( + choices=( + ('gravatar', "Use gravatar image."), + ('social', "Use Twitter/Facebook image."), + ('custom', "Use custom image (upload below).") + ), + + label="Avatar Image", + widget=forms.RadioSelect, + initial='option_gravatar', + help_text="Select the source of your avatar image." + ) + avatar_image = forms.ImageField( + label="", + required=False + ) + + class Meta: + model = User + fields = ('email', 'first_name', 'last_name') + + def __init__(self, *args, **kwargs): + super(UserForm, self).__init__(*args, **kwargs) + + self.helper = FormHelper() + self.helper.layout = Layout( + Fieldset( + 'User details', + 'display_name', + 'email', + 'first_name', + 'last_name', + 'avatar_image_select', + 'avatar_image' + ), + FormActions( + Submit('save_changes', 'Save changes', css_class="btn-primary"), + Submit('cancel', 'Cancel'), + ) + ) + + self.helper.form_class = 'form-horizontal' + self.helper.form_id = 'id-new-user-form' + + self.helper.form_method = 'post' + self.helper.form_error_title = 'Ooopsies' + self.helper.formset_error_title = 'Ooopsies' + + self.helper.form_show_errors = True + + def save(self, *args, **kwargs): + user = super(UserForm, self).save(*args, **kwargs) + profile = UserProfile.objects.filter(user=user)[0] + if profile is None: + profile = UserProfile() + + profile.user = user + profile.avatar_type = self.cleaned_data['avatar_image_select'] + profile.avatar_image = self.cleaned_data['avatar_image'] + # and so on with the remaining fields + profile.save() + return profile + diff --git a/spa/models/Comment.py b/spa/models/Comment.py index c941945..4f113aa 100644 --- a/spa/models/Comment.py +++ b/spa/models/Comment.py @@ -1,11 +1,10 @@ from django.contrib.auth.models import User from django.db import models -from spa.models.__BaseModel import __BaseModel +from spa.models._BaseModel import _BaseModel from spa.models.Mix import Mix -class Comment(__BaseModel): +class Comment(_BaseModel): class Meta: - db_table = 'www_comment' app_label = 'spa' user = models.ForeignKey(User, editable=False) diff --git a/spa/models/Event.py b/spa/models/Event.py index 473de62..008cd6e 100644 --- a/spa/models/Event.py +++ b/spa/models/Event.py @@ -2,11 +2,11 @@ from datetime import datetime from django.contrib.auth.models import User from django.db import models from tinymce import models as tinymce_models +from spa.models import Recurrence from spa.models.Venue import Venue class Event(models.Model): class Meta: - db_table = 'www_event' app_label = 'spa' event_venue = models.ForeignKey(Venue) @@ -17,6 +17,7 @@ class Event(models.Model): date_created = models.DateField(default=datetime.now()) event_title = models.CharField(max_length=250) event_description = tinymce_models.HTMLField() + event_recurrence = models.ForeignKey(Recurrence) attendees = models.ManyToManyField(User, related_name='attendees') diff --git a/spa/models/Label.py b/spa/models/Label.py index 1036394..5b58c56 100644 --- a/spa/models/Label.py +++ b/spa/models/Label.py @@ -1,9 +1,8 @@ from django.db import models -from spa.models.__BaseModel import __BaseModel +from spa.models._BaseModel import _BaseModel -class Label(__BaseModel): +class Label(_BaseModel): class Meta: - db_table = 'www_label' app_label = 'spa' name = models.CharField(max_length=100) diff --git a/spa/models/Mix.py b/spa/models/Mix.py index 1b77d23..9609ce9 100644 --- a/spa/models/Mix.py +++ b/spa/models/Mix.py @@ -5,7 +5,7 @@ import os from core.utils.file import generate_save_file_name from dss import settings from spa.models.UserProfile import UserProfile -from spa.models.__BaseModel import __BaseModel +from spa.models._BaseModel import _BaseModel from tasks.waveform import create_waveform_task from django.db import models @@ -15,9 +15,8 @@ def mix_file_name(instance, filename): def mix_image_name(instance, filename): return generate_save_file_name('mix-images', filename) -class Mix(__BaseModel): +class Mix(_BaseModel): class Meta: - db_table = 'www_mix' app_label = 'spa' title = models.CharField(max_length=50) diff --git a/spa/models/MixLike.py b/spa/models/MixLike.py index 0ece909..09d15b6 100644 --- a/spa/models/MixLike.py +++ b/spa/models/MixLike.py @@ -1,10 +1,9 @@ from django.db import models from spa.models.Mix import Mix -from spa.models.__Activity import __Activity +from spa.models._Activity import _Activity -class MixLike(__Activity): +class MixLike(_Activity): class Meta: - db_table = 'www_like' app_label = 'spa' mix = models.ForeignKey(Mix, related_name='likes') \ No newline at end of file diff --git a/spa/models/MixPlay.py b/spa/models/MixPlay.py index 40f892a..1cf1f4a 100644 --- a/spa/models/MixPlay.py +++ b/spa/models/MixPlay.py @@ -1,10 +1,9 @@ from django.db import models from spa.models.Mix import Mix -from spa.models.__Activity import __Activity +from spa.models._Activity import _Activity -class MixPlay(__Activity): +class MixPlay(_Activity): class Meta: - db_table = 'www_play' app_label = 'spa' mix = models.ForeignKey(Mix, related_name='plays') \ No newline at end of file diff --git a/spa/models/Recurrence.py b/spa/models/Recurrence.py new file mode 100644 index 0000000..deb6e5b --- /dev/null +++ b/spa/models/Recurrence.py @@ -0,0 +1,4 @@ +from spa.models._Lookup import _Lookup + +class Recurrence(_Lookup): + pass \ No newline at end of file diff --git a/spa/models/Release.py b/spa/models/Release.py index 099a83a..b0ccb66 100644 --- a/spa/models/Release.py +++ b/spa/models/Release.py @@ -4,7 +4,7 @@ from core.utils.file import generate_save_file_name from dss import settings from spa.models.Label import Label from spa.models.UserProfile import UserProfile -from spa.models.__BaseModel import __BaseModel +from spa.models._BaseModel import _BaseModel def release_image_name(instance, filename): return generate_save_file_name('release-images', filename) @@ -12,9 +12,8 @@ def release_image_name(instance, filename): def release_file_name(instance, filename): return generate_save_file_name('release-audio', filename) -class Release(__BaseModel): +class Release(_BaseModel): class Meta: - db_table = 'www_release' app_label = 'spa' release_artist = models.CharField(max_length=100) @@ -44,9 +43,8 @@ class Release(__BaseModel): return qs -class ReleaseAudio(__BaseModel): +class ReleaseAudio(_BaseModel): class Meta: - db_table = 'www_releaseaudio' app_label = 'spa' def __unicode__(self): diff --git a/spa/models/UserProfile.py b/spa/models/UserProfile.py index 1735266..68e7155 100644 --- a/spa/models/UserProfile.py +++ b/spa/models/UserProfile.py @@ -6,17 +6,17 @@ from django.db import models from django.db.models.signals import post_save from django_gravatar.helpers import has_gravatar, get_gravatar_url from dss import settings -from spa.models.__BaseModel import __BaseModel +from spa.models._BaseModel import _BaseModel -class UserProfile(__BaseModel): +class UserProfile(_BaseModel): class Meta: - db_table = 'www_userprofile' app_label = 'spa' # This field is required. user = models.ForeignKey(User, unique=True) avatar_type = models.CharField(max_length=15) avatar_image = models.ImageField(blank=True, upload_to='/avatars/') + display_name = models.CharField(blank=True, max_length=35) def create_user_profile(sender, instance, created, **kwargs): if created: @@ -43,7 +43,7 @@ class UserProfile(__BaseModel): return reverse('user_details', kwargs={'user_name': self.user.username}) def nice_name(self): - return self.first_name + ' ' + self.last_name + return self.display_name or self.first_name + ' ' + self.last_name def get_avatar_image(self, size=150): avatar_type = self.avatar_type @@ -62,4 +62,4 @@ class UserProfile(__BaseModel): elif avatar_type == 'custom' or avatar_type: return self.avatar_image.url - return urlparse.urljoin(settings.STAT, "img/default-avatar-32.png") \ No newline at end of file + return urlparse.urljoin(settings.STATIC_URL, "img/default-avatar-32.png") \ No newline at end of file diff --git a/spa/models/Venue.py b/spa/models/Venue.py index 6704295..3597a94 100644 --- a/spa/models/Venue.py +++ b/spa/models/Venue.py @@ -7,7 +7,6 @@ def venue_image_name(instance, filename): class Venue(models.Model): class Meta: - db_table = 'www_venue' app_label = 'spa' user = models.ForeignKey(User) diff --git a/spa/models/__Activity.py b/spa/models/_Activity.py similarity index 66% rename from spa/models/__Activity.py rename to spa/models/_Activity.py index 91fb706..7cf0fea 100644 --- a/spa/models/__Activity.py +++ b/spa/models/_Activity.py @@ -1,7 +1,7 @@ from django.contrib.auth.models import User from django.db import models -from spa.models.__BaseModel import __BaseModel +from spa.models._BaseModel import _BaseModel -class __Activity(__BaseModel): +class _Activity(_BaseModel): date = models.DateTimeField(auto_now=True) user = models.ForeignKey(User, null=True ) \ No newline at end of file diff --git a/spa/models/__BaseModel.py b/spa/models/_BaseModel.py similarity index 79% rename from spa/models/__BaseModel.py rename to spa/models/_BaseModel.py index 8a57c27..5314080 100644 --- a/spa/models/__BaseModel.py +++ b/spa/models/_BaseModel.py @@ -1,7 +1,7 @@ import logging from django.db import models -class __BaseModel(models.Model): +class _BaseModel(models.Model): logger = logging.getLogger(__name__) class Meta: abstract = True diff --git a/spa/models/_Lookup.py b/spa/models/_Lookup.py new file mode 100644 index 0000000..97e0288 --- /dev/null +++ b/spa/models/_Lookup.py @@ -0,0 +1,8 @@ +from django.db import models +from _BaseModel import _BaseModel + +class _Lookup(_BaseModel): + description = models.CharField(max_length=100) + + def __unicode__(self): + return self.description diff --git a/spa/models/__init__.py b/spa/models/__init__.py index 8b78743..1489113 100644 --- a/spa/models/__init__.py +++ b/spa/models/__init__.py @@ -1,6 +1,7 @@ -from __BaseModel import __BaseModel +from _BaseModel import _BaseModel from UserProfile import UserProfile -from __Activity import __Activity +from _Activity import _Activity +from Recurrence import Recurrence from Comment import Comment from Venue import Venue from Event import Event @@ -9,3 +10,16 @@ from Mix import Mix from MixLike import MixLike from MixPlay import MixPlay from Release import Release + +from django.db.models import signals +from django.contrib.auth.management import create_superuser +from django.contrib.auth import models as auth_app + +# Prevent interactive question about wanting a superuser created. (This +# code has to go in this otherwise empty "models" module so that it gets +# processed by the "syncdb" command during database creation.) + +signals.post_syncdb.disconnect( + create_superuser, + sender=auth_app, + dispatch_uid = "django.contrib.auth.management.create_superuser") \ No newline at end of file diff --git a/spa/templates.py b/spa/templates.py index 2faefea..c4d3567 100644 --- a/spa/templates.py +++ b/spa/templates.py @@ -1,9 +1,16 @@ from django.shortcuts import render_to_response from django.template.context import RequestContext +from spa.forms import UserForm __author__ = 'fergalm' def get_template(request, template_name): return render_to_response( 'views/%s.html' % template_name, - context_instance=RequestContext(request)) \ No newline at end of file + context_instance=RequestContext(request)) + +def get_template_ex(request, template_name): + html = render_to_response( + 'views/%s.html' % template_name, + context_instance=RequestContext(request, {'form': UserForm() })) + return html \ No newline at end of file diff --git a/spa/templatetags/spa_extras.py b/spa/templatetags/spa_extras.py index f73fc87..851a242 100644 --- a/spa/templatetags/spa_extras.py +++ b/spa/templatetags/spa_extras.py @@ -1,3 +1,4 @@ +import urlparse from allauth.socialaccount.models import SocialAccount from django import template from django.contrib.auth.models import User @@ -26,14 +27,14 @@ def avatar_image(user, size=150): gravatar_exists = has_gravatar(user.email) if gravatar_exists: return get_gravatar_url(user.email, size) - elif avatar_type == 'social': + elif avatar_type == 'social' or avatar_type == '': try: social_account = SocialAccount.objects.filter(user = user)[0] if social_account: provider = social_account.get_provider_account() return provider.get_avatar_url() except: - pass + return urlparse.urljoin(settings.STATIC_URL, "img/default-avatar-32.png") elif avatar_type == 'custom': return profile.avatar_image.url diff --git a/spa/urls.py b/spa/urls.py index 2708ce3..fb040e5 100644 --- a/spa/urls.py +++ b/spa/urls.py @@ -8,6 +8,7 @@ from spa.api.v1.MixResource import MixResource from spa.api.v1.ReleaseAudioResource import ReleaseAudioResource from spa.api.v1.ReleaseResource import ReleaseResource import spa +from spa.api.v1.UserResource import UserResource v1_api = Api(api_name='v1') v1_api.register(MixResource()) @@ -15,12 +16,14 @@ v1_api.register(CommentResource()) v1_api.register(ReleaseResource()) v1_api.register(ReleaseAudioResource()) v1_api.register(EventResource()) +v1_api.register(UserResource()) ajax = AjaxHandler() urlpatterns = django.conf.urls.patterns( '', url(r'^$', 'spa.views.app', name='home'), url(r'^tpl/(?P\w+)/$', 'spa.templates.get_template'), + url(r'^tplex/(?P\w+)/$', 'spa.templates.get_template_ex'), (r'^ajax/', include(ajax.urls)), (r'^api/', include(v1_api.urls)), ) \ No newline at end of file diff --git a/static/css/style.css b/static/css/style.css index d533762..238064e 100644 --- a/static/css/style.css +++ b/static/css/style.css @@ -8,6 +8,8 @@ body { padding-bottom: 40px; padding-right: 32px; } +/* IE/Chrome image fix */ +img.event-content {width: auto; height: auto;} #header { margin-top: 20px; @@ -21,6 +23,24 @@ body { border-bottom: 3px solid #CEC3B3; } +.page-header{ + -moz-border-bottom-colors: none; + -moz-border-image: none; + -moz-border-left-colors: none; + -moz-border-right-colors: none; + -moz-border-top-colors: none; + border-color: -moz-use-text-color -moz-use-text-color #E5E5E5; + border-style: none none solid; + border-width: 0 0 1px; + color: #333333; + display: block; + font-size: 19.5px; + line-height: 36px; + margin-bottom: 27px; + padding: 0; + width: 100%; +} + #mix-comments-list ul { list-style-type: none; } diff --git a/static/css/sup.css b/static/css/sup.css deleted file mode 100644 index e69de29..0000000 diff --git a/static/js/app/app.js b/static/js/app/app.js index c127bf1..ceb072c 100644 --- a/static/js/app/app.js +++ b/static/js/app/app.js @@ -9,7 +9,8 @@ var AppRouter = Backbone.Router.extend({ "/events":"eventList", "/event/:id":"eventDetails", "/accounts/login/":"login", - "/accounts/logout/":"logout" + "/accounts/logout/":"logout", + "/me":"userDetails" }, initialize:function () { this.headerView = new HeaderView(); @@ -105,11 +106,19 @@ var AppRouter = Backbone.Router.extend({ }, logout:function () { window.utils.showAlert("Success", "You are now logged out", "alert-success"); + }, + userDetails: function(){ + var user = new User(); + $('#site-content-fill').html(''); + user.fetch({success:function () { + var content = new UserView({model:user}).el; + $('#content').html(content); + }}); } }); utils.loadTemplate([ - 'HeaderView', 'SidebarView', + 'HeaderView', 'SidebarView', 'UserView', 'MixListView', 'MixListItemView', 'MixView', 'CommentListView', 'CommentListItemView', 'ReleaseListView', 'ReleaseListItemView', 'ReleaseItemView', 'ReleaseView', 'ReleaseAudioListView', 'ReleaseAudioItemView', diff --git a/static/js/app/models/user.js b/static/js/app/models/user.js new file mode 100644 index 0000000..63e57df --- /dev/null +++ b/static/js/app/models/user.js @@ -0,0 +1,3 @@ +var User = TastypieModel.extend({ + urlRoot:window.appSettings.urlRoot + "user/" +}); diff --git a/static/js/app/views/user.js b/static/js/app/views/user.js new file mode 100644 index 0000000..2816bc4 --- /dev/null +++ b/static/js/app/views/user.js @@ -0,0 +1,25 @@ +window.UserView = Backbone.View.extend({ + events:{ + "click #save-changes":"saveChanges", + "change input" :"changed", + "change select" :"changed" + }, + initialize:function () { + this.render(); + }, + render:function () { + $(this.el).html(this.template({"item":this.model.toJSON()})); + return this; + }, + saveChanges: function(){ + this.model.save(); + return false; + }, + changed:function(evt) { + var changed = evt.currentTarget; + var value = $("#"+changed.id).val(); + var obj = "{\""+changed.id +"\":\""+value+"\"}"; + var objInst = JSON.parse(obj); + this.model.set(objInst); + } +}); \ No newline at end of file diff --git a/static/js/libs/backbone-forms.min.js b/static/js/libs/backbone-forms.min.js new file mode 100644 index 0000000..48d3e9f --- /dev/null +++ b/static/js/libs/backbone-forms.min.js @@ -0,0 +1 @@ +(function(root){if(typeof exports!="undefined"&&typeof require!="undefined")var $=root.jQuery||root.Zepto||root.ender||require("jquery"),_=root._||require("underscore"),Backbone=root.Backbone||require("backbone");else var $=root.jQuery,_=root._,Backbone=root.Backbone;var Form=function(){return Backbone.View.extend({hasFocus:!1,initialize:function(options){if(!Form.templates.form)throw new Error("Templates not loaded");this.schema=function(){if(options.schema)return options.schema;var model=options.model;if(!model)throw new Error("Could not find schema");return _.isFunction(model.schema)?model.schema():model.schema}(),options=_.extend({template:"form",fieldsetTemplate:"fieldset",fieldTemplate:"field"},options);if(!options.fieldsets){var fields=options.fields||_.keys(this.schema);options.fieldsets=[{fields:fields}]}this.options=options,this.model=options.model,this.data=options.data,this.fields={}},render:function(){var self=this,options=this.options,template=Form.templates[options.template],$form=$(template({fieldsets:''})),$fieldsetContainer=$(".bbf-tmp",$form);return _.each(options.fieldsets,function(fieldset){$fieldsetContainer.append(self.renderFieldset(fieldset))}),$fieldsetContainer.children().unwrap(),this.setElement($form),this.hasFocus&&this.trigger("blur",this),this},renderFieldset:function(fieldset){var self=this,template=Form.templates[this.options.fieldsetTemplate],schema=this.schema,getNested=Form.helpers.getNested;_.isArray(fieldset)&&(fieldset={fields:fieldset});var $fieldset=$(template(_.extend({},fieldset,{legend:'',fields:''})));fieldset.legend?$fieldset.find(".bbf-tmp-legend").replaceWith(fieldset.legend):$fieldset.find(".bbf-tmp-legend").parent().remove();var $fieldsContainer=$(".bbf-tmp-fields",$fieldset);return _.each(fieldset.fields,function(key){var itemSchema=function(){if(schema[key])return schema[key];var path=key.replace(/\./g,".subSchema.");return getNested(schema,path)}();if(!itemSchema)throw"Field '"+key+"' not found in schema";var field=self.fields[key]=self.createField(key,itemSchema),fieldEl=field.render().el;field.editor.on("all",function(event){args=_.toArray(arguments),args[0]=key+":"+event,args.splice(1,0,this),this.trigger.apply(this,args)},self),field.editor.on("change",function(){this.trigger("change",self)},self),field.editor.on("focus",function(){if(this.hasFocus)return;this.trigger("focus",this)},self),field.editor.on("blur",function(){if(!this.hasFocus)return;var self=this;setTimeout(function(){if(_.find(self.fields,function(field){return field.editor.hasFocus}))return;self.trigger("blur",self)},0)},self),itemSchema.type!="Hidden"&&$fieldsContainer.append(fieldEl)}),$fieldsContainer=$fieldsContainer.children().unwrap(),$fieldset},createField:function(key,schema){schema.template=schema.template||this.options.fieldTemplate;var options={form:this,key:key,schema:schema,idPrefix:this.options.idPrefix,template:this.options.fieldTemplate};return this.model?options.model=this.model:this.data?options.value=this.data[key]:options.value=null,new Form.Field(options)},validate:function(){var self=this,fields=this.fields,model=this.model,errors={};_.each(fields,function(field){var error=field.validate();error&&(errors[field.key]=error)});if(model&&model.validate){var modelErrors=model.validate(this.getValue());if(modelErrors){var isDictionary=_.isObject(modelErrors)&&!_.isArray(modelErrors);isDictionary||(errors._others=errors._others||[],errors._others.push(modelErrors)),isDictionary&&_.each(modelErrors,function(val,key){if(self.fields[key]&&!errors[key])self.fields[key].setError(val);else{errors._others=errors._others||[];var tmpErr={};tmpErr[key]=val,errors._others.push(tmpErr)}})}}return _.isEmpty(errors)?null:errors},commit:function(){var errors=this.validate();if(errors)return errors;var modelError;this.model.set(this.getValue(),{error:function(model,e){modelError=e}});if(modelError)return modelError},getValue:function(key){if(key)return this.fields[key].getValue();var values={};return _.each(this.fields,function(field){values[field.key]=field.getValue()}),values},setValue:function(data){for(var key in data)this.fields[key].setValue(data[key])},focus:function(){if(this.hasFocus)return;var fieldset=this.options.fieldsets[0];if(fieldset){var field;_.isArray(fieldset)?field=fieldset[0]:field=fieldset.fields[0],field&&this.fields[field].editor.focus()}},blur:function(){if(!this.hasFocus)return;focusedField=_.find(this.fields,function(field){return field.editor.hasFocus}),focusedField&&focusedField.editor.blur()},remove:function(){var fields=this.fields;for(var key in fields)fields[key].remove();Backbone.View.prototype.remove.call(this)},trigger:function(event){return event=="focus"?this.hasFocus=!0:event=="blur"&&(this.hasFocus=!1),Backbone.View.prototype.trigger.apply(this,arguments)}})}();Form.helpers=function(){var helpers={};return helpers.getNested=function(obj,path){var fields=path.split("."),result=obj;for(var i=0,n=fields.length;i',help:''}));return $field.find(".bbf-tmp-editor").replaceWith(editor.render().el),this.$help=$(".bbf-tmp-help",$field).parent(),this.$help.empty(),this.schema.help&&this.$help.html(this.schema.help),this.schema.fieldClass&&$field.addClass(this.schema.fieldClass),this.schema.fieldAttrs&&$field.attr(this.schema.fieldAttrs),this.setElement($field),this},getId:function(){var prefix=this.options.idPrefix,id=this.key;return id=id.replace(/\./g,"_"),_.isString(prefix)||_.isNumber(prefix)?prefix+id:_.isNull(prefix)?id:this.model?this.model.cid+"_"+id:id},validate:function(){var error=this.editor.validate();return error?this.setError(error.message):this.clearError(),error},setError:function(msg){if(this.editor.hasNestedForm)return;var errClass=Form.classNames.error;this.$el.addClass(errClass),this.$help&&this.$help.html(msg)},clearError:function(){var errClass=Form.classNames.error;this.$el.removeClass(errClass);if(this.$help){this.$help.empty();var helpMsg=this.schema.help;helpMsg&&this.$help.html(helpMsg)}},commit:function(){return this.editor.commit()},getValue:function(){return this.editor.getValue()},setValue:function(value){this.editor.setValue(value)},focus:function(){this.editor.focus()},blur:function(){this.editor.blur()},remove:function(){this.editor.remove(),Backbone.View.prototype.remove.call(this)}})}(),Form.editors=function(){var helpers=Form.helpers,editors={};return editors.Base=Backbone.View.extend({defaultValue:null,hasFocus:!1,initialize:function(options){var options=options||{};if(options.model){if(!options.key)throw"Missing option: 'key'";this.model=options.model,this.value=this.model.get(options.key)}else options.value&&(this.value=options.value);this.value===undefined&&(this.value=this.defaultValue),this.key=options.key,this.form=options.form,this.schema=options.schema||{},this.validators=options.validators||this.schema.validators,this.$el.attr("name",this.getName()),this.schema.editorClass&&this.$el.addClass(this.schema.editorClass),this.schema.editorAttrs&&this.$el.attr(this.schema.editorAttrs)},getValue:function(){throw"Not implemented. Extend and override this method."},setValue:function(){throw"Not implemented. Extend and override this method."},focus:function(){throw"Not implemented. Extend and override this method."},blur:function(){throw"Not implemented. Extend and override this method."},getName:function(){var key=this.key||"";return key.replace(/\./g,"_")},commit:function(){var error=this.validate();if(error)return error;this.model.set(this.key,this.getValue(),{error:function(model,e){error=e}});if(error)return error},validate:function(){var $el=this.$el,error=null,value=this.getValue(),formValues=this.form?this.form.getValue():{},validators=this.validators,getValidator=Form.helpers.getValidator;return validators&&_.every(validators,function(validator){return error=getValidator(validator)(value,formValues),continueLoop=error?!1:!0}),error},trigger:function(event){return event=="focus"?this.hasFocus=!0:event=="blur"&&(this.hasFocus=!1),Backbone.View.prototype.trigger.apply(this,arguments)}}),editors.Text=editors.Base.extend({tagName:"input",defaultValue:"",previousValue:"",events:{keyup:"determineChange",keypress:function(event){var self=this;setTimeout(function(){self.determineChange()},0)},select:function(event){this.trigger("select",this)},focus:function(event){this.trigger("focus",this)},blur:function(event){this.trigger("blur",this)}},initialize:function(options){editors.Base.prototype.initialize.call(this,options);var schema=this.schema,type="text";schema&&schema.editorAttrs&&schema.editorAttrs.type&&(type=schema.editorAttrs.type),schema&&schema.dataType&&(type=schema.dataType),this.$el.attr("type",type)},render:function(){return this.setValue(this.value),this},determineChange:function(event){var currentValue=this.$el.val(),changed=currentValue!=this.previousValue;changed&&(this.previousValue=currentValue,this.trigger("change",this))},getValue:function(){return this.$el.val()},setValue:function(value){this.$el.val(value)},focus:function(){if(this.hasFocus)return;this.$el.focus()},blur:function(){if(!this.hasFocus)return;this.$el.blur()},select:function(){this.$el.select()}}),editors.Number=editors.Text.extend({defaultValue:0,events:_.extend({},editors.Text.prototype.events,{keypress:"onKeyPress"}),initialize:function(options){editors.Text.prototype.initialize.call(this,options),this.$el.attr("type","number")},onKeyPress:function(event){var self=this,delayedDetermineChange=function(){setTimeout(function(){self.determineChange()},0)};if(event.charCode==0){delayedDetermineChange();return}var newVal=this.$el.val()+String.fromCharCode(event.charCode),numeric=/^[0-9]*\.?[0-9]*?$/.test(newVal);numeric?delayedDetermineChange():event.preventDefault()},getValue:function(){var value=this.$el.val();return value===""?null:parseFloat(value,10)},setValue:function(value){value=function(){return _.isNumber(value)?value:_.isString(value)&&value!==""?parseFloat(value,10):null}(),_.isNaN(value)&&(value=null),editors.Text.prototype.setValue.call(this,value)}}),editors.Password=editors.Text.extend({initialize:function(options){editors.Text.prototype.initialize.call(this,options),this.$el.attr("type","password")}}),editors.TextArea=editors.Text.extend({tagName:"textarea"}),editors.Checkbox=editors.Base.extend({defaultValue:!1,tagName:"input",events:{click:function(event){this.trigger("change",this)},focus:function(event){this.trigger("focus",this)},blur:function(event){this.trigger("blur",this)}},initialize:function(options){editors.Base.prototype.initialize.call(this,options),this.$el.attr("type","checkbox")},render:function(){return this.setValue(this.value),this},getValue:function(){return this.$el.prop("checked")},setValue:function(value){value&&this.$el.prop("checked",!0)},focus:function(){if(this.hasFocus)return;this.$el.focus()},blur:function(){if(!this.hasFocus)return;this.$el.blur()}}),editors.Hidden=editors.Base.extend({defaultValue:"",initialize:function(options){editors.Text.prototype.initialize.call(this,options),this.$el.attr("type","hidden")},getValue:function(){return this.value},setValue:function(value){this.value=value},focus:function(){},blur:function(){}}),editors.Select=editors.Base.extend({tagName:"select",events:{change:function(event){this.trigger("change",this)},focus:function(event){this.trigger("focus",this)},blur:function(event){this.trigger("blur",this)}},initialize:function(options){editors.Base.prototype.initialize.call(this,options);if(!this.schema||!this.schema.options)throw"Missing required 'schema.options'"},render:function(){return this.setOptions(this.schema.options),this},setOptions:function(options){var self=this;if(options instanceof Backbone.Collection){var collection=options;collection.length>0?this.renderOptions(options):collection.fetch({success:function(collection){self.renderOptions(options)}})}else _.isFunction(options)?options(function(result){self.renderOptions(result)}):this.renderOptions(options)},renderOptions:function(options){var $select=this.$el,html;_.isString(options)?html=options:_.isArray(options)?html=this._arrayToHtml(options):options instanceof Backbone.Collection&&(html=this._collectionToHtml(options)),$select.html(html),this.setValue(this.value)},getValue:function(){return this.$el.val()},setValue:function(value){this.$el.val(value)},focus:function(){if(this.hasFocus)return;this.$el.focus()},blur:function(){if(!this.hasFocus)return;this.$el.blur()},_collectionToHtml:function(collection){var array=[];collection.each(function(model){array.push({val:model.id,label:model.toString()})});var html=this._arrayToHtml(array);return html},_arrayToHtml:function(array){var html=[];return _.each(array,function(option){if(_.isObject(option)){var val=option.val?option.val:"";html.push('")}else html.push("")}),html.join("")}}),editors.Radio=editors.Select.extend({tagName:"ul",className:"bbf-radio",events:{"click input[type=radio]:not(:checked)":function(){this.trigger("change",this)},"focus input[type=radio]":function(){if(this.hasFocus)return;this.trigger("focus",this)},"blur input[type=radio]":function(){if(!this.hasFocus)return;var self=this;setTimeout(function(){if(self.$("input[type=radio]:focus")[0])return;self.trigger("blur",self)},0)}},getValue:function(){return this.$("input[type=radio]:checked").val()},setValue:function(value){this.$("input[type=radio]").val([value])},focus:function(){if(this.hasFocus)return;var checked=this.$("input[type=radio]:checked");if(checked[0]){checked.focus();return}this.$("input[type=radio]").first().focus()},blur:function(){if(!this.hasFocus)return;this.$("input[type=radio]:focus").blur()},_arrayToHtml:function(array){var html=[],self=this;return _.each(array,function(option,index){var itemHtml="
  • ";if(_.isObject(option)){var val=option.val?option.val:"";itemHtml+='',itemHtml+='"}else itemHtml+='',itemHtml+='";itemHtml+="
  • ",html.push(itemHtml)}),html.join("")}}),editors.Checkboxes=editors.Select.extend({tagName:"ul",className:"bbf-checkboxes",events:{"click input[type=checkbox]":function(){this.trigger("change",this)},"focus input[type=checkbox]":function(){if(this.hasFocus)return;this.trigger("focus",this)},"blur input[type=checkbox]":function(){if(!this.hasFocus)return;var self=this;setTimeout(function(){if(self.$("input[type=checkbox]:focus")[0])return;self.trigger("blur",self)},0)}},getValue:function(){var values=[];return this.$("input[type=checkbox]:checked").each(function(){values.push($(this).val())}),values},setValue:function(values){_.isArray(values)||(values=[values]),this.$("input[type=checkbox]").val(values)},focus:function(){if(this.hasFocus)return;this.$("input[type=checkbox]").first().focus()},blur:function(){if(!this.hasFocus)return;this.$("input[type=checkbox]:focus").blur()},_arrayToHtml:function(array){var html=[],self=this;return _.each(array,function(option,index){var itemHtml="
  • ";if(_.isObject(option)){var val=option.val?option.val:"";itemHtml+='',itemHtml+='"}else itemHtml+='',itemHtml+='";itemHtml+="
  • ",html.push(itemHtml)}),html.join("")}}),editors.Object=editors.Base.extend({hasNestedForm:!0,className:"bbf-object",initialize:function(options){this.value={},editors.Base.prototype.initialize.call(this,options);if(!this.schema.subSchema)throw new Error("Missing required 'schema.subSchema' option for Object editor")},render:function(){return this.form=new Form({schema:this.schema.subSchema,data:this.value,idPrefix:this.id+"_",fieldTemplate:"nestedField"}),this._observeFormEvents(),this.$el.html(this.form.render().el),this.hasFocus&&this.trigger("blur",this),this},getValue:function(){return this.form?this.form.getValue():this.value},setValue:function(value){this.value=value,this.render()},focus:function(){if(this.hasFocus)return;this.form.focus()},blur:function(){if(!this.hasFocus)return;this.form.blur()},remove:function(){this.form.remove(),Backbone.View.prototype.remove.call(this)},validate:function(){return this.form.validate()},_observeFormEvents:function(){this.form.on("all",function(){args=_.toArray(arguments),args[1]=this,this.trigger.apply(this,args)},this)}}),editors.NestedModel=editors.Object.extend({initialize:function(options){editors.Base.prototype.initialize.call(this,options);if(!options.schema.model)throw'Missing required "schema.model" option for NestedModel editor'},render:function(){var data=this.value||{},key=this.key,nestedModel=this.schema.model,modelInstance=data.constructor==nestedModel?data:new nestedModel(data);return this.form=new Form({model:modelInstance,idPrefix:this.id+"_",fieldTemplate:"nestedField"}),this._observeFormEvents(),this.$el.html(this.form.render().el),this.hasFocus&&this.trigger("blur",this),this},commit:function(){var error=this.form.commit();return error?(this.$el.addClass("error"),error):editors.Object.prototype.commit.call(this)}}),editors.Date=editors.Base.extend({events:{"change select":function(){this.updateHidden(),this.trigger("change",this)},"focus select":function(){if(this.hasFocus)return;this.trigger("focus",this)},"blur select":function(){if(!this.hasFocus)return;var self=this;setTimeout(function(){if(self.$("select:focus")[0])return;self.trigger("blur",self)},0)}},initialize:function(options){options=options||{},editors.Base.prototype.initialize.call(this,options);var Self=editors.Date,today=new Date;this.options=_.extend({monthNames:Self.monthNames,showMonthNames:Self.showMonthNames},options),this.schema=_.extend({yearStart:today.getFullYear()-100,yearEnd:today.getFullYear()},options.schema||{}),this.value&&!_.isDate(this.value)&&(this.value=new Date(this.value));if(!this.value){var date=new Date;date.setSeconds(0),date.setMilliseconds(0),this.value=date}},render:function(){var options=this.options,schema=this.schema,datesOptions=_.map(_.range(1,32),function(date){return'"}),monthsOptions=_.map(_.range(0,12),function(month){var value=options.showMonthNames?options.monthNames[month]:month+1;return'"}),yearsOptions=_.map(_.range(schema.yearStart,schema.yearEnd+1),function(year){return'"}),$el=$(Form.templates.date({dates:datesOptions.join(""),months:monthsOptions.join(""),years:yearsOptions.join("")}));return this.$date=$el.find('select[data-type="date"]'),this.$month=$el.find('select[data-type="month"]'),this.$year=$el.find('select[data-type="year"]'),this.$hidden=$(''),$el.append(this.$hidden),this.setValue(this.value),this.setElement($el),this.$el.attr("id",this.id),this.hasFocus&&this.trigger("blur",this),this},getValue:function(){var year=this.$year.val(),month=this.$month.val(),date=this.$date.val();return!year||!month||!date?null:new Date(year,month,date)},setValue:function(date){this.$date.val(date.getDate()),this.$month.val(date.getMonth()),this.$year.val(date.getFullYear()),this.updateHidden()},focus:function(){if(this.hasFocus)return;this.$("select").first().focus()},blur:function(){if(!this.hasFocus)return;this.$("select:focus").blur()},updateHidden:function(){var val=this.getValue();_.isDate(val)&&(val=val.toISOString()),this.$hidden.val(val)}},{showMonthNames:!0,monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"]}),editors.DateTime=editors.Base.extend({events:{"change select":function(){this.updateHidden(),this.trigger("change",this)},"focus select":function(){if(this.hasFocus)return;this.trigger("focus",this)},"blur select":function(){if(!this.hasFocus)return;var self=this;setTimeout(function(){if(self.$("select:focus")[0])return;self.trigger("blur",self)},0)}},initialize:function(options){options=options||{},editors.Base.prototype.initialize.call(this,options),this.options=_.extend({DateEditor:editors.DateTime.DateEditor},options),this.schema=_.extend({minsInterval:15},options.schema||{}),this.dateEditor=new this.options.DateEditor(options),this.value=this.dateEditor.value},render:function(){function pad(n){return n<10?"0"+n:n}var schema=this.schema,hoursOptions=_.map(_.range(0,24),function(hour){return'"}),minsOptions=_.map(_.range(0,60,schema.minsInterval),function(min){return'"}),$el=$(Form.templates.dateTime({date:'',hours:hoursOptions.join(),mins:minsOptions.join()}));return $el.find(".bbf-tmp").replaceWith(this.dateEditor.render().el),this.$hour=$el.find('select[data-type="hour"]'),this.$min=$el.find('select[data-type="min"]'),this.$hidden=$el.find('input[type="hidden"]'),this.setValue(this.value),this.setElement($el),this.$el.attr("id",this.id),this.hasFocus&&this.trigger("blur",this),this},getValue:function(){var date=this.dateEditor.getValue(),hour=this.$hour.val(),min=this.$min.val();return!date||!hour||!min?null:(date.setHours(hour),date.setMinutes(min),date)},setValue:function(date){_.isDate(date)||(date=new Date(date)),this.dateEditor.setValue(date),this.$hour.val(date.getHours()),this.$min.val(date.getMinutes()),this.updateHidden()},focus:function(){if(this.hasFocus)return;this.$("select").first().focus()},blur:function(){if(!this.hasFocus)return;this.$("select:focus").blur()},updateHidden:function(){var val=this.getValue();_.isDate(val)&&(val=val.toISOString()),this.$hidden.val(val)},remove:function(){this.dateEditor.remove(),editors.Base.prototype.remove.call(this)}},{DateEditor:editors.Date}),editors}(),Form.setTemplates=Form.helpers.setTemplates,Form.setTemplateCompiler=Form.helpers.setTemplateCompiler,Form.templates={},Form.setTemplates({form:'
    {{fieldsets}}
    ',fieldset:"
    {{legend}}
      {{fields}}
    ",field:'
  • {{editor}}
    {{help}}
  • ',nestedField:'
  • {{editor}}
    {{help}}
  • ',list:'
      {{items}}
    ',listItem:'
  • {{editor}}
  • ',date:'
    ',dateTime:'
    {{date}}
    :
    ',"list.Modal":'
    {{summary}}
    '},{error:"bbf-error"}),Form.VERSION="0.10.1",Backbone.Form=Form})(this) \ No newline at end of file diff --git a/templates/base.html b/templates/base.html index 243dc3e..ae1ebed 100644 --- a/templates/base.html +++ b/templates/base.html @@ -19,9 +19,8 @@ - - + @@ -78,11 +77,13 @@ + + @@ -90,6 +91,7 @@ + diff --git a/templates/views/EventItemView.html b/templates/views/EventItemView.html index 51edd86..98b5478 100644 --- a/templates/views/EventItemView.html +++ b/templates/views/EventItemView.html @@ -1,17 +1,28 @@ + +
    -
    +

    <%= item.event_date %> -  ::  - <%= item.event_title %>  -  <%= item.venue %> -  -  +  ::  + <%= item.event_title %>

    -
    +
    <%= item.event_description %>
    diff --git a/templates/views/EventListView.html b/templates/views/EventListView.html index 5e5968f..d5cc84c 100644 --- a/templates/views/EventListView.html +++ b/templates/views/EventListView.html @@ -1,5 +1,5 @@
    -

    Upcoming Events

    +
    diff --git a/templates/views/HeaderView.html b/templates/views/HeaderView.html index 8599dec..db1c26d 100644 --- a/templates/views/HeaderView.html +++ b/templates/views/HeaderView.html @@ -41,7 +41,7 @@
  • - {% user_display user %} + {% user_display user %}
  • diff --git a/templates/views/LoginView.html b/templates/views/LoginView.html index 1121141..733b26d 100644 --- a/templates/views/LoginView.html +++ b/templates/views/LoginView.html @@ -1,7 +1,4 @@ - - {% load socialaccount_tags %} -

    Login to Deep South Sounds

    diff --git a/templates/views/ReleaseItemView.html b/templates/views/ReleaseItemView.html index 75c1a48..2d389d0 100644 --- a/templates/views/ReleaseItemView.html +++ b/templates/views/ReleaseItemView.html @@ -1,6 +1,6 @@
    -
    +

    <%= item.release_date %>  ::  diff --git a/templates/views/ReleaseListView.html b/templates/views/ReleaseListView.html index 55ed77a..972eb7a 100644 --- a/templates/views/ReleaseListView.html +++ b/templates/views/ReleaseListView.html @@ -1,5 +1,5 @@
    -

    Upcoming Releases

    +

    diff --git a/templates/views/UserView.html b/templates/views/UserView.html new file mode 100644 index 0000000..7a82701 --- /dev/null +++ b/templates/views/UserView.html @@ -0,0 +1,75 @@ +{% load account_tags %} +{% block scripts %} + + + +{% endblock %} +{% block content %} + + {% csrf_token %} +
    + User details +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + + + +
    +
    +
    +
    + +
    +
    +
    +
    + ‌ +
    + +{% endblock %} \ No newline at end of file