Пример #1
0
    "manage_items": False,
    "manage_signature_requests": False,
    "manage_clients": False,
    "manage_tasks": False,
    "manage_attachments": False,
}
#
# Not logged in or random user permissions
#
ANONYMOUS_USER_PERMISSIONS = dict.fromkeys([key for key, value in GRANULAR_PERMISSIONS], False)

ROLES = get_namedtuple_choices(
    "ROLES",
    (
        (0, "noone", "No Access"),
        (1, "owner", "Owner"),
        (2, "client", "Client"),
        (3, "colleague", "Colleague"),
        (4, "thirdparty", "3rd Party"),
    ),
)


class ProjectCollaborator(models.Model):
    """
    Model to store the Users permissions with regards to a project
    """

    # ROLES are simply for the GUI as ideally all of our users would
    # simple have 1 or more of a set of permission
    ROLES = ROLES
    PERMISSIONS = PROJECT_OWNER_PERMISSIONS.keys()  # as the PROJECT_OWNER_PERMISSIONS always has ALL of them
Пример #2
0
from django.template.defaultfilters import slugify

from revision.utils import get_namedtuple_choices

from ..mixins import VideoCommentsMixin
#from ..signals import transcode_original_video

from jsonfield import JSONField
from uuidfield import UUIDField

import os
import math

BASE_VIDEO_TYPES = get_namedtuple_choices('BASE_VIDEO_TYPES', (
    (1, 'video_mp4', 'video/mp4'),
    (2, 'video_mov', 'video/mov'),
    (3, 'video_ogg', 'video/ogg'),
))


def _upload_video(instance, filename):
    split_file_name = os.path.split(filename)[-1]
    filename_no_ext, ext = os.path.splitext(split_file_name)

    identifier = '%s' % instance.slug
    full_file_name = '%s-%s%s' % (identifier, slugify(filename_no_ext), ext)

    if identifier in slugify(filename):
        #
        # If we already have this filename as part of the recombined filename
        #