# HG changeset patch # User ymh # Date 1369425308 -7200 # Node ID 0d86ca7ccc7b9582e54b5e9b9bd666b3dc1c26e5 # Parent 3fb6b550840cd4810a7e8fea09009111d5f86954# Parent 81e5be7f10f94ac2cdeb1aed99f5a5e8fcbe529f Merge with 81e5be7f10f94ac2cdeb1aed99f5a5e8fcbe529f diff -r 3fb6b550840c -r 0d86ca7ccc7b .settings/org.eclipse.core.resources.prefs --- a/.settings/org.eclipse.core.resources.prefs Wed May 15 12:18:43 2013 +0200 +++ b/.settings/org.eclipse.core.resources.prefs Fri May 24 21:55:08 2013 +0200 @@ -35,13 +35,21 @@ encoding//src/ldt/ldt/ldt_utils/migrations/0024_auto__chg_field_tag_name.py=utf-8 encoding//src/ldt/ldt/ldt_utils/migrations/0025_chg_site_domain.py=utf-8 encoding//src/ldt/ldt/ldt_utils/migrations/0026_set_relative_ldtproject.py=utf-8 +encoding//src/ldt/ldt/ldt_utils/migrations/0027_auto__chg_field_project_owner__chg_field_media_creator.py=utf-8 encoding//src/ldt/ldt/ldt_utils/views/json.py=utf-8 encoding//src/ldt/ldt/management/commands/synciri.py=utf-8 encoding//src/ldt/ldt/management/commands/updateiriurlinprojects.py=utf-8 encoding//src/ldt/ldt/management/utils.py=utf-8 encoding//src/ldt/ldt/test/test_runner.py=utf-8 encoding//src/ldt/ldt/text/migrations/0001_initial.py=utf-8 +encoding//src/ldt/ldt/text/migrations/0002_auto__chg_field_annotation_external_id.py=utf-8 encoding//src/ldt/ldt/user/migrations/0001_initial.py=utf-8 +encoding//src/ldt/ldt/user/migrations/0005_add_permission_owner_group.py=utf-8 encoding//src/ldt/ldt/user/migrations/0008_auto__chg_field_groupprofile_image__chg_field_groupprofile_group__chg_.py=utf-8 +encoding//src/ldt/ldt/user/migrations/0009_rename_auth_user_to_user_ldt_user.py=utf-8 +encoding//src/ldt/ldt/user/migrations/0010_auto__add_field_ldtuser_language__add_field_ldtuser_image.py=utf-8 +encoding//src/ldt/ldt/user/migrations/0011_copy_image_language_ldt_user.py=utf-8 +encoding//src/ldt/ldt/user/migrations/0012_auto__del_userprofile.py=utf-8 +encoding//src/ldt/ldt/user/migrations/0013_auto__del_ldt.py=utf-8 encoding//virtualenv/web/env/guardianenv/Lib/site-packages/guardian/migrations/0001_initial.py=utf-8 encoding/=UTF-8 diff -r 3fb6b550840c -r 0d86ca7ccc7b src/ldt/ldt/__init__.py --- a/src/ldt/ldt/__init__.py Wed May 15 12:18:43 2013 +0200 +++ b/src/ldt/ldt/__init__.py Fri May 24 21:55:08 2013 +0200 @@ -1,3 +1,5 @@ +__all__ = ["VERSION", "get_version", "__version__"] + VERSION = (1, 49, 2, "final", 0) @@ -15,3 +17,12 @@ __version__ = get_version() +# solve initialization pb +# The pb comes from the initialization of the middlewares +# The is a potential circular reference pb between the following modules : security, indexation model. +# the cause comes from the fact that at one moment, the User model is referenced, using the new django 1.5 django.contrib.auth.get_user_model method +# This method cause the load of all installed apps, causing the circular dependency problem. +# the following code force a "pre-load" of all installed app, solving the dependecy pb. +# TODO: remove this by reworking ldt dependencies +from django.db.models.loading import get_models +_ = get_models() diff -r 3fb6b550840c -r 0d86ca7ccc7b src/ldt/ldt/api/ldt/authentication.py --- a/src/ldt/ldt/api/ldt/authentication.py Wed May 15 12:18:43 2013 +0200 +++ b/src/ldt/ldt/api/ldt/authentication.py Fri May 24 21:55:08 2013 +0200 @@ -197,5 +197,5 @@ This implementation returns the user's username. """ - username, api_key = self.extract_credentials(request) + username, _ = self.extract_credentials(request) return username or 'nouser' \ No newline at end of file diff -r 3fb6b550840c -r 0d86ca7ccc7b src/ldt/ldt/api/ldt/resources/annotation.py --- a/src/ldt/ldt/api/ldt/resources/annotation.py Wed May 15 12:18:43 2013 +0200 +++ b/src/ldt/ldt/api/ldt/resources/annotation.py Fri May 24 21:55:08 2013 +0200 @@ -1,17 +1,15 @@ +from ldt.ldt_utils.contentindexer import add_segment from ldt.ldt_utils.models import Project, Content -from ldt.ldt_utils.stat import add_annotation_to_stat from ldt.ldt_utils.utils import LdtAnnotation from ldt.security import protect_models, unprotect_models from tastypie import fields from tastypie.authorization import Authorization from tastypie.exceptions import NotFound, BadRequest from tastypie.resources import Resource -import logging #@UnresolvedImport -from ldt.ldt_utils.contentindexer import add_segment class AnnotationObject(object): - def __init__(self, id="", project = "", type = "", type_title = "", ensemble="", media = "", begin = 0, end = 0, content = {"title":"", "description":""}, tags = [], meta = {"creator":"","created":""}): + def __init__(self, id="", project = "", type = "", type_title = "", ensemble="", media = "", begin = 0, end = 0, content = {"title":"", "description":""}, tags = [], meta = {"creator":"","created":""}): # @ReservedAssignment self.id = id self.project = project self.type = type @@ -46,11 +44,10 @@ always_return_data = True include_resource_uri = False - def obj_delete_list(self, request=None, **kwargs): + def obj_delete_list(self, bundle, **kwargs): return True - def obj_create(self, bundle, request=None, **kwargs): - #logging.debug("ICI 0-1 bundle.data = " + repr(bundle.data)) + def obj_create(self, bundle, **kwargs): # Here the a has the datas for only one annotation. Tastypie's post allows only one resource addition a = bundle.data project_id = "" @@ -128,7 +125,7 @@ bundle.obj = AnnotationObject(id = a["id"], project = a["project"], type = a["type"], type_title = a["type_title"], ensemble=a['ensemble'], media = a["media"], begin = a["begin"], end = a["end"], content = a['content'], tags = a['tags'], meta = a['meta']) return bundle - def get_resource_uri(self, bundle_or_obj): + def get_resource_uri(self, bundle_or_obj=None, url_name='api_dispatch_list'): return '' \ No newline at end of file diff -r 3fb6b550840c -r 0d86ca7ccc7b src/ldt/ldt/api/ldt/resources/content.py --- a/src/ldt/ldt/api/ldt/resources/content.py Wed May 15 12:18:43 2013 +0200 +++ b/src/ldt/ldt/api/ldt/resources/content.py Fri May 24 21:55:08 2013 +0200 @@ -1,9 +1,9 @@ -from django.conf.urls.defaults import url +from django.conf.urls import url +from itertools import groupby +from ldt.indexation import get_results_list from ldt.ldt_utils.models import Content, Media +from tastypie import fields from tastypie.resources import Bundle, ModelResource, ALL_WITH_RELATIONS, ALL -from tastypie import fields -from ldt.indexation import get_results_list -from itertools import groupby class MediaResource(ModelResource): @@ -12,8 +12,10 @@ resource_name = 'medias' queryset = Media.objects.all() - def get_resource_uri(self, bundle_or_obj): - if isinstance(bundle_or_obj, Bundle): + def get_resource_uri(self, bundle_or_obj=None, url_name='api_dispatch_list'): + if not bundle_or_obj: + return super(MediaResource, self).get_resource_uri(bundle_or_obj,url_name) + elif isinstance(bundle_or_obj, Bundle): return bundle_or_obj.obj.videopath + bundle_or_obj.obj.stream_src else: return bundle_or_obj.videopath + bundle_or_obj.stream_src @@ -36,13 +38,15 @@ def get_object_list(self, request): return Content.safe_objects.select_related('front_project', 'media_obj').all() - def override_urls(self): - # WARNING : in tastypie <= 1.0, override_urls is used instead of prepend_urls. From 1.0.0, prepend_urls will be prefered and override_urls deprecated + def prepend_urls(self): return [ url(r"^(?P%s)/recommended/$" % self._meta.resource_name, self.wrap_view('get_recommended'), name="api_contents_recommended"), url(r"^(?P%s)/(?P[\w\d_.-]+)/$" % self._meta.resource_name, self.wrap_view('dispatch_detail'), name="api_dispatch_detail"), ] - def get_resource_uri(self, bundle_or_obj): + + def get_resource_uri(self, bundle_or_obj=None, url_name='api_dispatch_list'): + if bundle_or_obj is None: + return super(ContentResource, self).get_resource_uri(bundle_or_obj, url_name) kwargs = { 'resource_name': self._meta.resource_name, 'api_name': self._meta.api_name diff -r 3fb6b550840c -r 0d86ca7ccc7b src/ldt/ldt/api/ldt/resources/project.py --- a/src/ldt/ldt/api/ldt/resources/project.py Wed May 15 12:18:43 2013 +0200 +++ b/src/ldt/ldt/api/ldt/resources/project.py Fri May 24 21:55:08 2013 +0200 @@ -1,12 +1,13 @@ from django.conf import settings -from django.conf.urls.defaults import url +from django.conf.urls import url from django.contrib.auth.models import Group from guardian.shortcuts import assign -from ldt.ldt_utils.models import Project -from ldt.api.ldt.authentication import SessionAuthentication, MultiAuthentication, ApiKeyAuthentication -from ldt.api.ldt.serializers.cinelabserializer import CinelabSerializer +from ldt.api.ldt.authentication import (SessionAuthentication, + MultiAuthentication, ApiKeyAuthentication) from ldt.api.ldt.resources import ContentResource from ldt.api.ldt.resources.user import UserResource +from ldt.api.ldt.serializers.cinelabserializer import CinelabSerializer +from ldt.ldt_utils.models import Project from ldt.security import protect_models, unprotect_models from ldt.security.permissionchecker import check_object_perm_for_user from tastypie import fields, http @@ -38,13 +39,14 @@ def get_object_list(self, request): return Project.safe_objects.all() - def override_urls(self): - # WARNING : in tastypie <= 1.0, override_urls is used instead of prepend_urls. From 1.0.0, prepend_urls will be prefered and override_urls deprecated + def prepend_urls(self): return [ url(r"^(?P%s)/(?P[\w\d_.-]+)/$" % self._meta.resource_name, self.wrap_view('dispatch_detail'), name="api_dispatch_detail"), ] - def get_resource_uri(self, bundle_or_obj): + def get_resource_uri(self, bundle_or_obj=None, url_name='api_dispatch_list'): + if bundle_or_obj is None: + return super(ProjectResource, self).get_resource_uri(bundle_or_obj,url_name) kwargs = { 'resource_name': self._meta.resource_name, 'api_name': self._meta.api_name @@ -56,9 +58,12 @@ return self._build_reverse_url("api_dispatch_detail", kwargs=kwargs) # Create a new project. Used with post_detail and with no ldt_id in the url - def obj_create(self, bundle, request=None, **kwargs): + def obj_create(self, bundle, **kwargs): + request = bundle.request + if request is None: + raise BadRequest("Request object must be passed as an argument") unprotect_models() - bundle = super(ProjectResource, self).obj_create(bundle, request) + bundle = super(ProjectResource, self).obj_create(bundle, **kwargs) # Assign permission for the owner assign('view_project', request.user, bundle.obj) assign('change_project', request.user, bundle.obj) @@ -70,7 +75,7 @@ # Prevent for put_list and delete all objects. - def obj_delete_list(self, request=None, **kwargs): + def obj_delete_list(self, bundle, **kwargs): raise BadRequest("PUT with a list of projects is forbidden.") diff -r 3fb6b550840c -r 0d86ca7ccc7b src/ldt/ldt/api/ldt/resources/segment.py --- a/src/ldt/ldt/api/ldt/resources/segment.py Wed May 15 12:18:43 2013 +0200 +++ b/src/ldt/ldt/api/ldt/resources/segment.py Fri May 24 21:55:08 2013 +0200 @@ -1,5 +1,5 @@ from django.conf import settings -from django.conf.urls.defaults import url +from django.conf.urls import url from django.core.paginator import Paginator, InvalidPage from django.db.models import F, Q from ldt.indexation import get_results_list @@ -28,8 +28,7 @@ # def determine_format(self, request): # return "application/json" - def override_urls(self): - # WARNING : in tastypie <= 0.9.11, override_urls is used instead of prepend_urls. From 0.9.12, prepend_urls will be prefered and override_urls deprecated + def prepend_urls(self): return [ url(r"^(?P%s)/search%s$" % (self._meta.resource_name, trailing_slash()), self.wrap_view('get_search'), name="api_get_search"), url(r"^(?P%s)/bytimecode%s$" % (self._meta.resource_name, trailing_slash()), self.wrap_view('get_segments_by_timecode'), name='segment_api_empty'), diff -r 3fb6b550840c -r 0d86ca7ccc7b src/ldt/ldt/api/ldt/resources/tag.py --- a/src/ldt/ldt/api/ldt/resources/tag.py Wed May 15 12:18:43 2013 +0200 +++ b/src/ldt/ldt/api/ldt/resources/tag.py Fri May 24 21:55:08 2013 +0200 @@ -1,5 +1,5 @@ from django.conf import settings -from django.conf.urls.defaults import url +from django.conf.urls import url from django.core.paginator import Paginator, InvalidPage from ldt.ldt_utils.models import Segment from tagging.models import Tag @@ -14,8 +14,7 @@ resource_name = 'tags' queryset = Tag.objects.all() - def override_urls(self): - # WARNING : in tastypie <= 0.9.11, override_urls is used instead of prepend_urls. From 0.9.12, prepend_urls will be prefered and override_urls deprecated + def prepend_urls(self): return [ url(r"^(?P%s)/search%s$" % (self._meta.resource_name, trailing_slash()), self.wrap_view('get_search'), name="api_get_search"), ] diff -r 3fb6b550840c -r 0d86ca7ccc7b src/ldt/ldt/api/ldt/resources/user.py --- a/src/ldt/ldt/api/ldt/resources/user.py Wed May 15 12:18:43 2013 +0200 +++ b/src/ldt/ldt/api/ldt/resources/user.py Fri May 24 21:55:08 2013 +0200 @@ -1,20 +1,23 @@ -from django.contrib.auth.models import User -from django.conf.urls.defaults import url +from django.conf.urls import url +from django.contrib.auth import get_user_model from tastypie.resources import Bundle, ModelResource +User = get_user_model() + class UserResource(ModelResource): class Meta: allowed_methods = ['get'] queryset = User.objects.all() resource_name = 'users' - def override_urls(self): - # WARNING : in tastypie <= 1.0, override_urls is used instead of prepend_urls. From 1.0.0, prepend_urls will be prefered and override_urls deprecated + def prepend_urls(self): return [ url(r"^(?P%s)/(?P[\w\d_.-]+)/$" % self._meta.resource_name, self.wrap_view('dispatch_detail'), name="api_dispatch_detail"), ] - def get_resource_uri(self, bundle_or_obj): + def get_resource_uri(self, bundle_or_obj=None, url_name='api_dispatch_list'): + if bundle_or_obj is None: + return super(UserResource, self).get_resource_uri(bundle_or_obj, url_name) kwargs = { 'resource_name': self._meta.resource_name, 'api_name': self._meta.api_name diff -r 3fb6b550840c -r 0d86ca7ccc7b src/ldt/ldt/api/ldt/serializers/cinelabserializer.py --- a/src/ldt/ldt/api/ldt/serializers/cinelabserializer.py Wed May 15 12:18:43 2013 +0200 +++ b/src/ldt/ldt/api/ldt/serializers/cinelabserializer.py Fri May 24 21:55:08 2013 +0200 @@ -1,17 +1,15 @@ from django.conf import settings from django.core.serializers import json -from django.core.urlresolvers import reverse from django.utils import simplejson from ldt.ldt_utils.models import Content, Project from ldt.ldt_utils.projectserializer import ProjectJsonSerializer from ldt.ldt_utils.utils import generate_uuid -from tastypie.serializers import Serializer +from ldt.utils.url import reverse_prefix from tastypie.exceptions import NotFound, BadRequest -import math +from tastypie.serializers import Serializer import lxml.etree -import logging -import tastypie - +import math + class CinelabSerializer(Serializer): # Thanks to the this serializer, the api will be able to serialize and deserialize a project in cinelab json format @@ -69,8 +67,9 @@ ldt_id = generate_uuid() # default state = (1, 'edition') OR (2, 'published') state = 2 - contents = [reverse("api_dispatch_detail", kwargs={"api_name":"1.0", "resource_name":"contents", "iri_id":c["id"]}) for c in cinelab["medias"]] - owner_uri = reverse("api_dispatch_detail", kwargs={"api_name":"1.0", "resource_name":"users", "username":meta["dc:creator"]}) + + contents = [reverse_prefix("api_dispatch_detail", kwargs={"api_name":"1.0", "resource_name":"contents", "iri_id":c["id"]}) for c in cinelab["medias"]] + owner_uri = reverse_prefix("api_dispatch_detail", kwargs={"api_name":"1.0", "resource_name":"users", "username":meta["dc:creator"]}) ldt = lxml.etree.tostring(self.cinelab_to_ldt(cinelab), pretty_print=True) diff -r 3fb6b550840c -r 0d86ca7ccc7b src/ldt/ldt/api/ldt/urls.py --- a/src/ldt/ldt/api/ldt/urls.py Wed May 15 12:18:43 2013 +0200 +++ b/src/ldt/ldt/api/ldt/urls.py Fri May 24 21:55:08 2013 +0200 @@ -1,4 +1,4 @@ -from django.conf.urls.defaults import patterns, include +from django.conf.urls import patterns, include from ldt.api.ldt.resources import ProjectResource, ContentResource, SegmentResource, AnnotationResource, UserResource, TagResource from tastypie.api import Api diff -r 3fb6b550840c -r 0d86ca7ccc7b src/ldt/ldt/api/middleware/pistonput.py --- a/src/ldt/ldt/api/middleware/pistonput.py Wed May 15 12:18:43 2013 +0200 +++ b/src/ldt/ldt/api/middleware/pistonput.py Fri May 24 21:55:08 2013 +0200 @@ -3,8 +3,6 @@ piston does not like 'charset=UTF-8" in PUT request """ -from django.conf import settings - class PistonPutMiddleware(object): def process_request(self, request): diff -r 3fb6b550840c -r 0d86ca7ccc7b src/ldt/ldt/api/urls.py --- a/src/ldt/ldt/api/urls.py Wed May 15 12:18:43 2013 +0200 +++ b/src/ldt/ldt/api/urls.py Fri May 24 21:55:08 2013 +0200 @@ -1,4 +1,4 @@ -from django.conf.urls.defaults import patterns, include +from django.conf.urls import patterns, include urlpatterns = patterns('', # all my other url mappings diff -r 3fb6b550840c -r 0d86ca7ccc7b src/ldt/ldt/auth/__init__.py --- a/src/ldt/ldt/auth/__init__.py Wed May 15 12:18:43 2013 +0200 +++ b/src/ldt/ldt/auth/__init__.py Fri May 24 21:55:08 2013 +0200 @@ -1,3 +1,6 @@ +from django.conf import settings +from social_auth.backends import get_backends + def check_access(user, obj): check_meth = getattr(obj, 'check_access', False) @@ -5,3 +8,13 @@ return check_meth(user) else: return user.is_staff + +def social_list(): + """Start list process""" + l = [] + # We list all wanted backends among all availables + for backend in get_backends(): + for backend_str in settings.AUTHENTICATION_BACKENDS: + if backend in backend_str: + l.append(backend) + return l \ No newline at end of file diff -r 3fb6b550840c -r 0d86ca7ccc7b src/ldt/ldt/auth/views.py --- a/src/ldt/ldt/auth/views.py Wed May 15 12:18:43 2013 +0200 +++ b/src/ldt/ldt/auth/views.py Fri May 24 21:55:08 2013 +0200 @@ -1,8 +1,7 @@ from django.contrib.auth import REDIRECT_FIELD_NAME from django.contrib.auth.forms import AuthenticationForm from django.contrib.auth.views import login as django_login -from social_auth.views import list as social_list - +from ldt.auth import social_list def login(request, template_name='registration/login.html', redirect_field_name=REDIRECT_FIELD_NAME, diff -r 3fb6b550840c -r 0d86ca7ccc7b src/ldt/ldt/core/handlers/modpython.py --- a/src/ldt/ldt/core/handlers/modpython.py Wed May 15 12:18:43 2013 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ - -def handler(req): - activate_this = req.get_options().get("virtualenv.activate_path") - execfile(activate_this, dict(__file__=activate_this)) - - import django.core.handlers.modpython - - return django.core.handlers.modpython.handler(req) diff -r 3fb6b550840c -r 0d86ca7ccc7b src/ldt/ldt/core/models.py --- a/src/ldt/ldt/core/models.py Wed May 15 12:18:43 2013 +0200 +++ b/src/ldt/ldt/core/models.py Fri May 24 21:55:08 2013 +0200 @@ -1,9 +1,8 @@ -from django.contrib.auth.models import User from django.db import models - +from django.conf import settings class Document(models.Model): - owner = models.ForeignKey(User, blank=True, null=True) + owner = models.ForeignKey(settings.AUTH_USER_MODEL, blank=True, null=True) class Meta: abstract = True diff -r 3fb6b550840c -r 0d86ca7ccc7b src/ldt/ldt/forms/fields.py --- a/src/ldt/ldt/forms/fields.py Wed May 15 12:18:43 2013 +0200 +++ b/src/ldt/ldt/forms/fields.py Fri May 24 21:55:08 2013 +0200 @@ -3,11 +3,9 @@ """ from django import forms +from django.core.exceptions import ValidationError from django.utils.translation import ugettext_lazy as _ -from django.core.exceptions import ValidationError -import logging import time -import math __all__ = ( 'LdtDurationField' @@ -29,9 +27,9 @@ def to_python(self, value): dur = value - for format in self.formats: + for f in self.formats: try: - dur = time.strptime(dur, format) + dur = time.strptime(dur, f) dur = dur.tm_hour*3600 + dur.tm_min*60 + dur.tm_sec dur = dur*1000 break diff -r 3fb6b550840c -r 0d86ca7ccc7b src/ldt/ldt/forms/widgets.py --- a/src/ldt/ldt/forms/widgets.py Wed May 15 12:18:43 2013 +0200 +++ b/src/ldt/ldt/forms/widgets.py Fri May 24 21:55:08 2013 +0200 @@ -3,12 +3,8 @@ """ from django.contrib.admin.widgets import AdminSplitDateTime -from django.forms.widgets import TimeInput from django.utils.safestring import mark_safe from django.utils.translation import ugettext as _ -import time -import math -import logging class LdtSplitDateTime(AdminSplitDateTime): diff -r 3fb6b550840c -r 0d86ca7ccc7b src/ldt/ldt/indexation/__init__.py --- a/src/ldt/ldt/indexation/__init__.py Wed May 15 12:18:43 2013 +0200 +++ b/src/ldt/ldt/indexation/__init__.py Fri May 24 21:55:08 2013 +0200 @@ -5,8 +5,6 @@ from haystack.query import SearchQuerySet from ldt.indexation.highlighter import LdtHighlighter as Highlighter from ldt.indexation.query_parser import QueryParser -from ldt.ldt_utils.models import Segment -from ldt.text.models import Annotation import re import sys @@ -33,6 +31,9 @@ def get_results_list(field, query, highlight=True): + #put import here to avoid a circular dependency + from ldt.ldt_utils.models import Segment + if field == 'all': field = 'text' @@ -47,6 +48,9 @@ def get_result_text(field, query): + #put import here to avoid a circular dependency + from ldt.text.models import Annotation + if field == 'all': field = 'text' elif field == 'text': diff -r 3fb6b550840c -r 0d86ca7ccc7b src/ldt/ldt/indexation/backends/elasticsearch_backend.py --- a/src/ldt/ldt/indexation/backends/elasticsearch_backend.py Wed May 15 12:18:43 2013 +0200 +++ b/src/ldt/ldt/indexation/backends/elasticsearch_backend.py Fri May 24 21:55:08 2013 +0200 @@ -4,14 +4,11 @@ @author: ymh ''' -from django.db.models.loading import get_model -from haystack.backends import BaseEngine, SearchResult, elasticsearch_backend -from haystack.constants import DJANGO_CT, DJANGO_ID +from haystack.backends import BaseEngine, elasticsearch_backend from haystack.exceptions import MissingDependency from haystack.utils import get_identifier -from ldt.ldt_utils.models import Segment +#from ldt.ldt_utils.models import Segment import collections -import datetime try: import requests except ImportError: @@ -46,7 +43,7 @@ if highlight: fields_def = { } - if models is None or len(models) == 0 or Segment in models: + if models is None or len(models) == 0 :#or Segment in models: fields_def['tags'] = {} fields_def['title'] = {} fields_def['abstract'] = {} diff -r 3fb6b550840c -r 0d86ca7ccc7b src/ldt/ldt/indexation/signals.py --- a/src/ldt/ldt/indexation/signals.py Wed May 15 12:18:43 2013 +0200 +++ b/src/ldt/ldt/indexation/signals.py Fri May 24 21:55:08 2013 +0200 @@ -6,8 +6,6 @@ ''' from django.db import models from haystack import signals -from ldt.ldt_utils.models import Segment -from ldt.text.models import Annotation class LdtSignalProcessor(signals.BaseSignalProcessor): @@ -20,13 +18,20 @@ models.signals.post_delete.disconnect(self.handle_delete, sender=klass) - def setup(self): + def setup(self): + #put import here to avoid circular + from ldt.ldt_utils.models import Segment + from ldt.text.models import Annotation + self.__connect_signals(Segment) self.__connect_signals(Annotation) def teardown(self): + from ldt.ldt_utils.models import Segment + from ldt.text.models import Annotation + self.__disconnect_signals(Annotation) self.__disconnect_signals(Segment) \ No newline at end of file diff -r 3fb6b550840c -r 0d86ca7ccc7b src/ldt/ldt/ldt_utils/admin.py --- a/src/ldt/ldt/ldt_utils/admin.py Wed May 15 12:18:43 2013 +0200 +++ b/src/ldt/ldt/ldt_utils/admin.py Fri May 24 21:55:08 2013 +0200 @@ -1,17 +1,16 @@ -from django.conf.urls.defaults import patterns, url +from StringIO import StringIO +from django.conf.urls import patterns, url from django.contrib import admin +from django.core.management import call_command +from django.http import HttpResponse from django.shortcuts import render_to_response from django.template import RequestContext +from guardian.admin import GuardedModelAdmin from ldt.ldt_utils.contentindexer import ContentIndexer, ProjectIndexer from ldt.ldt_utils.fileimport import FileImport, FileImportError from ldt.ldt_utils.forms import LdtImportForm, ReindexForm, StatAnnotationForm from ldt.ldt_utils.models import Content, Project, Media, Author from ldt.ldt_utils.stat import update_stat_content -from guardian.admin import GuardedModelAdmin -from django.http import HttpResponse -from StringIO import StringIO -from django.core.management import call_command -import logging class ProjectAdmin(GuardedModelAdmin): diff -r 3fb6b550840c -r 0d86ca7ccc7b src/ldt/ldt/ldt_utils/middleware/userprofile.py --- a/src/ldt/ldt/ldt_utils/middleware/userprofile.py Wed May 15 12:18:43 2013 +0200 +++ b/src/ldt/ldt/ldt_utils/middleware/userprofile.py Fri May 24 21:55:08 2013 +0200 @@ -6,8 +6,7 @@ def process_request(self, request): if request.user.is_authenticated(): - profile = request.user.get_profile() - language = profile.language + language = request.user.language else: language = settings.LANGUAGE_CODE[:2] request.user.is_regular = False diff -r 3fb6b550840c -r 0d86ca7ccc7b src/ldt/ldt/ldt_utils/migrations/0006_auto__add_field_media_image.py --- a/src/ldt/ldt/ldt_utils/migrations/0006_auto__add_field_media_image.py Wed May 15 12:18:43 2013 +0200 +++ b/src/ldt/ldt/ldt_utils/migrations/0006_auto__add_field_media_image.py Fri May 24 21:55:08 2013 +0200 @@ -1,21 +1,19 @@ # encoding: utf-8 -import datetime from south.db import db from south.v2 import SchemaMigration -from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding field 'Media.image' - db.add_column('ldt_utils_media', 'image', self.gf('sorl.thumbnail.fields.ImageField')(default='thumbnails/contents/drive.jpg', max_length=100), keep_default=False) + db.add_column('ldt_utils_media', 'image', self.gf('sorl.thumbnail.fields.ImageField')(default='thumbnails/contents/drive.jpg', max_length=100), keep_default=False) # @UndefinedVariable def backwards(self, orm): # Deleting field 'Media.image' - db.delete_column('ldt_utils_media', 'image') + db.delete_column('ldt_utils_media', 'image') # @UndefinedVariable models = { diff -r 3fb6b550840c -r 0d86ca7ccc7b src/ldt/ldt/ldt_utils/migrations/0007_auto__add_field_content_image__del_field_media_image.py --- a/src/ldt/ldt/ldt_utils/migrations/0007_auto__add_field_content_image__del_field_media_image.py Wed May 15 12:18:43 2013 +0200 +++ b/src/ldt/ldt/ldt_utils/migrations/0007_auto__add_field_content_image__del_field_media_image.py Fri May 24 21:55:08 2013 +0200 @@ -1,28 +1,26 @@ # encoding: utf-8 -import datetime from django.conf import settings from south.db import db from south.v2 import SchemaMigration -from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding field 'Content.image' - db.add_column('ldt_utils_content', 'image', self.gf('sorl.thumbnail.fields.ImageField')(default=settings.DEFAULT_CONTENT_ICON, max_length=100), keep_default=False) + db.add_column('ldt_utils_content', 'image', self.gf('sorl.thumbnail.fields.ImageField')(default=settings.DEFAULT_CONTENT_ICON, max_length=100), keep_default=False) # @UndefinedVariable # Deleting field 'Media.image' - db.delete_column('ldt_utils_media', 'image') + db.delete_column('ldt_utils_media', 'image') # @UndefinedVariable def backwards(self, orm): # Deleting field 'Content.image' - db.delete_column('ldt_utils_content', 'image') + db.delete_column('ldt_utils_content', 'image') # @UndefinedVariable # Adding field 'Media.image' - db.add_column('ldt_utils_media', 'image', self.gf('sorl.thumbnail.fields.ImageField')(default='thumbnails/media/drive.jpg', max_length=100), keep_default=False) + db.add_column('ldt_utils_media', 'image', self.gf('sorl.thumbnail.fields.ImageField')(default='thumbnails/media/drive.jpg', max_length=100), keep_default=False) # @UndefinedVariable models = { diff -r 3fb6b550840c -r 0d86ca7ccc7b src/ldt/ldt/ldt_utils/migrations/0008_auto__add_field_project_image.py --- a/src/ldt/ldt/ldt_utils/migrations/0008_auto__add_field_project_image.py Wed May 15 12:18:43 2013 +0200 +++ b/src/ldt/ldt/ldt_utils/migrations/0008_auto__add_field_project_image.py Fri May 24 21:55:08 2013 +0200 @@ -1,21 +1,19 @@ # encoding: utf-8 -import datetime from south.db import db from south.v2 import SchemaMigration -from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding field 'Project.image' - db.add_column('ldt_utils_project', 'image', self.gf('sorl.thumbnail.fields.ImageField')(default='thumbnails/projects/project_default_icon.png', max_length=100), keep_default=False) + db.add_column('ldt_utils_project', 'image', self.gf('sorl.thumbnail.fields.ImageField')(default='thumbnails/projects/project_default_icon.png', max_length=100), keep_default=False) # @UndefinedVariable def backwards(self, orm): # Deleting field 'Project.image' - db.delete_column('ldt_utils_project', 'image') + db.delete_column('ldt_utils_project', 'image') # @UndefinedVariable models = { diff -r 3fb6b550840c -r 0d86ca7ccc7b src/ldt/ldt/ldt_utils/migrations/0009_auto__chg_field_content_image__chg_field_project_image.py --- a/src/ldt/ldt/ldt_utils/migrations/0009_auto__chg_field_content_image__chg_field_project_image.py Wed May 15 12:18:43 2013 +0200 +++ b/src/ldt/ldt/ldt_utils/migrations/0009_auto__chg_field_content_image__chg_field_project_image.py Fri May 24 21:55:08 2013 +0200 @@ -1,27 +1,25 @@ # encoding: utf-8 -import datetime from south.db import db from south.v2 import SchemaMigration -from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Changing field 'Content.image' - db.alter_column('ldt_utils_content', 'image', self.gf('sorl.thumbnail.fields.ImageField')(max_length=200)) + db.alter_column('ldt_utils_content', 'image', self.gf('sorl.thumbnail.fields.ImageField')(max_length=200)) # @UndefinedVariable # Changing field 'Project.image' - db.alter_column('ldt_utils_project', 'image', self.gf('sorl.thumbnail.fields.ImageField')(max_length=200)) + db.alter_column('ldt_utils_project', 'image', self.gf('sorl.thumbnail.fields.ImageField')(max_length=200)) # @UndefinedVariable def backwards(self, orm): # Changing field 'Content.image' - db.alter_column('ldt_utils_content', 'image', self.gf('sorl.thumbnail.fields.ImageField')(max_length=100)) + db.alter_column('ldt_utils_content', 'image', self.gf('sorl.thumbnail.fields.ImageField')(max_length=100)) # @UndefinedVariable # Changing field 'Project.image' - db.alter_column('ldt_utils_project', 'image', self.gf('sorl.thumbnail.fields.ImageField')(max_length=100)) + db.alter_column('ldt_utils_project', 'image', self.gf('sorl.thumbnail.fields.ImageField')(max_length=100)) # @UndefinedVariable models = { diff -r 3fb6b550840c -r 0d86ca7ccc7b src/ldt/ldt/ldt_utils/migrations/0015_auto__add_contentstat__del_field_content_last_annotated__del_field_con.py --- a/src/ldt/ldt/ldt_utils/migrations/0015_auto__add_contentstat__del_field_content_last_annotated__del_field_con.py Wed May 15 12:18:43 2013 +0200 +++ b/src/ldt/ldt/ldt_utils/migrations/0015_auto__add_contentstat__del_field_content_last_annotated__del_field_con.py Fri May 24 21:55:08 2013 +0200 @@ -1,15 +1,14 @@ # encoding: utf-8 -import datetime from south.db import db from south.v2 import SchemaMigration -from django.db import models +import datetime class Migration(SchemaMigration): def forwards(self, orm): # Adding model 'ContentStat' - db.create_table('ldt_utils_contentstat', ( + db.create_table('ldt_utils_contentstat', ( # @UndefinedVariable ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), ('content', self.gf('django.db.models.fields.related.ForeignKey')(related_name='stat_annotation', unique=True, to=orm['ldt_utils.Content'])), ('annotation_volume_str', self.gf('django.db.models.fields.CommaSeparatedIntegerField')(max_length=1024, null=True, blank=True)), @@ -17,31 +16,31 @@ ('nb_annotations', self.gf('django.db.models.fields.IntegerField')(default=0, db_index=True)), ('last_annotated', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime.now, null=True, blank=True)), )) - db.send_create_signal('ldt_utils', ['ContentStat']) + db.send_create_signal('ldt_utils', ['ContentStat']) # @UndefinedVariable # Deleting field 'Content.last_annotated' - db.delete_column('ldt_utils_content', 'last_annotated') + db.delete_column('ldt_utils_content', 'last_annotated') # @UndefinedVariable # Deleting field 'Content.nb_annotation' - db.delete_column('ldt_utils_content', 'nb_annotation') + db.delete_column('ldt_utils_content', 'nb_annotation') # @UndefinedVariable # Deleting field 'Content.stat_annotation' - db.delete_column('ldt_utils_content', 'stat_annotation') + db.delete_column('ldt_utils_content', 'stat_annotation') # @UndefinedVariable def backwards(self, orm): # Deleting model 'ContentStat' - db.delete_table('ldt_utils_contentstat') + db.delete_table('ldt_utils_contentstat') # @UndefinedVariable # Adding field 'Content.last_annotated' - db.add_column('ldt_utils_content', 'last_annotated', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime.now, null=True, blank=True), keep_default=False) + db.add_column('ldt_utils_content', 'last_annotated', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime.now, null=True, blank=True), keep_default=False) # @UndefinedVariable # Adding field 'Content.nb_annotation' - db.add_column('ldt_utils_content', 'nb_annotation', self.gf('django.db.models.fields.IntegerField')(null=True, blank=True), keep_default=False) + db.add_column('ldt_utils_content', 'nb_annotation', self.gf('django.db.models.fields.IntegerField')(null=True, blank=True), keep_default=False) # @UndefinedVariable # Adding field 'Content.stat_annotation' - db.add_column('ldt_utils_content', 'stat_annotation', self.gf('django.db.models.fields.CommaSeparatedIntegerField')(max_length=1024, null=True, blank=True), keep_default=False) + db.add_column('ldt_utils_content', 'stat_annotation', self.gf('django.db.models.fields.CommaSeparatedIntegerField')(max_length=1024, null=True, blank=True), keep_default=False) # @UndefinedVariable models = { diff -r 3fb6b550840c -r 0d86ca7ccc7b src/ldt/ldt/ldt_utils/migrations/0016_one_to_one_stat_annotation.py --- a/src/ldt/ldt/ldt_utils/migrations/0016_one_to_one_stat_annotation.py Wed May 15 12:18:43 2013 +0200 +++ b/src/ldt/ldt/ldt_utils/migrations/0016_one_to_one_stat_annotation.py Fri May 24 21:55:08 2013 +0200 @@ -1,19 +1,19 @@ # encoding: utf-8 -from south.db import db #@UnresolvedImport -from south.v2 import SchemaMigration #@UnresolvedImport +from south.db import db +from south.v2 import SchemaMigration class Migration(SchemaMigration): def forwards(self, orm): # Changing field 'ContentStat.content' - db.alter_column('ldt_utils_contentstat', 'content_id', self.gf('django.db.models.fields.related.OneToOneField')(unique=True, to=orm['ldt_utils.Content'])) + db.alter_column('ldt_utils_contentstat', 'content_id', self.gf('django.db.models.fields.related.OneToOneField')(unique=True, to=orm['ldt_utils.Content'])) # @UndefinedVariable def backwards(self, orm): # Changing field 'ContentStat.content' - db.alter_column('ldt_utils_contentstat', 'content_id', self.gf('django.db.models.fields.related.ForeignKey')(unique=True, to=orm['ldt_utils.Content'])) + db.alter_column('ldt_utils_contentstat', 'content_id', self.gf('django.db.models.fields.related.ForeignKey')(unique=True, to=orm['ldt_utils.Content'])) # @UndefinedVariable models = { diff -r 3fb6b550840c -r 0d86ca7ccc7b src/ldt/ldt/ldt_utils/migrations/0018_auto__chg_field_content_iri_id__chg_field_project_ldt_id__chg_field_au.py --- a/src/ldt/ldt/ldt_utils/migrations/0018_auto__chg_field_content_iri_id__chg_field_project_ldt_id__chg_field_au.py Wed May 15 12:18:43 2013 +0200 +++ b/src/ldt/ldt/ldt_utils/migrations/0018_auto__chg_field_content_iri_id__chg_field_project_ldt_id__chg_field_au.py Fri May 24 21:55:08 2013 +0200 @@ -1,8 +1,6 @@ # -*- coding: utf-8 -*- -import datetime from south.db import db from south.v2 import SchemaMigration -from django.db import models import hashlib import uuid @@ -15,15 +13,15 @@ # Changing field 'Content.iri_id' - db.alter_column('ldt_utils_content', 'iri_id', self.gf('django.db.models.fields.CharField')(unique=True, max_length=255)) + db.alter_column('ldt_utils_content', 'iri_id', self.gf('django.db.models.fields.CharField')(unique=True, max_length=255)) # @UndefinedVariable # Changing field 'Project.ldt_id' - db.alter_column('ldt_utils_project', 'ldt_id', self.gf('django.db.models.fields.CharField')(unique=True, max_length=255)) + db.alter_column('ldt_utils_project', 'ldt_id', self.gf('django.db.models.fields.CharField')(unique=True, max_length=255)) # @UndefinedVariable # Changing field 'Author.handle' - db.alter_column('ldt_utils_author', 'handle', self.gf('django.db.models.fields.CharField')(max_length=255, unique=True, null=True)) + db.alter_column('ldt_utils_author', 'handle', self.gf('django.db.models.fields.CharField')(max_length=255, unique=True, null=True)) # @UndefinedVariable # Adding field 'Media.src_hash' - db.add_column('ldt_utils_media', 'src_hash', + db.add_column('ldt_utils_media', 'src_hash', # @UndefinedVariable self.gf('django.db.models.fields.CharField')(default=lambda : hashlib.sha512(str(uuid.uuid1())).hexdigest(), unique=False, max_length=128), keep_default=False) @@ -31,15 +29,15 @@ def backwards(self, orm): # Changing field 'Content.iri_id' - db.alter_column('ldt_utils_content', 'iri_id', self.gf('django.db.models.fields.CharField')(max_length=255, unique=True)) + db.alter_column('ldt_utils_content', 'iri_id', self.gf('django.db.models.fields.CharField')(max_length=255, unique=True)) # @UndefinedVariable # Changing field 'Project.ldt_id' - db.alter_column('ldt_utils_project', 'ldt_id', self.gf('django.db.models.fields.CharField')(max_length=255, unique=True)) + db.alter_column('ldt_utils_project', 'ldt_id', self.gf('django.db.models.fields.CharField')(max_length=255, unique=True)) # @UndefinedVariable # Changing field 'Author.handle' - db.alter_column('ldt_utils_author', 'handle', self.gf('django.db.models.fields.CharField')(unique=True, max_length=255, null=True)) + db.alter_column('ldt_utils_author', 'handle', self.gf('django.db.models.fields.CharField')(unique=True, max_length=255, null=True)) # @UndefinedVariable # Deleting field 'Media.src_hash' - db.delete_column('ldt_utils_media', 'src_hash') + db.delete_column('ldt_utils_media', 'src_hash') # @UndefinedVariable # Adding unique constraint on 'Media', fields ['src'] #db.create_unique('ldt_utils_media', ['src']) diff -r 3fb6b550840c -r 0d86ca7ccc7b src/ldt/ldt/ldt_utils/migrations/0020_auto__add_field_segment_id_hash__chg_field_segment_iri_id__chg_field_s.py --- a/src/ldt/ldt/ldt_utils/migrations/0020_auto__add_field_segment_id_hash__chg_field_segment_iri_id__chg_field_s.py Wed May 15 12:18:43 2013 +0200 +++ b/src/ldt/ldt/ldt_utils/migrations/0020_auto__add_field_segment_id_hash__chg_field_segment_iri_id__chg_field_s.py Fri May 24 21:55:08 2013 +0200 @@ -1,8 +1,6 @@ # -*- coding: utf-8 -*- -import datetime from south.db import db from south.v2 import SchemaMigration -from django.db import models import hashlib import uuid @@ -14,73 +12,73 @@ #db.delete_unique('ldt_utils_segment', ['ensemble_id', 'element_id', 'project_id', 'iri_id', 'cutting_id']) # Changing field 'Segment.iri_id' - db.alter_column('ldt_utils_segment', 'iri_id', self.gf('django.db.models.fields.CharField')(max_length=255)) + db.alter_column('ldt_utils_segment', 'iri_id', self.gf('django.db.models.fields.CharField')(max_length=255)) # @UndefinedVariable # Changing field 'Segment.project_id' - db.alter_column('ldt_utils_segment', 'project_id', self.gf('django.db.models.fields.CharField')(max_length=255, null=True)) + db.alter_column('ldt_utils_segment', 'project_id', self.gf('django.db.models.fields.CharField')(max_length=255, null=True)) # @UndefinedVariable # Adding field 'Segment.id_hash' - db.add_column('ldt_utils_segment', 'id_hash', + db.add_column('ldt_utils_segment', 'id_hash', # @UndefinedVariable self.gf('django.db.models.fields.CharField')(default=lambda : hashlib.sha512(str(uuid.uuid1())).hexdigest(), max_length=128), keep_default=False) # Changing field 'Segment.iri_id' - db.alter_column('ldt_utils_segment', 'iri_id', self.gf('django.db.models.fields.CharField')(max_length=255)) + db.alter_column('ldt_utils_segment', 'iri_id', self.gf('django.db.models.fields.CharField')(max_length=255)) # @UndefinedVariable # Adding index on 'Segment', fields ['iri_id'] - db.create_index('ldt_utils_segment', ['iri_id']) + db.create_index('ldt_utils_segment', ['iri_id']) # @UndefinedVariable # Changing field 'Segment.project_id' - db.alter_column('ldt_utils_segment', 'project_id', self.gf('django.db.models.fields.CharField')(max_length=255, null=True)) + db.alter_column('ldt_utils_segment', 'project_id', self.gf('django.db.models.fields.CharField')(max_length=255, null=True)) # @UndefinedVariable # Adding index on 'Segment', fields ['project_id'] - db.create_index('ldt_utils_segment', ['project_id']) + db.create_index('ldt_utils_segment', ['project_id']) # @UndefinedVariable # Changing field 'Segment.cutting_id' - db.alter_column('ldt_utils_segment', 'cutting_id', self.gf('django.db.models.fields.CharField')(max_length=512)) + db.alter_column('ldt_utils_segment', 'cutting_id', self.gf('django.db.models.fields.CharField')(max_length=512)) # @UndefinedVariable # Changing field 'Segment.ensemble_id' - db.alter_column('ldt_utils_segment', 'ensemble_id', self.gf('django.db.models.fields.CharField')(max_length=512)) + db.alter_column('ldt_utils_segment', 'ensemble_id', self.gf('django.db.models.fields.CharField')(max_length=512)) # @UndefinedVariable # Changing field 'Segment.element_id' - db.alter_column('ldt_utils_segment', 'element_id', self.gf('django.db.models.fields.CharField')(max_length=512)) + db.alter_column('ldt_utils_segment', 'element_id', self.gf('django.db.models.fields.CharField')(max_length=512)) # @UndefinedVariable def backwards(self, orm): # Removing index on 'Segment', fields ['project_id'] - db.delete_index('ldt_utils_segment', ['project_id']) + db.delete_index('ldt_utils_segment', ['project_id']) # @UndefinedVariable # Removing index on 'Segment', fields ['iri_id'] - db.delete_index('ldt_utils_segment', ['iri_id']) + db.delete_index('ldt_utils_segment', ['iri_id']) # @UndefinedVariable # Deleting field 'Segment.id_hash' - db.delete_column('ldt_utils_segment', 'id_hash') + db.delete_column('ldt_utils_segment', 'id_hash') # @UndefinedVariable # Changing field 'Segment.iri_id' - db.alter_column('ldt_utils_segment', 'iri_id', self.gf('django.db.models.fields.CharField')(max_length=1024)) + db.alter_column('ldt_utils_segment', 'iri_id', self.gf('django.db.models.fields.CharField')(max_length=1024)) # @UndefinedVariable # Changing field 'Segment.project_id' - db.alter_column('ldt_utils_segment', 'project_id', self.gf('django.db.models.fields.CharField')(max_length=1024, null=True)) + db.alter_column('ldt_utils_segment', 'project_id', self.gf('django.db.models.fields.CharField')(max_length=1024, null=True)) # @UndefinedVariable # Adding unique constraint on 'Segment', fields ['ensemble_id', 'element_id', 'project_id', 'iri_id', 'cutting_id'] #db.create_unique('ldt_utils_segment', ['ensemble_id', 'element_id', 'project_id', 'iri_id', 'cutting_id']) # Changing field 'Segment.iri_id' - db.alter_column('ldt_utils_segment', 'iri_id', self.gf('django.db.models.fields.CharField')(max_length=1024)) + db.alter_column('ldt_utils_segment', 'iri_id', self.gf('django.db.models.fields.CharField')(max_length=1024)) # @UndefinedVariable # Changing field 'Segment.project_id' - db.alter_column('ldt_utils_segment', 'project_id', self.gf('django.db.models.fields.CharField')(max_length=1024, null=True)) + db.alter_column('ldt_utils_segment', 'project_id', self.gf('django.db.models.fields.CharField')(max_length=1024, null=True)) # @UndefinedVariable # Changing field 'Segment.cutting_id' - db.alter_column('ldt_utils_segment', 'cutting_id', self.gf('django.db.models.fields.CharField')(max_length=1024)) + db.alter_column('ldt_utils_segment', 'cutting_id', self.gf('django.db.models.fields.CharField')(max_length=1024)) # @UndefinedVariable # Changing field 'Segment.ensemble_id' - db.alter_column('ldt_utils_segment', 'ensemble_id', self.gf('django.db.models.fields.CharField')(max_length=1024)) + db.alter_column('ldt_utils_segment', 'ensemble_id', self.gf('django.db.models.fields.CharField')(max_length=1024)) # @UndefinedVariable # Changing field 'Segment.element_id' - db.alter_column('ldt_utils_segment', 'element_id', self.gf('django.db.models.fields.CharField')(max_length=1024)) + db.alter_column('ldt_utils_segment', 'element_id', self.gf('django.db.models.fields.CharField')(max_length=1024)) # @UndefinedVariable diff -r 3fb6b550840c -r 0d86ca7ccc7b src/ldt/ldt/ldt_utils/migrations/0022_auto__add_unique_media_src_hash__chg_field_segment_cutting_id__chg_fie.py --- a/src/ldt/ldt/ldt_utils/migrations/0022_auto__add_unique_media_src_hash__chg_field_segment_cutting_id__chg_fie.py Wed May 15 12:18:43 2013 +0200 +++ b/src/ldt/ldt/ldt_utils/migrations/0022_auto__add_unique_media_src_hash__chg_field_segment_cutting_id__chg_fie.py Fri May 24 21:55:08 2013 +0200 @@ -1,45 +1,43 @@ # -*- coding: utf-8 -*- -import datetime from south.db import db from south.v2 import SchemaMigration -from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding unique constraint on 'Media', fields ['src_hash'] - db.create_unique('ldt_utils_media', ['src_hash']) + db.create_unique('ldt_utils_media', ['src_hash']) # @UndefinedVariable # Changing field 'Segment.cutting_id' - db.alter_column('ldt_utils_segment', 'cutting_id', self.gf('django.db.models.fields.CharField')(max_length=512)) + db.alter_column('ldt_utils_segment', 'cutting_id', self.gf('django.db.models.fields.CharField')(max_length=512)) # @UndefinedVariable # Changing field 'Segment.ensemble_id' - db.alter_column('ldt_utils_segment', 'ensemble_id', self.gf('django.db.models.fields.CharField')(max_length=512)) + db.alter_column('ldt_utils_segment', 'ensemble_id', self.gf('django.db.models.fields.CharField')(max_length=512)) # @UndefinedVariable # Adding unique constraint on 'Segment', fields ['id_hash'] - db.create_unique('ldt_utils_segment', ['id_hash']) + db.create_unique('ldt_utils_segment', ['id_hash']) # @UndefinedVariable # Changing field 'Segment.element_id' - db.alter_column('ldt_utils_segment', 'element_id', self.gf('django.db.models.fields.CharField')(max_length=512)) + db.alter_column('ldt_utils_segment', 'element_id', self.gf('django.db.models.fields.CharField')(max_length=512)) # @UndefinedVariable def backwards(self, orm): # Removing unique constraint on 'Segment', fields ['id_hash'] - db.delete_unique('ldt_utils_segment', ['id_hash']) + db.delete_unique('ldt_utils_segment', ['id_hash']) # @UndefinedVariable # Removing unique constraint on 'Media', fields ['src_hash'] - db.delete_unique('ldt_utils_media', ['src_hash']) + db.delete_unique('ldt_utils_media', ['src_hash']) # @UndefinedVariable # Changing field 'Segment.cutting_id' - db.alter_column('ldt_utils_segment', 'cutting_id', self.gf('django.db.models.fields.CharField')(max_length=1024)) + db.alter_column('ldt_utils_segment', 'cutting_id', self.gf('django.db.models.fields.CharField')(max_length=1024)) # @UndefinedVariable # Changing field 'Segment.ensemble_id' - db.alter_column('ldt_utils_segment', 'ensemble_id', self.gf('django.db.models.fields.CharField')(max_length=1024)) + db.alter_column('ldt_utils_segment', 'ensemble_id', self.gf('django.db.models.fields.CharField')(max_length=1024)) # @UndefinedVariable # Changing field 'Segment.element_id' - db.alter_column('ldt_utils_segment', 'element_id', self.gf('django.db.models.fields.CharField')(max_length=1024)) + db.alter_column('ldt_utils_segment', 'element_id', self.gf('django.db.models.fields.CharField')(max_length=1024)) # @UndefinedVariable models = { 'auth.group': { diff -r 3fb6b550840c -r 0d86ca7ccc7b src/ldt/ldt/ldt_utils/migrations/0023_auto__add_field_segment_audio_src__add_field_segment_audio_href.py --- a/src/ldt/ldt/ldt_utils/migrations/0023_auto__add_field_segment_audio_src__add_field_segment_audio_href.py Wed May 15 12:18:43 2013 +0200 +++ b/src/ldt/ldt/ldt_utils/migrations/0023_auto__add_field_segment_audio_src__add_field_segment_audio_href.py Fri May 24 21:55:08 2013 +0200 @@ -1,21 +1,19 @@ # -*- coding: utf-8 -*- -import datetime +from django.core.management import call_command from south.db import db from south.v2 import SchemaMigration -from django.core.management import call_command -from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding field 'Segment.audio_src' - db.add_column('ldt_utils_segment', 'audio_src', + db.add_column('ldt_utils_segment', 'audio_src', # @UndefinedVariable self.gf('django.db.models.fields.CharField')(max_length=255, null=True, blank=True), keep_default=False) # Adding field 'Segment.audio_href' - db.add_column('ldt_utils_segment', 'audio_href', + db.add_column('ldt_utils_segment', 'audio_href', # @UndefinedVariable self.gf('django.db.models.fields.CharField')(max_length=512, null=True, blank=True), keep_default=False) @@ -25,10 +23,10 @@ def backwards(self, orm): # Deleting field 'Segment.audio_src' - db.delete_column('ldt_utils_segment', 'audio_src') + db.delete_column('ldt_utils_segment', 'audio_src') # @UndefinedVariable # Deleting field 'Segment.audio_href' - db.delete_column('ldt_utils_segment', 'audio_href') + db.delete_column('ldt_utils_segment', 'audio_href') # @UndefinedVariable diff -r 3fb6b550840c -r 0d86ca7ccc7b src/ldt/ldt/ldt_utils/migrations/0025_chg_site_domain.py --- a/src/ldt/ldt/ldt_utils/migrations/0025_chg_site_domain.py Wed May 15 12:18:43 2013 +0200 +++ b/src/ldt/ldt/ldt_utils/migrations/0025_chg_site_domain.py Fri May 24 21:55:08 2013 +0200 @@ -1,9 +1,6 @@ # -*- coding: utf-8 -*- -import datetime -from south.db import db +from django.conf import settings from south.v2 import DataMigration -from django.conf import settings -from django.db import models class Migration(DataMigration): diff -r 3fb6b550840c -r 0d86ca7ccc7b src/ldt/ldt/ldt_utils/migrations/0027_auto__chg_field_project_owner__chg_field_media_creator.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/ldt/ldt/ldt_utils/migrations/0027_auto__chg_field_project_owner__chg_field_media_creator.py Fri May 24 21:55:08 2013 +0200 @@ -0,0 +1,160 @@ +# -*- coding: utf-8 -*- +from south.db import db +from south.v2 import SchemaMigration + + +class Migration(SchemaMigration): + + depends_on = ( + ("user", "0009_rename_auth_user_to_user_ldt_user"), + ) + + def forwards(self, orm): + + # Changing field 'Project.owner' + db.alter_column(u'ldt_utils_project', 'owner_id', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['user.LdtUser'], null=True)) # @UndefinedVariable + + # Changing field 'Media.creator' + db.alter_column(u'ldt_utils_media', 'creator_id', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['user.LdtUser'], null=True)) # @UndefinedVariable + + def backwards(self, orm): + + # Changing field 'Project.owner' + db.alter_column(u'ldt_utils_project', 'owner_id', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['auth.User'], null=True)) # @UndefinedVariable + + # Changing field 'Media.creator' + db.alter_column(u'ldt_utils_media', 'creator_id', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['auth.User'], null=True)) # @UndefinedVariable + + models = { + u'auth.group': { + 'Meta': {'object_name': 'Group'}, + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), + 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) + }, + u'auth.permission': { + 'Meta': {'ordering': "(u'content_type__app_label', u'content_type__model', u'codename')", 'unique_together': "((u'content_type', u'codename'),)", 'object_name': 'Permission'}, + 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']"}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) + }, + u'contenttypes.contenttype': { + 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, + 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) + }, + u'ldt_utils.author': { + 'Meta': {'object_name': 'Author'}, + 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'null': 'True', 'blank': 'True'}), + 'firstname': ('django.db.models.fields.CharField', [], {'max_length': '512', 'null': 'True', 'blank': 'True'}), + 'handle': ('django.db.models.fields.CharField', [], {'max_length': '255', 'unique': 'True', 'null': 'True', 'blank': 'True'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'lastname': ('django.db.models.fields.CharField', [], {'max_length': '512', 'null': 'True', 'blank': 'True'}) + }, + u'ldt_utils.content': { + 'Meta': {'ordering': "['title']", 'object_name': 'Content'}, + 'authors': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['ldt_utils.Author']", 'symmetrical': 'False', 'blank': 'True'}), + 'content_creation_date': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), + 'creation_date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), + 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'duration': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'front_project': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['ldt_utils.Project']", 'null': 'True', 'blank': 'True'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'image': ('sorl.thumbnail.fields.ImageField', [], {'default': "'thumbnails/contents/content_default_icon.png'", 'max_length': '200'}), + 'iri_id': ('django.db.models.fields.CharField', [], {'default': "u'ed941038-be29-11e2-8b76-58b035f6b93d'", 'unique': 'True', 'max_length': '255'}), + 'iriurl': ('django.db.models.fields.CharField', [], {'max_length': '1024'}), + 'media_obj': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['ldt_utils.Media']", 'null': 'True', 'blank': 'True'}), + 'tags': ('tagging.fields.TagField', [], {'max_length': '2048', 'null': 'True'}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}), + 'update_date': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}) + }, + u'ldt_utils.contentstat': { + 'Meta': {'object_name': 'ContentStat'}, + 'annotation_volume_str': ('django.db.models.fields.CommaSeparatedIntegerField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}), + 'content': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'stat_annotation'", 'unique': 'True', 'to': u"orm['ldt_utils.Content']"}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'last_annotated': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'null': 'True', 'blank': 'True'}), + 'nb_annotations': ('django.db.models.fields.IntegerField', [], {'default': '0', 'db_index': 'True'}), + 'polemics_volume_str': ('django.db.models.fields.CommaSeparatedIntegerField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}) + }, + u'ldt_utils.media': { + 'Meta': {'object_name': 'Media'}, + 'creation_date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), + 'creator': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['user.LdtUser']", 'null': 'True', 'blank': 'True'}), + 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'duration': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'external_id': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}), + 'external_permalink': ('django.db.models.fields.URLField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}), + 'external_publication_url': ('django.db.models.fields.URLField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}), + 'external_src_url': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'media_creation_date': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), + 'mimetype_field': ('django.db.models.fields.CharField', [], {'max_length': '512', 'null': 'True', 'blank': 'True'}), + 'src': ('django.db.models.fields.CharField', [], {'max_length': '1024'}), + 'src_hash': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128', 'blank': 'True'}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}), + 'update_date': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), + 'videopath': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}) + }, + u'ldt_utils.project': { + 'Meta': {'ordering': "['title']", 'object_name': 'Project'}, + 'changed_by': ('django.db.models.fields.CharField', [], {'max_length': '70'}), + 'contents': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['ldt_utils.Content']", 'symmetrical': 'False'}), + 'created_by': ('django.db.models.fields.CharField', [], {'max_length': '70'}), + 'creation_date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), + 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'image': ('sorl.thumbnail.fields.ImageField', [], {'default': "'thumbnails/projects/project_default_icon.png'", 'max_length': '200'}), + 'ldt': ('django.db.models.fields.TextField', [], {'null': 'True'}), + 'ldt_id': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}), + 'modification_date': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), + 'owner': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['user.LdtUser']", 'null': 'True', 'blank': 'True'}), + 'state': ('django.db.models.fields.IntegerField', [], {'default': '1'}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '1024'}) + }, + u'ldt_utils.segment': { + 'Meta': {'object_name': 'Segment'}, + 'abstract': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'audio_href': ('django.db.models.fields.CharField', [], {'max_length': '512', 'null': 'True', 'blank': 'True'}), + 'audio_src': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}), + 'author': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}), + 'content': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['ldt_utils.Content']"}), + 'cutting_id': ('django.db.models.fields.CharField', [], {'max_length': '512', 'db_index': 'True'}), + 'date': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}), + 'duration': ('django.db.models.fields.IntegerField', [], {'null': 'True'}), + 'element_id': ('django.db.models.fields.CharField', [], {'max_length': '512', 'db_index': 'True'}), + 'ensemble_id': ('django.db.models.fields.CharField', [], {'max_length': '512', 'db_index': 'True'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'id_hash': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128', 'blank': 'True'}), + 'iri_id': ('django.db.models.fields.CharField', [], {'max_length': '255', 'db_index': 'True'}), + 'polemics': ('django.db.models.fields.IntegerField', [], {'default': '0', 'null': 'True', 'blank': 'True'}), + 'project_id': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '255', 'null': 'True', 'blank': 'True'}), + 'project_obj': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['ldt_utils.Project']", 'null': 'True'}), + 'start_ts': ('django.db.models.fields.IntegerField', [], {'null': 'True'}), + 'tags': ('tagging.fields.TagField', [], {'max_length': '2048', 'null': 'True'}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '2048', 'null': 'True', 'blank': 'True'}) + }, + u'user.ldtuser': { + 'Meta': {'object_name': 'LdtUser'}, + 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), + 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), + 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'image': ('sorl.thumbnail.fields.ImageField', [], {'default': "'thumbnails/users/user_default_icon.png'", 'max_length': '200'}), + 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'language': ('django.db.models.fields.CharField', [], {'default': "'fr'", 'max_length': '2'}), + 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), + 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), + 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) + } + } + + complete_apps = ['ldt_utils'] \ No newline at end of file diff -r 3fb6b550840c -r 0d86ca7ccc7b src/ldt/ldt/ldt_utils/models.py --- a/src/ldt/ldt/ldt_utils/models.py Wed May 15 12:18:43 2013 +0200 +++ b/src/ldt/ldt/ldt_utils/models.py Fri May 24 21:55:08 2013 +0200 @@ -1,5 +1,8 @@ +from .events import post_project_save from django.conf import settings -from django.contrib.auth.models import User, Group +from django.contrib.auth import get_user_model +from django.contrib.auth.models import Group +from django.core.files.storage import default_storage from django.db import models from django.utils.translation import ugettext_lazy as _ from guardian.shortcuts import assign, remove_perm, get_perms @@ -8,13 +11,13 @@ get_current_user) from ldt.security.manager import SafeManager from ldt.security.models import SafeModel -from ldt.utils import url as url_utils +from ldt.utils import generate_hash, url as url_utils +from ldt.utils.web_url_management import get_web_url +from shutil import move from sorl.thumbnail import ImageField from tagging.models import Tag from utils import (create_ldt, copy_ldt, create_empty_iri, update_iri, generate_uuid) -from ldt.utils import generate_hash -from ldt.utils.web_url_management import get_web_url import datetime import lxml.etree #@UnresolvedImport import mimetypes @@ -22,10 +25,8 @@ import re import tagging.fields import uuid -from shutil import move -from django.core.files.storage import default_storage -from .events import post_project_save +User = get_user_model() class Author(SafeModel): @@ -63,7 +64,7 @@ update_date = models.DateTimeField(auto_now=True, verbose_name=_('media.update_date')) videopath = models.CharField(max_length=1024, null=True, blank=True, verbose_name=_('media.videopath')) duration = models.IntegerField(null=True, blank=True, verbose_name=_('media.duration')) - creator = models.ForeignKey(User, blank=True, null=True, verbose_name=_('media.creator')) + creator = models.ForeignKey(settings.AUTH_USER_MODEL, blank=True, null=True, verbose_name=_('media.creator')) description = models.TextField(null=True, blank=True, verbose_name=_('description')) title = models.CharField(max_length=1024, null=True, blank=True, verbose_name=_('title')) src = models.CharField(max_length=1024, verbose_name=_('media.src')) diff -r 3fb6b550840c -r 0d86ca7ccc7b src/ldt/ldt/ldt_utils/projectserializer.py --- a/src/ldt/ldt/ldt_utils/projectserializer.py Wed May 15 12:18:43 2013 +0200 +++ b/src/ldt/ldt/ldt_utils/projectserializer.py Fri May 24 21:55:08 2013 +0200 @@ -1,14 +1,17 @@ from datetime import datetime from django.conf import settings +from django.contrib.auth import get_user_model from django.contrib.contenttypes.models import ContentType from django.utils.datastructures import SortedDict -from ldt.ldt_utils.models import Content, User, Project +from ldt.ldt_utils.models import Content, Project from ldt.ldt_utils.stat import get_string_from_buckets from ldt.ldt_utils.utils import reduce_text_node import logging import lxml.etree import uuid +User = get_user_model() + DATE_FORMATS = ["%d/%m/%Y", "%Y-%m-%d"] logger = logging.getLogger(__name__) diff -r 3fb6b550840c -r 0d86ca7ccc7b src/ldt/ldt/ldt_utils/segmentserializer.py --- a/src/ldt/ldt/ldt_utils/segmentserializer.py Wed May 15 12:18:43 2013 +0200 +++ b/src/ldt/ldt/ldt_utils/segmentserializer.py Fri May 24 21:55:08 2013 +0200 @@ -1,5 +1,4 @@ from django.conf import settings -from ldt.ldt_utils.models import Project from ldt.ldt_utils.stat import get_string_from_buckets from ldt.security.utils import use_forbidden_url from tagging.utils import parse_tag_input diff -r 3fb6b550840c -r 0d86ca7ccc7b src/ldt/ldt/ldt_utils/templates/admin/ldt_utils/app_action.html --- a/src/ldt/ldt/ldt_utils/templates/admin/ldt_utils/app_action.html Wed May 15 12:18:43 2013 +0200 +++ b/src/ldt/ldt/ldt_utils/templates/admin/ldt_utils/app_action.html Fri May 24 21:55:08 2013 +0200 @@ -1,6 +1,6 @@ {% extends "admin/base_site.html" %} {% load i18n %} {% block breadcrumbs %} - + {% endblock %} diff -r 3fb6b550840c -r 0d86ca7ccc7b src/ldt/ldt/ldt_utils/templates/admin/ldt_utils/app_index.html --- a/src/ldt/ldt/ldt_utils/templates/admin/ldt_utils/app_index.html Wed May 15 12:18:43 2013 +0200 +++ b/src/ldt/ldt/ldt_utils/templates/admin/ldt_utils/app_index.html Fri May 24 21:55:08 2013 +0200 @@ -1,9 +1,8 @@ {% extends "admin/app_index.html" %} -{% load absurl %} -{% load absstatic %} +{% load static %} {% block extrastyle %} {{ block.super }} - + {% endblock %} {% load i18n %} {% block content %} @@ -13,18 +12,18 @@ - - - @@ -34,7 +33,7 @@
Import
Import + Import an ldt  
Reindex + Reindex  
Compute stats + Compute stats  
- diff -r 3fb6b550840c -r 0d86ca7ccc7b src/ldt/ldt/ldt_utils/templates/admin/ldt_utils/content/dumpdata.html --- a/src/ldt/ldt/ldt_utils/templates/admin/ldt_utils/content/dumpdata.html Wed May 15 12:18:43 2013 +0200 +++ b/src/ldt/ldt/ldt_utils/templates/admin/ldt_utils/content/dumpdata.html Fri May 24 21:55:08 2013 +0200 @@ -1,6 +1,5 @@ {% extends "admin/ldt_utils/app_action.html" %} {% load i18n %} -{% load absurl %} {# DUMP DATA #} {% block content %} {% if message %} @@ -9,8 +8,8 @@ {% endif %}
-

Click HERE if you want to download the dumpdata's json. It can be long to load. The dumpdata is full and raw, without natural keys.

+

Click HERE if you want to download the dumpdata's json. It can be long to load. The dumpdata is full and raw, without natural keys.

-Back to administration page +Back to administration page {% endblock %} diff -r 3fb6b550840c -r 0d86ca7ccc7b src/ldt/ldt/ldt_utils/templates/admin/ldt_utils/content/reindex_form.html --- a/src/ldt/ldt/ldt_utils/templates/admin/ldt_utils/content/reindex_form.html Wed May 15 12:18:43 2013 +0200 +++ b/src/ldt/ldt/ldt_utils/templates/admin/ldt_utils/content/reindex_form.html Fri May 24 21:55:08 2013 +0200 @@ -1,6 +1,5 @@ {% extends "admin/ldt_utils/app_action.html" %} {% load i18n %} -{% load absurl %} {# reindex contents #} {% block content %} {% if message %} @@ -12,13 +11,13 @@ {% endif %}
{% csrf_token %} + action="{% url 'admin:ldt_content_reindex' %}">{% csrf_token %}
Data
Dump data + Dump data  
{{ form.as_table }}
-Back to administration page +Back to administration page {% endblock %} diff -r 3fb6b550840c -r 0d86ca7ccc7b src/ldt/ldt/ldt_utils/templates/admin/ldt_utils/content/stats_form.html --- a/src/ldt/ldt/ldt_utils/templates/admin/ldt_utils/content/stats_form.html Wed May 15 12:18:43 2013 +0200 +++ b/src/ldt/ldt/ldt_utils/templates/admin/ldt_utils/content/stats_form.html Fri May 24 21:55:08 2013 +0200 @@ -1,6 +1,5 @@ {% extends "admin/ldt_utils/app_action.html" %} {% load i18n %} -{% load absurl %} {# reindex contents #} {% block content %} {% if message %} @@ -12,13 +11,13 @@ {% endif %}
{% csrf_token %} + action="{% url 'admin:ldt_project_compute_stats' %}">{% csrf_token %} {{ form.as_table }}
-Back to administration page +Back to administration page {% endblock %} diff -r 3fb6b550840c -r 0d86ca7ccc7b src/ldt/ldt/ldt_utils/templates/admin/ldt_utils/content/upload_form.html --- a/src/ldt/ldt/ldt_utils/templates/admin/ldt_utils/content/upload_form.html Wed May 15 12:18:43 2013 +0200 +++ b/src/ldt/ldt/ldt_utils/templates/admin/ldt_utils/content/upload_form.html Fri May 24 21:55:08 2013 +0200 @@ -22,6 +22,6 @@ {% endif %} -Back to administration page +Back to administration page {% endblock %} diff -r 3fb6b550840c -r 0d86ca7ccc7b src/ldt/ldt/ldt_utils/templates/front/front_all_contents.html --- a/src/ldt/ldt/ldt_utils/templates/front/front_all_contents.html Wed May 15 12:18:43 2013 +0200 +++ b/src/ldt/ldt/ldt_utils/templates/front/front_all_contents.html Fri May 24 21:55:08 2013 +0200 @@ -2,7 +2,7 @@ {% load i18n %} {% load thumbnail %} {% load front_tags %} -{% load absstatic %} +{% load static %} {% block title %} {% if tag_label %} @@ -14,13 +14,13 @@ {% block js_import %} {{block.super}} - - + + {% endblock %} {% block css_import %} {{block.super}} - + {% endblock %} {% block js_declaration %} @@ -42,17 +42,17 @@ {% block body %} {{block.super}} -{% if front_tags|length > 0 %}{% endif %} +{% if front_tags|length > 0 %}{% endif %} -{% if tag_cloud|length > 0 %} {% endif %} diff -r 3fb6b550840c -r 0d86ca7ccc7b src/ldt/ldt/ldt_utils/templates/front/front_base.html --- a/src/ldt/ldt/ldt_utils/templates/front/front_base.html Wed May 15 12:18:43 2013 +0200 +++ b/src/ldt/ldt/ldt_utils/templates/front/front_base.html Fri May 24 21:55:08 2013 +0200 @@ -1,7 +1,7 @@ {% load i18n %} {% load logintag %} {% load navigation %} -{% load absstatic %} +{% load static %} {% load analytics %} @@ -10,15 +10,15 @@ {% block head %} - + {% block title %}Lignes de temps{% endblock %} {% block js_import %} - - + + {% endblock %} {% block css_declaration %}{% endblock %} {% block css_import %} - + {% endblock %} {% block js_declaration %} - + + {% endblock %} {% block css_import %} {{block.super}} - + {% endblock %} {% block js_declaration %} @@ -36,29 +36,29 @@ {% block body %} {{block.super}} -{% if front_tags|length > 0 %}{% endif %} +{% if front_tags|length > 0 %}{% endif %}
  • - - {% if tag_cloud|length > 0 %} {% endif %}
  • {% for content in last_contents %}
  • {{ content.nb_annotations }}
    -

    {{content.title}}

    +

    {{content.title}}

    {% trans 'by' %} IRI | {{content.duration|str_duration:"h"}}

  • @@ -86,7 +86,7 @@ {% for content in most_contents %}
  • {{ content.nb_annotations }}
    -

    {% if content.title|length > 69 %}{{content.title|slice:":69"}}...{% else %}{{content.title}}{% endif %}

    +

    {% if content.title|length > 69 %}{{content.title|slice:":69"}}...{% else %}{{content.title}}{% endif %}

    {% trans 'by' %} IRI | {{content.duration|str_duration:"h"}}

  • {% endfor %} @@ -104,16 +104,16 @@
    • -

      {% trans 'Active groups' %}

      +

      {% trans 'Active groups' %}

    • {% for group in active_groups %}
    • {{ group.nb_users }}
      -

      {{group.name}}

      +

      {{group.name}}

      {% if group.get_profile.description|striptags|length > 69 %}{{group.get_profile.description|striptags|slice:":69"}}...{% else %}{{group.get_profile.description|striptags}}{% endif %}

    • diff -r 3fb6b550840c -r 0d86ca7ccc7b src/ldt/ldt/ldt_utils/templates/front/front_player.html --- a/src/ldt/ldt/ldt_utils/templates/front/front_player.html Wed May 15 12:18:43 2013 +0200 +++ b/src/ldt/ldt/ldt_utils/templates/front/front_player.html Fri May 24 21:55:08 2013 +0200 @@ -1,15 +1,15 @@ {% extends "front/front_base.html" %} {% load i18n %} {% load thumbnail %} -{% load absstatic %} +{% load static %} {% block title %}Lignes de temps : {% trans 'Annotate' %} "{{content.title}}"{% endblock %} {% block css_import %} {{block.super}} - - - + + + {% endblock %} {% block js_declaration %} diff -r 3fb6b550840c -r 0d86ca7ccc7b src/ldt/ldt/ldt_utils/templates/front/front_search_results.html --- a/src/ldt/ldt/ldt_utils/templates/front/front_search_results.html Wed May 15 12:18:43 2013 +0200 +++ b/src/ldt/ldt/ldt_utils/templates/front/front_search_results.html Fri May 24 21:55:08 2013 +0200 @@ -1,19 +1,19 @@ {% extends "front/front_base.html" %} {% load i18n %} {% load thumbnail %} -{% load absstatic %} +{% load static %} {% load front_tags %} {% block title %}Lignes de temps : {% trans 'search' %} "{{search}}" {% endblock %} {% block js_import %} {{block.super}} - + {% endblock %} {% block css_import %} {{block.super}} - + {% endblock %} {% block js_declaration %} @@ -41,7 +41,7 @@ var global_csrf_token = "{{ csrf_token }}"; - + {% endblock %} {% block body %} @@ -53,7 +53,7 @@ {% ifequal nb_results 0 %} {% if tag_label %} {% blocktrans %} No results for {{ search }} with the medias tagged {{tag_label}}{% endblocktrans %} -
      {% trans "See for all medias" %} +
      {% trans "See for all medias" %} {% else %} {% blocktrans %} No results for {{ search }}.{% endblocktrans %} {% endif %} @@ -70,7 +70,7 @@
    • {% if tag_label %} - {% trans "Search results for " %} {{ search }} > {{tag_label}} + {% trans "Search results for " %} {{ search }} > {{tag_label}} {% else %} {% trans "Search results for " %} {{ search }} {% endif %} @@ -108,15 +108,15 @@
    • - +
      -

      +

      {% if segment.title %}{{ segment.title }}{% else %}{% trans "No title" %}{% endif %}

      {% if segment.context %}{{ segment.context }}{% endif %}
      {% trans "Begin" %} : {{ segment.start_ts|str_duration:"::" }} - {% trans "duration" %} : {{ segment.duration|str_duration:"::" }}

      {% thumbnail res.content.image "300x200" format="PNG" crop="center" as im %}{% endthumbnail %} -

      +

      {% if segment.title %}{{ segment.title }}{% else %}{% trans "No title" %}{% endif %}

      {% if segment.context %}{{ segment.context }}{% else %}{{ segment.abstract }}{% endif %}

      {% if segment.context_tags or segment.tags %} @@ -135,7 +135,7 @@
    • {% if results.has_previous %} - {% trans "previous" %} + {% trans "previous" %} . {% endif %} {% if results.paginator.num_pages > 1 %} @@ -145,7 +145,7 @@ {% if i|add:'1' == results.number %} {{i|add:'1'}} {% else %} - {{i|add:'1'}} + {{i|add:'1'}} {% endif %} {% if i|add:'1' < results.paginator.num_pages and 1 < results.paginator.num_pages %} {% endif %} @@ -155,7 +155,7 @@ {% endif %} {% if results.has_next %} - {% trans "next" %} + {% trans "next" %} {% endif %}

    • diff -r 3fb6b550840c -r 0d86ca7ccc7b src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/content_list.html --- a/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/content_list.html Wed May 15 12:18:43 2013 +0200 +++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/content_list.html Fri May 24 21:55:08 2013 +0200 @@ -1,6 +1,6 @@ {% extends "ldt/user/user_base.html" %} {% load i18n %} -{% load absstatic %} +{% load static %} {% block js_declaration %} {{block.super}} @@ -48,12 +48,12 @@ {% block css_import %} {{block.super}} - + {% endblock %} {% block breadcrumb %}
    • -
    • {% trans "Space" %}
    • +
    • {% trans "Space" %}
    • {% trans "Ldt Project" %}
    • {% endblock %} @@ -74,8 +74,8 @@ {% for content in contents %} - {{ content.title }} - {% trans "create project" %} + {{ content.title }} + {% trans "create project" %} {% endfor %} diff -r 3fb6b550840c -r 0d86ca7ccc7b src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/copy_ldt.html --- a/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/copy_ldt.html Wed May 15 12:18:43 2013 +0200 +++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/copy_ldt.html Fri May 24 21:55:08 2013 +0200 @@ -1,11 +1,11 @@ {% extends "ldt/ldt_raw_base.html" %} -{% load absstatic %} +{% load static %} {% load i18n %} {# form of copy of project ldt #} {% block css_import %} {{ block.super }} - - - + + + {% endblock %} {% block body %}
      diff -r 3fb6b550840c -r 0d86ca7ccc7b src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/create_content.html --- a/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/create_content.html Wed May 15 12:18:43 2013 +0200 +++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/create_content.html Fri May 24 21:55:08 2013 +0200 @@ -1,41 +1,39 @@ {% extends "ldt/ldt_utils/workspace_base.html" %} {% load i18n %} -{% load absstatic %} -{% load absurl %} +{% load static %} - {# form of creation of content #} -{% load adminmedia %} +{# form of creation of content #} {% block js_import %} {{ block.super }} - - - - - - - + + + + + + + {{ content_form.media.js }} {% endblock %} {% block js_declaration %} - - - + + + + {% endblock %} diff -r 3fb6b550840c -r 0d86ca7ccc7b src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/create_group.html --- a/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/create_group.html Wed May 15 12:18:43 2013 +0200 +++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/create_group.html Fri May 24 21:55:08 2013 +0200 @@ -1,25 +1,23 @@ {% extends "ldt/ldt_utils/workspace_base.html" %} {% load i18n %} -{% load absstatic %} -{% load absurl %} +{% load static %} -{% load adminmedia %} {% load thumbnail %} {% block js_import %} {{ block.super }} - - - + + + {{ content_form.media.js }} {% endblock %} {% block css_import %} {{ block.super }} {{ content_form.media.css }} - - - + + + {% endblock %} @@ -44,7 +42,7 @@ $( this ).find("button[type=submit]").removeClass("e-clicked"); }); - var search_url = "{% absurl ldt.ldt_utils.views.workspace.share_filter filter='__FILTER__' use_groups='false' %}"; + var search_url = "{% url 'ldt.ldt_utils.views.workspace.share_filter' filter='__FILTER__' use_groups='false' %}"; }); @@ -55,7 +53,7 @@
      {% if group_id %}{% trans "Update a group" %}{% else %}{% trans "Create a group" %}{% endif %}
      -
      + {% csrf_token %} @@ -67,9 +65,7 @@ {% endfor %} - +
      {% include "ldt/ldt_utils/partial/permissions.html" %} diff -r 3fb6b550840c -r 0d86ca7ccc7b src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/create_ldt.html --- a/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/create_ldt.html Wed May 15 12:18:43 2013 +0200 +++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/create_ldt.html Fri May 24 21:55:08 2013 +0200 @@ -1,23 +1,22 @@ {% extends "ldt/ldt_raw_base.html" %} -{% load absstatic %} +{% load static %} {% load i18n %} {# form of creation of content #} -{% load adminmedia %} {% block js_import %} {{ block.super }} - - - - + + + + {{ content_form.media.js }} {% endblock %} {% block css_import %} {{ block.super }} {{ content_form.media.css }} - - - + + + {% endblock %} {% block js_declaration %} diff -r 3fb6b550840c -r 0d86ca7ccc7b src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/embed_iframe.html --- a/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/embed_iframe.html Wed May 15 12:18:43 2013 +0200 +++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/embed_iframe.html Fri May 24 21:55:08 2013 +0200 @@ -1,6 +1,6 @@ {% load i18n %} {% load thumbnail %} -{% load absstatic %} +{% load static %} {% load absurl %} {% load analytics %} @@ -26,7 +26,7 @@
      - + - - - + + + + {{ content_form.media.js }} {% endblock %} @@ -28,16 +28,16 @@ var LANGUAGE_CODE='{{LANGUAGE_CODE}}'; var json_url='{{json_url}}'; var player_id='{{player_id}}'; - var defaultDir='{% absstatic "ldt/js/" %}'; - var jwPlayerSWF='{% absstatic "ldt/swf/player.swf" %}'; - var recordMicSwf='{% absstatic "ldt/swf/record_mic.swf" %}'; - var zeroClipboardSwf='{% absstatic "ldt/swf/ZeroClipboard10.swf" %}'; - var cssjQueryUI='{% absstatic "ldt/css/jq-css/themes/base/jquery-ui.css" %}'; - var widgetsDir='{% absstatic "ldt/metadataplayer" %}'; - var configCss='{% absstatic "ldt/metadataplayer/LdtPlayer-core.css" %}'; - var default_thumbnail='{% absstatic "ldt/css/imgs/video_sequence.png" %}'; - var segment_api="{% absurl segment_api_empty resource_name='segments' api_name='1.0' %}{% templatetag openvariable %}media{% templatetag closevariable %}/{% templatetag openvariable %}begin{% templatetag closevariable %}/{% templatetag openvariable %}end{% templatetag closevariable %}"; - var LdtPlayer_core='{% absstatic "ldt/metadataplayer/LdtPlayer-core.js" %}'; + var defaultDir='{% static "ldt/js/" %}'; + var jwPlayerSWF='{% static "ldt/swf/player.swf" %}'; + var recordMicSwf='{% static "ldt/swf/record_mic.swf" %}'; + var zeroClipboardSwf='{% static "ldt/swf/ZeroClipboard10.swf" %}'; + var cssjQueryUI='{% static "ldt/css/jq-css/themes/base/jquery-ui.css" %}'; + var widgetsDir='{% static "ldt/metadataplayer" %}'; + var configCss='{% static "ldt/metadataplayer/LdtPlayer-core.css" %}'; + var default_thumbnail='{% static "ldt/css/imgs/video_sequence.png" %}'; + var segment_api="{% absurl 'segment_api_empty' resource_name='segments' api_name='1.0' %}{% templatetag openvariable %}media{% templatetag closevariable %}/{% templatetag openvariable %}begin{% templatetag closevariable %}/{% templatetag openvariable %}end{% templatetag closevariable %}"; + var LdtPlayer_core='{% static "ldt/metadataplayer/LdtPlayer-core.js" %}'; var creator_name='{{request.user.username}}'; $j(document).ready(function(){ @@ -49,10 +49,10 @@ {% block css_import %} {{ block.super }} {{ content_form.media.css }} - - - - + + + + {% endblock %} @@ -234,7 +234,7 @@
      diff -r 3fb6b550840c -r 0d86ca7ccc7b src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/error_confirm.html --- a/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/error_confirm.html Wed May 15 12:18:43 2013 +0200 +++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/error_confirm.html Fri May 24 21:55:08 2013 +0200 @@ -1,17 +1,17 @@ {% extends "ldt/ldt_utils/workspace_base.html" %} -{% load absstatic %} +{% load static %} {% load i18n %} {# form of creation of content #} {% block js_import %} {{ block.super }} - - + + {% endblock %} {% block css_import %} {{ block.super }} {{ content_form.media.css }} - + {% endblock %} diff -r 3fb6b550840c -r 0d86ca7ccc7b src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/error_confirm_popup.html --- a/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/error_confirm_popup.html Wed May 15 12:18:43 2013 +0200 +++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/error_confirm_popup.html Fri May 24 21:55:08 2013 +0200 @@ -1,18 +1,18 @@ {% extends "ldt/ldt_raw_base.html" %} -{% load absstatic %} +{% load static %} {% load i18n %} {# form of creation of content #} {% block js_import %} {{ block.super }} - - + + {% endblock %} {% block css_import %} {{ block.super }} {{ content_form.media.css }} - - + + {% endblock %} diff -r 3fb6b550840c -r 0d86ca7ccc7b src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/groups.html --- a/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/groups.html Wed May 15 12:18:43 2013 +0200 +++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/groups.html Fri May 24 21:55:08 2013 +0200 @@ -1,26 +1,26 @@ {% extends "ldt/ldt_base.html" %} {% load i18n %} -{% load absstatic %} +{% load static %} {% block js_import %} {{block.super}} - - - + + + {% endblock %} {% block js_declaration %} {{block.super}} - - - + + + + - + + {% endblock %} @@ -12,13 +12,13 @@ {{block.super}} + +
       
      diff -r 3fb6b550840c -r 0d86ca7ccc7b src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/permissions.html --- a/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/permissions.html Wed May 15 12:18:43 2013 +0200 +++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/permissions.html Fri May 24 21:55:08 2013 +0200 @@ -1,7 +1,7 @@ {% load i18n %} -{% load absstatic %} +{% load static %} - + diff -r 3fb6b550840c -r 0d86ca7ccc7b src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/projectslist.html --- a/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/projectslist.html Wed May 15 12:18:43 2013 +0200 +++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/projectslist.html Fri May 24 21:55:08 2013 +0200 @@ -1,6 +1,6 @@ {% load i18n %} {% load thumbnail %} -{% load absstatic %} +{% load static %} {% load front_tags %} {% if nb_pj_pages %} @@ -18,48 +18,48 @@ {% for project in projects %} - {% url ldt.ldt_utils.views.json.project_json_id project.ldt_id as json_url_id %} + {% url 'ldt.ldt_utils.views.json.project_json_id' id=project.ldt_id as json_url_id %} {% if is_gecko %} - {% else %} - {% trans 'Project not published, click to publish' %} + {% trans 'Project not published, click to publish' %} {% endifequal %} {% thumbnail project.image "50x50" crop="center" format="PNG" as im %}{% empty %} {% endthumbnail %} @@ -68,7 +68,7 @@ {% if show_username %}{{ project.owner.username }} : {% endif %}{{ project.title }} {% else %} {% if project.change or project.owner == user %} - {% if show_username %}{{ project.owner.username }} : {% endif %}{{ project.title }} + {% if show_username %}{{ project.owner.username }} : {% endif %}{{ project.title }} {% else %} {% if show_username %}{{ project.owner.username }} : {% endif %}{{ project.title }} {% endif %} diff -r 3fb6b550840c -r 0d86ca7ccc7b src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/publishedprojectslist.html --- a/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/publishedprojectslist.html Wed May 15 12:18:43 2013 +0200 +++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/publishedprojectslist.html Fri May 24 21:55:08 2013 +0200 @@ -1,7 +1,7 @@ {% load i18n %} {% load thumbnail %} {% load front_tags %} -{% load absstatic %} +{% load static %} {% if nb_pj_pages %}
        @@ -17,29 +17,29 @@ {% for project in projects %} - {% url ldt.ldt_utils.views.json.project_json_id project.ldt_id as json_url_id %} + {% url 'ldt.ldt_utils.views.json.project_json_id' id=project.ldt_id as json_url_id %} {% if is_gecko %} -
        {% trans 'open ldt' %}
        +
        {% trans 'open ldt' %}
        {% else %} -
        {% trans 'open ldt' %}
        +
        {% trans 'open ldt' %}
        {% endif %} -
        {% trans 'copy the project' %}
        +
        {% trans 'copy the project' %}
        - {% trans 'Project published' %} + {% trans 'Project published' %} {% thumbnail project.image "50x50" crop="center" format="PNG" as im %}{% empty %} {% endthumbnail %} {% ifequal project.state 2 %} {{ project.title }} {% else %} - {{ project.title }} + {{ project.title }} {% endifequal %} diff -r 3fb6b550840c -r 0d86ca7ccc7b src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/sharewith.html --- a/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/sharewith.html Wed May 15 12:18:43 2013 +0200 +++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/sharewith.html Fri May 24 21:55:08 2013 +0200 @@ -1,12 +1,12 @@ {% load i18n %} -{% load absstatic %} +{% load static %} {% for res in elem_list %} {% if res.type == "user" %} - {% trans + {% trans {% else %} - {% + {% {% endif %} diff -r 3fb6b550840c -r 0d86ca7ccc7b src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/published_projects.html --- a/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/published_projects.html Wed May 15 12:18:43 2013 +0200 +++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/published_projects.html Fri May 24 21:55:08 2013 +0200 @@ -1,25 +1,25 @@ {% extends "ldt/ldt_base.html" %} {% load i18n %} -{% load absstatic %} +{% load static %} {% block js_import %} {{block.super}} - - - + + + {% endblock %} {% block js_declaration %} {{block.super}} - + + {% endblock %} {% block css_import %} {{ block.super }} {{ content_form.media.css }} - - + + {% endblock %} diff -r 3fb6b550840c -r 0d86ca7ccc7b src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/reset_confirm_popup.html --- a/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/reset_confirm_popup.html Wed May 15 12:18:43 2013 +0200 +++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/reset_confirm_popup.html Fri May 24 21:55:08 2013 +0200 @@ -1,18 +1,18 @@ {% extends "ldt/ldt_raw_base.html" %} -{% load absstatic %} +{% load static %} {% load i18n %} {# form of creation of content #} {% block js_import %} {{ block.super }} - - + + {% endblock %} {% block css_import %} {{ block.super }} {{ content_form.media.css }} - - + + {% endblock %} diff -r 3fb6b550840c -r 0d86ca7ccc7b src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/search_form.html --- a/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/search_form.html Wed May 15 12:18:43 2013 +0200 +++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/search_form.html Fri May 24 21:55:08 2013 +0200 @@ -1,6 +1,5 @@ {% extends "ldt/ldt_base.html" %} {% load i18n %} -{% load absurl %} {% block js_declaration %} - + + {% endblock %} {% block css_import %} {{ block.super }} - + {% endblock %} {% block css_import %} - - + + - + {% endblock %} {% block js_declaration %} diff -r 3fb6b550840c -r 0d86ca7ccc7b src/ldt/ldt/templates/openid/index.html --- a/src/ldt/ldt/templates/openid/index.html Wed May 15 12:18:43 2013 +0200 +++ b/src/ldt/ldt/templates/openid/index.html Fri May 24 21:55:08 2013 +0200 @@ -30,7 +30,7 @@
        - +
        diff -r 3fb6b550840c -r 0d86ca7ccc7b src/ldt/ldt/templates/socialauth/login_page.html --- a/src/ldt/ldt/templates/socialauth/login_page.html Wed May 15 12:18:43 2013 +0200 +++ b/src/ldt/ldt/templates/socialauth/login_page.html Fri May 24 21:55:08 2013 +0200 @@ -15,7 +15,7 @@ openid.init('openid_identifier'); }); //function facebook_onlogin(){ - // window.location = "{% url socialauth_facebook_login_done %}" + // window.location = "{% url 'socialauth_facebook_login_done' %}" //} @@ -28,11 +28,11 @@ {% block main_content %} {% if user.is_authenticated %} -

        You are already logged in. Logout?

        +

        You are already logged in. Logout?

        {% else %}
        - +
        @@ -49,15 +49,15 @@ {% endif %}
        - +
        - +
        diff -r 3fb6b550840c -r 0d86ca7ccc7b src/ldt/ldt/templates/socialauth/signin_complete.html --- a/src/ldt/ldt/templates/socialauth/signin_complete.html Wed May 15 12:18:43 2013 +0200 +++ b/src/ldt/ldt/templates/socialauth/signin_complete.html Fri May 24 21:55:08 2013 +0200 @@ -3,6 +3,6 @@ {% block main_content %} You have signed in.
        -Logout +Logout {% endblock %} diff -r 3fb6b550840c -r 0d86ca7ccc7b src/ldt/ldt/templatetags/absstatic.py --- a/src/ldt/ldt/templatetags/absstatic.py Wed May 15 12:18:43 2013 +0200 +++ b/src/ldt/ldt/templatetags/absstatic.py Fri May 24 21:55:08 2013 +0200 @@ -1,8 +1,6 @@ from django import template -from django.contrib.staticfiles.storage import staticfiles_storage from django.contrib.sites.models import Site -from django.template import Library -import logging +from django.contrib.staticfiles.storage import staticfiles_storage import urlparse register = template.Library() diff -r 3fb6b550840c -r 0d86ca7ccc7b src/ldt/ldt/templatetags/absurl.py --- a/src/ldt/ldt/templatetags/absurl.py Wed May 15 12:18:43 2013 +0200 +++ b/src/ldt/ldt/templatetags/absurl.py Fri May 24 21:55:08 2013 +0200 @@ -1,8 +1,7 @@ -import urlparse +from django.contrib.sites.models import Site from django.template import Library from django.template.defaulttags import URLNode, url -from django.contrib.sites.models import Site -import logging +import urlparse register = Library() diff -r 3fb6b550840c -r 0d86ca7ccc7b src/ldt/ldt/templatetags/analytics.py --- a/src/ldt/ldt/templatetags/analytics.py Wed May 15 12:18:43 2013 +0200 +++ b/src/ldt/ldt/templatetags/analytics.py Fri May 24 21:55:08 2013 +0200 @@ -11,10 +11,10 @@ register = template.Library() -def __clean_token(str, tag_name): - if not (str[0] == str[-1] and str[0] in ('"', "'")): +def __clean_token(str_t, tag_name): + if not (str_t[0] == str_t[-1] and str_t[0] in ('"', "'")): raise template.TemplateSyntaxError, "%r tag's argument should be in quotes" % tag_name - return str[1:-1] + return str_t[1:-1] def do_get_analytics(parser, token): code = None diff -r 3fb6b550840c -r 0d86ca7ccc7b src/ldt/ldt/templatetags/front_tags.py --- a/src/ldt/ldt/templatetags/front_tags.py Wed May 15 12:18:43 2013 +0200 +++ b/src/ldt/ldt/templatetags/front_tags.py Fri May 24 21:55:08 2013 +0200 @@ -22,18 +22,18 @@ arg = "::" if arg=="::" or arg=="h" or arg==":" : hours = sec//3600 - min = (sec - (hours * 3600))//60 - if min<10: - min_str = "0" + str(min) + minute = (sec - (hours * 3600))//60 + if minute<10: + min_str = "0" + str(minute) else: - min_str = str(min) + min_str = str(minute) if (arg=="::" or arg==":") and hours<10 : hours_str = "0" + str(hours) else : hours_str = str(hours) if arg=="h" or arg==":" : return hours_str + arg + min_str - sec = (sec - (hours * 3600) - (min*60)) + sec = (sec - (hours * 3600) - (minute*60)) if sec<10: sec_str = "0" + str(sec) else: diff -r 3fb6b550840c -r 0d86ca7ccc7b src/ldt/ldt/text/migrations/0001_initial.py --- a/src/ldt/ldt/text/migrations/0001_initial.py Wed May 15 12:18:43 2013 +0200 +++ b/src/ldt/ldt/text/migrations/0001_initial.py Fri May 24 21:55:08 2013 +0200 @@ -1,15 +1,13 @@ # encoding: utf-8 -import datetime from south.db import db from south.v2 import SchemaMigration -from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding model 'Annotation' - db.create_table('text_annotation', ( + db.create_table('text_annotation', ( # @UndefinedVariable ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), ('external_id', self.gf('django.db.models.fields.CharField')(default=u'5393f930-c975-11e0-bf36-58b035f6b93d', unique=True, max_length=255)), ('uri', self.gf('django.db.models.fields.CharField')(max_length=1024)), @@ -23,13 +21,13 @@ ('creation_date', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)), ('update_date', self.gf('django.db.models.fields.DateTimeField')(auto_now=True, blank=True)), )) - db.send_create_signal('text', ['Annotation']) + db.send_create_signal('text', ['Annotation']) # @UndefinedVariable def backwards(self, orm): # Deleting model 'Annotation' - db.delete_table('text_annotation') + db.delete_table('text_annotation') # @UndefinedVariable models = { diff -r 3fb6b550840c -r 0d86ca7ccc7b src/ldt/ldt/text/migrations/0002_auto__chg_field_annotation_external_id.py --- a/src/ldt/ldt/text/migrations/0002_auto__chg_field_annotation_external_id.py Wed May 15 12:18:43 2013 +0200 +++ b/src/ldt/ldt/text/migrations/0002_auto__chg_field_annotation_external_id.py Fri May 24 21:55:08 2013 +0200 @@ -1,8 +1,6 @@ # -*- coding: utf-8 -*- -import datetime from south.db import db from south.v2 import SchemaMigration -from django.db import models class Migration(SchemaMigration): @@ -10,12 +8,12 @@ def forwards(self, orm): # Changing field 'Annotation.external_id' - db.alter_column('text_annotation', 'external_id', self.gf('django.db.models.fields.CharField')(unique=True, max_length=255)) + db.alter_column('text_annotation', 'external_id', self.gf('django.db.models.fields.CharField')(unique=True, max_length=255)) # @UndefinedVariable def backwards(self, orm): # Changing field 'Annotation.external_id' - db.alter_column('text_annotation', 'external_id', self.gf('django.db.models.fields.CharField')(max_length=255, unique=True)) + db.alter_column('text_annotation', 'external_id', self.gf('django.db.models.fields.CharField')(max_length=255, unique=True)) # @UndefinedVariable models = { 'text.annotation': { diff -r 3fb6b550840c -r 0d86ca7ccc7b src/ldt/ldt/text/models.py --- a/src/ldt/ldt/text/models.py Wed May 15 12:18:43 2013 +0200 +++ b/src/ldt/ldt/text/models.py Fri May 24 21:55:08 2013 +0200 @@ -2,7 +2,7 @@ from django.utils.translation import ugettext_lazy as _ from tagging.models import Tag from utils import generate_uuid -import lxml +import lxml.etree import tagging.fields #from django.core.management.validation import max_length @@ -74,8 +74,8 @@ textannotation = lxml.etree.SubElement(iri, 'text-annotation') - id = lxml.etree.SubElement(textannotation, 'id') - id.text = self.external_id + id_node = lxml.etree.SubElement(textannotation, 'id') + id_node.text = self.external_id uri = lxml.etree.SubElement(textannotation, 'uri') uri.text = self.uri diff -r 3fb6b550840c -r 0d86ca7ccc7b src/ldt/ldt/text/tests/oauth_tests.py --- a/src/ldt/ldt/text/tests/oauth_tests.py Wed May 15 12:18:43 2013 +0200 +++ b/src/ldt/ldt/text/tests/oauth_tests.py Fri May 24 21:55:08 2013 +0200 @@ -8,7 +8,7 @@ from oauth_provider.consts import OUT_OF_BAND from oauth_provider.models import Consumer, Token import datetime -import lxml +import lxml.etree import time import urlparse diff -r 3fb6b550840c -r 0d86ca7ccc7b src/ldt/ldt/text/urls.py --- a/src/ldt/ldt/text/urls.py Wed May 15 12:18:43 2013 +0200 +++ b/src/ldt/ldt/text/urls.py Fri May 24 21:55:08 2013 +0200 @@ -1,4 +1,4 @@ -from django.conf.urls.defaults import patterns, url +from django.conf.urls import patterns, url # Uncomment the next two lines to enable the admin: # from django.contrib import admin diff -r 3fb6b550840c -r 0d86ca7ccc7b src/ldt/ldt/text/utils.py --- a/src/ldt/ldt/text/utils.py Wed May 15 12:18:43 2013 +0200 +++ b/src/ldt/ldt/text/utils.py Fri May 24 21:55:08 2013 +0200 @@ -1,6 +1,5 @@ -from django.conf import settings +import ldt.indexation import uuid -import ldt.indexation __BOOLEAN_DICT = { 'false':False, @@ -11,12 +10,12 @@ 'f':False } -def boolean_convert(bool): - if bool is None: +def boolean_convert(b): + if b is None: return False - if bool is True or bool is False: - return bool - key = str(bool).lower() + if b is True or b is False: + return b + key = str(b).lower() return __BOOLEAN_DICT.get(key, False) diff -r 3fb6b550840c -r 0d86ca7ccc7b src/ldt/ldt/text/views.py --- a/src/ldt/ldt/text/views.py Wed May 15 12:18:43 2013 +0200 +++ b/src/ldt/ldt/text/views.py Fri May 24 21:55:08 2013 +0200 @@ -6,12 +6,12 @@ from ldt.text.utils import TextSearch, generate_uuid from oauth_provider.decorators import oauth_required from urllib2 import urlparse -import lxml +import lxml.etree ## Filters the annotation depending on the request parameters ## Returns an xml containing the resulting annotations -def filter_annotation(request, uri=None, filter=None, limit=None, creator=None): +def filter_annotation(request, uri=None, filter=None, limit=None, creator=None): # @ReservedAssignment query = Q() if request.GET.get('uri'): @@ -53,9 +53,9 @@ id_nodes = doc.xpath("/iri/text-annotation/id/text()") if id_nodes: - id = unicode(id_nodes[0]) + id_n = unicode(id_nodes[0]) else: - id = generate_uuid() + id_n = generate_uuid() uri = unicode(doc.xpath("/iri/text-annotation/uri/text()")[0]) @@ -98,7 +98,7 @@ contributor = None try: - annotation = Annotation.create_annotation(external_id=id, uri=uri, tags=tags, title=title, description=desc, text=text, color=color, creator=creator, contributor=contributor) + annotation = Annotation.create_annotation(external_id=id_n, uri=uri, tags=tags, title=title, description=desc, text=text, color=color, creator=creator, contributor=contributor) annotation.save() return HttpResponse(lxml.etree.tostring(annotation.serialize(), pretty_print=True), mimetype="text/xml;charset=utf-8") except IntegrityError: @@ -108,7 +108,7 @@ ## Gets an annotation from its id ## Returns the xml-structured annotation -def get_annotation(request, id): +def get_annotation(request, id): # @ReservedAssignment try: annot = Annotation.objects.get(external_id=id) except Annotation.DoesNotExist: @@ -123,7 +123,7 @@ ## Returns an empty xml-structured annotation @oauth_required @csrf_exempt -def delete_annotation(request, id): +def delete_annotation(request, id): # @ReservedAssignment try: annot = Annotation.objects.get(external_id=id) annot.delete() @@ -137,7 +137,7 @@ ## Returns the xml-structured updated annotation @oauth_required @csrf_exempt -def update_annotation(request, id): +def update_annotation(request, id): # @ReservedAssignment put_data = {} if request.GET != {}: diff -r 3fb6b550840c -r 0d86ca7ccc7b src/ldt/ldt/user/admin.py --- a/src/ldt/ldt/user/admin.py Wed May 15 12:18:43 2013 +0200 +++ b/src/ldt/ldt/user/admin.py Fri May 24 21:55:08 2013 +0200 @@ -1,14 +1,8 @@ -from copy import deepcopy #@UnresolvedImport from django.contrib import admin -from django.contrib.auth.admin import UserAdmin -from django.contrib.auth.models import Group, User -from django.utils.translation import ugettext as _ -from forms import LdtForm +from django.contrib.auth.models import Group from guardian.admin import GuardedModelAdmin -from models import Ldt, UserProfile, GroupProfile -from tastypie.admin import ApiKeyInline -from tastypie.models import ApiAccess, ApiKey - +from ldt.user.models import LdtUser +from models import GroupProfile class GroupProfileInline(admin.StackedInline): model = GroupProfile @@ -16,53 +10,11 @@ class GroupAdmin(GuardedModelAdmin): inlines = [GroupProfileInline, ] -class UserProfileInline(admin.StackedInline): - model = UserProfile - -class UserProfileAdmin(UserAdmin): - def add_view(self, *args, **kwargs): - self.inlines = [] - return super(UserProfileAdmin, self).add_view(*args, **kwargs) - - def change_view(self, *args, **kwargs): - self.inlines = [UserProfileInline] - return super(UserAdmin, self).change_view(*args, **kwargs) - +class LdtUserAdmin(admin.ModelAdmin): + pass -class LdtAdmin(UserProfileAdmin): - list_display = ('username', 'email', 'first_name', 'last_name') - - fieldsets = [ - (None, {'fields': ('username', ('password1', 'password2'))}), - (_('User details'), {'fields': (('first_name', 'last_name'), 'email')}), - (_('Groups'), {'fields': ('groups',)}), - (_('Permissions'), {'fields': ('is_staff', 'user_permissions')}), - ] - form = LdtForm - model = Ldt - filter_horizontal = ('user_permissions',) - inlines = [UserProfileInline, ApiKeyInline] - - def get_fieldsets(self, request, obj=None): - fieldsets = deepcopy(self.fieldsets) - if not '/add' in request.path: - fieldsets[0] = (None, {'fields': ('username',)}) - fieldsets.append((_('Password'), {'fields': ('password1', 'password2'), 'classes': ('collapse',)})) - return fieldsets - - def add_view(self, request): - return super(UserAdmin, self).add_view(request) - - admin.site.unregister(Group) admin.site.register(Group, GroupAdmin) -admin.site.unregister(Ldt) -admin.site.register(Ldt, LdtAdmin) - -admin.site.register(ApiKey) -admin.site.register(ApiAccess) - -admin.site.unregister(User) -admin.site.register(User, UserProfileAdmin) +admin.site.register(LdtUser, LdtUserAdmin) \ No newline at end of file diff -r 3fb6b550840c -r 0d86ca7ccc7b src/ldt/ldt/user/forms.py --- a/src/ldt/ldt/user/forms.py Wed May 15 12:18:43 2013 +0200 +++ b/src/ldt/ldt/user/forms.py Fri May 24 21:55:08 2013 +0200 @@ -1,16 +1,17 @@ from django import forms from django.conf import settings +from django.contrib.auth import get_user_model from django.contrib.auth.forms import UserCreationForm, UserChangeForm -from django.contrib.auth.models import User +from django.contrib.auth.models import Group from django.forms.util import ErrorList from django.utils.translation import gettext as _ -from models import Ldt +User = get_user_model() class LdtForm(UserCreationForm): class Meta: - model = Ldt + model = User def __init__(self, data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=ErrorList, label_suffix=':', @@ -113,11 +114,9 @@ super(LanguageChangeForm, self).__init__(*args, **kwargs) def save(self): - profile = self.user.get_profile() - profile.language = self.cleaned_data['language'] - profile.save() + self.user.language = self.cleaned_data['language'] + self.user.save() return self.user - class PictureForm(forms.Form): image=forms.ImageField(label=_("Profile picture"), required=False) @@ -141,9 +140,12 @@ return None class_name = self.model.__class__.__name__ - if class_name == 'User' or class_name == 'Group': + if isinstance(self.model, Group): instance_name = "%s" % self.model.id img_container = self.model.get_profile() + if isinstance(self.model, User): + instance_name = "%s" % self.model.id + img_container = self.model elif class_name == 'Content': instance_name = self.model.iri_id img_container = self.model @@ -159,5 +161,4 @@ img_container.image = self.cleaned_data['image'] img_container.save() return self.model - \ No newline at end of file diff -r 3fb6b550840c -r 0d86ca7ccc7b src/ldt/ldt/user/migrations/0005_add_permission_owner_group.py --- a/src/ldt/ldt/user/migrations/0005_add_permission_owner_group.py Wed May 15 12:18:43 2013 +0200 +++ b/src/ldt/ldt/user/migrations/0005_add_permission_owner_group.py Fri May 24 21:55:08 2013 +0200 @@ -1,20 +1,14 @@ -#@PydevCodeAnalysisIgnore # encoding: utf-8 -import datetime -from south.db import db +from django.contrib.auth.models import Permission +from django.contrib.contenttypes.models import ContentType from south.v2 import DataMigration -from django.db import models -from django.contrib.auth.models import User -from ldt.user.models import UserProfile -from django.contrib.auth.models import Group, Permission -from django.contrib.contenttypes.models import ContentType class Migration(DataMigration): def forwards(self, orm): content_type = ContentType.objects.get(app_label='auth', model='group') - permission = Permission.objects.create(codename='is_owner_group', + Permission.objects.create(codename='is_owner_group', name='Can add/delete admins to the group', content_type=content_type) diff -r 3fb6b550840c -r 0d86ca7ccc7b src/ldt/ldt/user/migrations/0009_rename_auth_user_to_user_ldt_user.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/ldt/ldt/user/migrations/0009_rename_auth_user_to_user_ldt_user.py Fri May 24 21:55:08 2013 +0200 @@ -0,0 +1,95 @@ +# -*- coding: utf-8 -*- +from south.db import db +from south.v2 import SchemaMigration + + +class Migration(SchemaMigration): + + def forwards(self, orm): + db.rename_table('auth_user', 'user_ldtuser') # @UndefinedVariable + db.rename_table('auth_user_groups', 'user_ldtuser_groups') # @UndefinedVariable + db.rename_column('user_ldtuser_groups', 'user_id', 'ldtuser_id') # @UndefinedVariable + db.rename_table('auth_user_user_permissions', 'user_ldtuser_user_permissions') # @UndefinedVariable + db.rename_column('user_ldtuser_user_permissions', 'user_id', 'ldtuser_id') # @UndefinedVariable + + def backwards(self, orm): + db.rename_table('user_ldt_user', 'auth_user') # @UndefinedVariable + db.rename_table('user_ldtuser_groups', 'auth_user_groups') # @UndefinedVariable + db.rename_column('auth_user_groups', 'ldtuser_id', 'user_id') # @UndefinedVariable + db.rename_table('user_ldtuser_user_permissions', 'auth_user_user_permissions') # @UndefinedVariable + db.rename_column('auth_user_user_permissions', 'ldtuser_id', 'user_id') # @UndefinedVariable + + models = { + u'auth.group': { + 'Meta': {'object_name': 'Group'}, + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), + 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) + }, + u'auth.permission': { + 'Meta': {'ordering': "(u'content_type__app_label', u'content_type__model', u'codename')", 'unique_together': "((u'content_type', u'codename'),)", 'object_name': 'Permission'}, + 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']"}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) + }, + u'auth.user': { + 'Meta': {'object_name': 'User'}, + 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), + 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), + 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), + 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), + 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) + }, + u'contenttypes.contenttype': { + 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, + 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) + }, + u'user.groupprofile': { + 'Meta': {'object_name': 'GroupProfile'}, + 'description': ('django.db.models.fields.TextField', [], {}), + 'group': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'profile'", 'unique': 'True', 'to': u"orm['auth.Group']"}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'image': ('sorl.thumbnail.fields.ImageField', [], {'default': "'thumbnails/groups/group_default_icon.png'", 'max_length': '200'}) + }, + u'user.ldt': { + 'Meta': {'object_name': 'Ldt', '_ormbases': [u'auth.User']}, + u'user_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': u"orm['auth.User']", 'unique': 'True', 'primary_key': 'True'}) + }, + u'user.ldtuser': { + 'Meta': {'object_name': 'LdtUser'}, + 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), + 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), + 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), + 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), + 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) + }, + u'user.userprofile': { + 'Meta': {'object_name': 'UserProfile'}, + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'image': ('sorl.thumbnail.fields.ImageField', [], {'default': "'thumbnails/users/user_default_icon.png'", 'max_length': '200'}), + 'language': ('django.db.models.fields.CharField', [], {'default': "'fr'", 'max_length': '2'}), + 'user': ('django.db.models.fields.related.OneToOneField', [], {'to': u"orm['auth.User']", 'unique': 'True'}) + } + } + + complete_apps = ['user'] \ No newline at end of file diff -r 3fb6b550840c -r 0d86ca7ccc7b src/ldt/ldt/user/migrations/0010_auto__add_field_ldtuser_language__add_field_ldtuser_image.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/ldt/ldt/user/migrations/0010_auto__add_field_ldtuser_language__add_field_ldtuser_image.py Fri May 24 21:55:08 2013 +0200 @@ -0,0 +1,103 @@ +# -*- coding: utf-8 -*- +from south.db import db +from south.v2 import SchemaMigration + + +class Migration(SchemaMigration): + + def forwards(self, orm): + # Adding field 'LdtUser.language' + db.add_column(u'user_ldtuser', 'language', # @UndefinedVariable + self.gf('django.db.models.fields.CharField')(default='fr', max_length=2), + keep_default=False) + + # Adding field 'LdtUser.image' + db.add_column(u'user_ldtuser', 'image', # @UndefinedVariable + self.gf('sorl.thumbnail.fields.ImageField')(default='thumbnails/users/user_default_icon.png', max_length=200), + keep_default=False) + + + def backwards(self, orm): + # Deleting field 'LdtUser.language' + db.delete_column(u'user_ldtuser', 'language') # @UndefinedVariable + + # Deleting field 'LdtUser.image' + db.delete_column(u'user_ldtuser', 'image') # @UndefinedVariable + + + models = { + u'auth.group': { + 'Meta': {'object_name': 'Group'}, + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), + 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) + }, + u'auth.permission': { + 'Meta': {'ordering': "(u'content_type__app_label', u'content_type__model', u'codename')", 'unique_together': "((u'content_type', u'codename'),)", 'object_name': 'Permission'}, + 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']"}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) + }, + u'auth.user': { + 'Meta': {'object_name': 'User'}, + 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), + 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), + 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), + 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), + 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) + }, + u'contenttypes.contenttype': { + 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, + 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) + }, + u'user.groupprofile': { + 'Meta': {'object_name': 'GroupProfile'}, + 'description': ('django.db.models.fields.TextField', [], {}), + 'group': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'profile'", 'unique': 'True', 'to': u"orm['auth.Group']"}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'image': ('sorl.thumbnail.fields.ImageField', [], {'default': "'thumbnails/groups/group_default_icon.png'", 'max_length': '200'}) + }, + u'user.ldt': { + 'Meta': {'object_name': 'Ldt', '_ormbases': [u'auth.User']}, + u'user_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': u"orm['auth.User']", 'unique': 'True', 'primary_key': 'True'}) + }, + u'user.ldtuser': { + 'Meta': {'object_name': 'LdtUser'}, + 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), + 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), + 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'image': ('sorl.thumbnail.fields.ImageField', [], {'default': "'thumbnails/users/user_default_icon.png'", 'max_length': '200'}), + 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'language': ('django.db.models.fields.CharField', [], {'default': "'fr'", 'max_length': '2'}), + 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), + 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), + 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) + }, + u'user.userprofile': { + 'Meta': {'object_name': 'UserProfile'}, + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'image': ('sorl.thumbnail.fields.ImageField', [], {'default': "'thumbnails/users/user_default_icon.png'", 'max_length': '200'}), + 'language': ('django.db.models.fields.CharField', [], {'default': "'fr'", 'max_length': '2'}), + 'user': ('django.db.models.fields.related.OneToOneField', [], {'to': u"orm['auth.User']", 'unique': 'True'}) + } + } + + complete_apps = ['user'] \ No newline at end of file diff -r 3fb6b550840c -r 0d86ca7ccc7b src/ldt/ldt/user/migrations/0011_copy_image_language_ldt_user.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/ldt/ldt/user/migrations/0011_copy_image_language_ldt_user.py Fri May 24 21:55:08 2013 +0200 @@ -0,0 +1,96 @@ +# -*- coding: utf-8 -*- +from south.v2 import DataMigration + +class Migration(DataMigration): + + def forwards(self, orm): + for userprofile in orm['user.userprofile'].objects.all(): + user = orm['user.ldtuser'].objects.get(id=userprofile.user_id) + user.language = userprofile.language + user.image = userprofile.image + user.save() + + def backwards(self, orm): + for user in orm['user.userprofile'].objects.all(): + userprofile = orm['user.ldtprofile'].objects.get(user_id=user.id) + userprofile.language = user.language + userprofile.image = user.image + userprofile.save() + + models = { + u'auth.group': { + 'Meta': {'object_name': 'Group'}, + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), + 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) + }, + u'auth.permission': { + 'Meta': {'ordering': "(u'content_type__app_label', u'content_type__model', u'codename')", 'unique_together': "((u'content_type', u'codename'),)", 'object_name': 'Permission'}, + 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']"}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) + }, + u'auth.user': { + 'Meta': {'object_name': 'User'}, + 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), + 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), + 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), + 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), + 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) + }, + u'contenttypes.contenttype': { + 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, + 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) + }, + u'user.groupprofile': { + 'Meta': {'object_name': 'GroupProfile'}, + 'description': ('django.db.models.fields.TextField', [], {}), + 'group': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'profile'", 'unique': 'True', 'to': u"orm['auth.Group']"}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'image': ('sorl.thumbnail.fields.ImageField', [], {'default': "'thumbnails/groups/group_default_icon.png'", 'max_length': '200'}) + }, + u'user.ldt': { + 'Meta': {'object_name': 'Ldt', '_ormbases': [u'auth.User']}, + u'user_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': u"orm['auth.User']", 'unique': 'True', 'primary_key': 'True'}) + }, + u'user.ldtuser': { + 'Meta': {'object_name': 'LdtUser'}, + 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), + 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), + 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'image': ('sorl.thumbnail.fields.ImageField', [], {'default': "'thumbnails/users/user_default_icon.png'", 'max_length': '200'}), + 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'language': ('django.db.models.fields.CharField', [], {'default': "'fr'", 'max_length': '2'}), + 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), + 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), + 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) + }, + u'user.userprofile': { + 'Meta': {'object_name': 'UserProfile'}, + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'image': ('sorl.thumbnail.fields.ImageField', [], {'default': "'thumbnails/users/user_default_icon.png'", 'max_length': '200'}), + 'language': ('django.db.models.fields.CharField', [], {'default': "'fr'", 'max_length': '2'}), + 'user': ('django.db.models.fields.related.OneToOneField', [], {'to': u"orm['auth.User']", 'unique': 'True'}) + } + } + + complete_apps = ['user'] + symmetrical = True diff -r 3fb6b550840c -r 0d86ca7ccc7b src/ldt/ldt/user/migrations/0012_auto__del_userprofile.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/ldt/ldt/user/migrations/0012_auto__del_userprofile.py Fri May 24 21:55:08 2013 +0200 @@ -0,0 +1,92 @@ +# -*- coding: utf-8 -*- +from south.db import db +from south.v2 import SchemaMigration + + +class Migration(SchemaMigration): + + def forwards(self, orm): + # Deleting model 'UserProfile' + db.delete_table(u'user_userprofile') # @UndefinedVariable + + + def backwards(self, orm): + # Adding model 'UserProfile' + db.create_table(u'user_userprofile', ( # @UndefinedVariable + ('image', self.gf('sorl.thumbnail.fields.ImageField')(default='thumbnails/users/user_default_icon.png', max_length=200)), + (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), + ('language', self.gf('django.db.models.fields.CharField')(default='fr', max_length=2)), + ('user', self.gf('django.db.models.fields.related.OneToOneField')(to=orm['auth.User'], unique=True)), + )) + db.send_create_signal(u'user', ['UserProfile']) # @UndefinedVariable + + + models = { + u'auth.group': { + 'Meta': {'object_name': 'Group'}, + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), + 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) + }, + u'auth.permission': { + 'Meta': {'ordering': "(u'content_type__app_label', u'content_type__model', u'codename')", 'unique_together': "((u'content_type', u'codename'),)", 'object_name': 'Permission'}, + 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']"}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) + }, + u'auth.user': { + 'Meta': {'object_name': 'User'}, + 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), + 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), + 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), + 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), + 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) + }, + u'contenttypes.contenttype': { + 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, + 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) + }, + u'user.groupprofile': { + 'Meta': {'object_name': 'GroupProfile'}, + 'description': ('django.db.models.fields.TextField', [], {}), + 'group': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'profile'", 'unique': 'True', 'to': u"orm['auth.Group']"}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'image': ('sorl.thumbnail.fields.ImageField', [], {'default': "'thumbnails/groups/group_default_icon.png'", 'max_length': '200'}) + }, + u'user.ldt': { + 'Meta': {'object_name': 'Ldt', '_ormbases': [u'auth.User']}, + u'user_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': u"orm['auth.User']", 'unique': 'True', 'primary_key': 'True'}) + }, + u'user.ldtuser': { + 'Meta': {'object_name': 'LdtUser'}, + 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), + 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), + 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'image': ('sorl.thumbnail.fields.ImageField', [], {'default': "'thumbnails/users/user_default_icon.png'", 'max_length': '200'}), + 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'language': ('django.db.models.fields.CharField', [], {'default': "'fr'", 'max_length': '2'}), + 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), + 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), + 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) + } + } + + complete_apps = ['user'] \ No newline at end of file diff -r 3fb6b550840c -r 0d86ca7ccc7b src/ldt/ldt/user/migrations/0013_auto__del_ldt.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/ldt/ldt/user/migrations/0013_auto__del_ldt.py Fri May 24 21:55:08 2013 +0200 @@ -0,0 +1,69 @@ +# -*- coding: utf-8 -*- +from south.db import db +from south.v2 import SchemaMigration + + +class Migration(SchemaMigration): + + def forwards(self, orm): + # Deleting model 'Ldt' + db.delete_table(u'user_ldt') # @UndefinedVariable + + + def backwards(self, orm): + # Adding model 'Ldt' + db.create_table(u'user_ldt', ( # @UndefinedVariable + (u'user_ptr', self.gf('django.db.models.fields.related.OneToOneField')(to=orm['auth.User'], unique=True, primary_key=True)), + )) + db.send_create_signal(u'user', ['Ldt']) # @UndefinedVariable + + + models = { + u'auth.group': { + 'Meta': {'object_name': 'Group'}, + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), + 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) + }, + u'auth.permission': { + 'Meta': {'ordering': "(u'content_type__app_label', u'content_type__model', u'codename')", 'unique_together': "((u'content_type', u'codename'),)", 'object_name': 'Permission'}, + 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']"}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) + }, + u'contenttypes.contenttype': { + 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, + 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) + }, + u'user.groupprofile': { + 'Meta': {'object_name': 'GroupProfile'}, + 'description': ('django.db.models.fields.TextField', [], {}), + 'group': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'profile'", 'unique': 'True', 'to': u"orm['auth.Group']"}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'image': ('sorl.thumbnail.fields.ImageField', [], {'default': "'thumbnails/groups/group_default_icon.png'", 'max_length': '200'}) + }, + u'user.ldtuser': { + 'Meta': {'object_name': 'LdtUser'}, + 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), + 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), + 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'image': ('sorl.thumbnail.fields.ImageField', [], {'default': "'thumbnails/users/user_default_icon.png'", 'max_length': '200'}), + 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'language': ('django.db.models.fields.CharField', [], {'default': "'fr'", 'max_length': '2'}), + 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), + 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), + 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) + } + } + + complete_apps = ['user'] \ No newline at end of file diff -r 3fb6b550840c -r 0d86ca7ccc7b src/ldt/ldt/user/models.py --- a/src/ldt/ldt/user/models.py Wed May 15 12:18:43 2013 +0200 +++ b/src/ldt/ldt/user/models.py Fri May 24 21:55:08 2013 +0200 @@ -1,48 +1,38 @@ from django.conf import settings -from django.contrib import admin -from django.contrib.auth.models import User, UserManager, Group +from django.contrib.auth.models import (AbstractUser, UserManager, Group, + BaseUserManager) from django.db import models from django.db.models.signals import post_save +from django.utils import timezone from sorl.thumbnail import ImageField -import datetime - -class Ldt(User): -# irigroups = models.ManyToManyField(IriGroup, blank=True) - - class Meta: - verbose_name = 'iri user' - verbose_name_plural = 'iri users' - - def __unicode__(self): - return self.username - +class LdtUserManager(BaseUserManager): -class LdtManager(UserManager): - def create_user(self, username, email, password=None): - "Creates and saves a User with the given username, e-mail and password." - now = datetime.datetime.utcnow() - new_user = Ldt(None, username, '', '', email.strip().lower(), 'placeholder', False, True, False, now, now) - if password: - new_user.set_password(password) - else: - new_user.set_unusable_password() - new_user.save() - new_user.groups.add(Group.objects.get(name=settings.PUBLIC_GROUP_NAME)) - return new_user - - -class UserProfile (models.Model): - user = models.OneToOneField(User) - language = models.CharField(max_length=2, default=settings.LANGUAGE_CODE[:2]) - image = ImageField(upload_to=settings.MEDIA_ROOT+"thumbnails/users/", default=settings.DEFAULT_USER_ICON, max_length=200) + def create_user(self, username, email=None, password=None, **extra_fields): + """ + Creates and saves a User with the given username, email and password. + """ + now = timezone.now() + if not username: + raise ValueError('The given username must be set') + email = UserManager.normalize_email(email) + user = self.model(username=username, email=email, + is_staff=False, is_active=True, is_superuser=False, + last_login=now, date_joined=now, **extra_fields) - @staticmethod - def create_user_profile(sender, instance, created, **kwargs): - if created: - UserProfile.objects.get_or_create(user=instance) - everyone, _ = Group.objects.get_or_create(name=settings.PUBLIC_GROUP_NAME) - instance.groups.add(everyone) + user.set_password(password) + user.save(using=self._db) + everyone, _ = Group.objects.get_or_create(name=settings.PUBLIC_GROUP_NAME) + user.groups.add(everyone) + return user + + def create_superuser(self, username, email, password, **extra_fields): + u = self.create_user(username, email, password, **extra_fields) + u.is_staff = True + u.is_active = True + u.is_superuser = True + u.save(using=self._db) + return u class GroupProfile(models.Model): group = models.OneToOneField(Group, primary_key=False, related_name='profile') @@ -55,20 +45,22 @@ profile = GroupProfile() profile.group_id = instance.id profile.save() - admins = User.objects.filter(is_superuser=True) + admins = LdtUser.objects.filter(is_superuser=True) if admins: - instance.user_set.add(admins[0]) + admin_user = admins[0] + admin_user.groups.add(instance) + admin_user.save() + +class LdtUser(AbstractUser): + language = models.CharField(max_length=2, default=settings.LANGUAGE_CODE[:2]) + image = ImageField(upload_to=settings.MEDIA_ROOT+"thumbnails/users/", default=settings.DEFAULT_USER_ICON, max_length=200) + + objects = LdtUserManager() + -# To keep consistency with User.get_profile() method def get_profile(self): return self.profile -Group.add_to_class("get_profile", get_profile) - +Group.add_to_class("get_profile", get_profile) # @UndefinedVariable post_save.connect(GroupProfile.create_group_profile, sender=Group) -post_save.connect(UserProfile.create_user_profile, sender=User) - -User.objects = LdtManager() -User.objects.contribute_to_class(User, "objects") -admin.site.register(Ldt) diff -r 3fb6b550840c -r 0d86ca7ccc7b src/ldt/ldt/user/templates/ldt/user/change_profile.html --- a/src/ldt/ldt/user/templates/ldt/user/change_profile.html Wed May 15 12:18:43 2013 +0200 +++ b/src/ldt/ldt/user/templates/ldt/user/change_profile.html Fri May 24 21:55:08 2013 +0200 @@ -35,7 +35,7 @@ {% if msg %}
        {{ msg }}
        {% endif %} - + {% csrf_token %} @@ -97,7 +97,7 @@
        -
        + {% csrf_token %} @@ -146,7 +146,7 @@
        -
        + {% csrf_token %} @@ -154,7 +154,7 @@ {% trans "Current profile picture" %} diff -r 3fb6b550840c -r 0d86ca7ccc7b src/ldt/ldt/user/templates/ldt/user/login_form.html --- a/src/ldt/ldt/user/templates/ldt/user/login_form.html Wed May 15 12:18:43 2013 +0200 +++ b/src/ldt/ldt/user/templates/ldt/user/login_form.html Fri May 24 21:55:08 2013 +0200 @@ -1,11 +1,10 @@ {% load i18n %} -{% load absurl %} {# print user's state and form of login #} {% block js_import %} {{block.super}}
        - {% thumbnail user.get_profile.image "x100" format="PNG" as im %}{% empty %} {% endthumbnail %} + {% thumbnail user.image "x100" format="PNG" as im %}{% empty %} {% endthumbnail %}