Exemplo n.º 1
0
def create_permissions(app, created_models, verbosity, **kwargs):
    from django.contrib.contenttypes.models import ContentType

    autodiscover()
    reports = all_reports()

    # This will hold the permissions we're looking for as
    # (content_type, (codename, name))
    searched_perms = list()
    ctype = ContentType.objects.get_for_model(auth_app.User)
    for slug, report in reports:
        for perm in report.permissions:
            searched_perms.append((ctype, perm))

    # Find all the Permissions that have a context_type for a model we're
    # looking for.  We don't need to check for codenames since we already have
    # a list of the ones we're going to create.
    all_perms = set(auth_app.Permission.objects.filter(
        content_type=ctype,
    ).values_list(
        "content_type", "codename"
    ))

    objs = [
        auth_app.Permission(codename=codename, name=name, content_type=ctype)
        for ctype, (codename, name) in searched_perms
        if (ctype.pk, codename) not in all_perms
    ]
    auth_app.Permission.objects.bulk_create(objs)
    if verbosity >= 2:
        for obj in objs:
            print "Adding permission '%s'" % obj
Exemplo n.º 2
0
def create_permissions(app, created_models, verbosity, **kwargs):
    from django.contrib.contenttypes.models import ContentType

    autodiscover()
    reports = all_reports()

    # This will hold the permissions we're looking for as
    # (content_type, (codename, name))
    searched_perms = list()
    ctype = ContentType.objects.get_for_model(auth_app.User)
    for slug, report in reports:
        for perm in report.permissions:
            searched_perms.append((ctype, perm))

    # Find all the Permissions that have a context_type for a model we're
    # looking for.  We don't need to check for codenames since we already have
    # a list of the ones we're going to create.
    all_perms = set(
        auth_app.Permission.objects.filter(content_type=ctype, ).values_list(
            "content_type", "codename"))

    objs = [
        auth_app.Permission(codename=codename, name=name, content_type=ctype)
        for ctype, (codename, name) in searched_perms
        if (ctype.pk, codename) not in all_perms
    ]
    auth_app.Permission.objects.bulk_create(objs)
    if verbosity >= 2:
        for obj in objs:
            print "Adding permission '%s'" % obj
Exemplo n.º 3
0
Arquivo: urls.py Projeto: drazvan/crm
from django.contrib import admin
from django.contrib.auth.views import login, logout
from django.conf.urls.defaults import *

import reporting

from crm.views.views import *
from crm.dashboard import *
from crm.reports import *
from views.timers import *

admin.autodiscover()
reporting.autodiscover()                                   # autodiscover reports in applications


urlpatterns = patterns('',
    (r'^$', main),
	(r'^register/$', new_licence), 
    (r'^hello/$', hello),
    (r'^time/$', current_datetime),
    (r'^time/plus/(\d{1,2})/$', hours_ahead),
	(r'^admin/doc/', include('django.contrib.admindocs.urls')),
	(r'^admin/', include(admin.site.urls)),
	(r'^login/$',  login),
    (r'^logout/$', logout),
	(r'^online/([^/]+)/$', online),
	(r'^logiktrayversion/$', logiktrayversion),
	(r'^testmail/$', test_mail),
	(r'^testlicence/$', test_licence),
	(r'^dashboard/([^/]+)/$', dashboard),
	(r'^dashboards/$', dashboards),
Exemplo n.º 4
0
from django.conf.urls.defaults import *
from django.views.generic.simple import direct_to_template
from django.conf import settings
from accounts.views import welcome

import reporting
reporting.autodiscover()

from django.contrib import admin
admin.autodiscover()

# Admin Apps
urlpatterns = patterns(
    '',
    (r'^admin/saasu/', include('tms.contrib.saasu.urls')),
    (r'^admin/doc/', include('django.contrib.admindocs.urls')),
    (r'^admin/', include(admin.site.urls)),
)

if settings.DEBUG:

    # staticfiles for debugging
    urlpatterns += patterns(
        '',
        url(r'^static/(?P<path>.*)$', 'django.views.static.serve', {
            'document_root': settings.STATIC_ROOT,
            'show_indexes': True,
        }),
    )

    urlpatterns += patterns(
Exemplo n.º 5
0
Arquivo: urls.py Projeto: MVReddy/TMS
from django.conf.urls.defaults import *
from django.views.generic.simple import direct_to_template
from django.conf import settings
from accounts.views import welcome

import reporting
reporting.autodiscover()

from django.contrib import admin
admin.autodiscover()

# Admin Apps
urlpatterns = patterns('',
    (r'^admin/saasu/', include('tms.contrib.saasu.urls')),
    (r'^admin/doc/', include('django.contrib.admindocs.urls')),
    (r'^admin/', include(admin.site.urls)),
)


if settings.DEBUG:

    # staticfiles for debugging
    urlpatterns += patterns('',
        url(r'^static/(?P<path>.*)$', 'django.views.static.serve', {
            'document_root': settings.STATIC_ROOT,
            'show_indexes': True,
        }),
    )

    urlpatterns += patterns('',
        (r'^500/$', 'adlibre_tms.views.server_error'),