Beispiel #1
0
def inplace_toolbar(context):
    return {
        'STATIC_URL': get_static_url(),
        'ADMIN_MEDIA_PREFIX': get_admin_static_url(),
        'toolbar': True,
        'request': context['request']
    }
Beispiel #2
0
def inplace_js(context, activate_inplaceedit=True, toolbar=False):
    request = context['request']
    request.inplace_js_rendered = True
    return {
        'STATIC_URL':
        get_static_url(),
        'ADMIN_MEDIA_PREFIX':
        get_admin_static_url(),
        'activate_inplaceedit':
        activate_inplaceedit,
        'auto_save':
        json.dumps(inplace_settings.INPLACEEDIT_AUTO_SAVE),
        'event':
        inplace_settings.INPLACEEDIT_EVENT,
        'disable_click':
        json.dumps(inplace_settings.INPLACEEDIT_DISABLE_CLICK),
        'toolbar':
        toolbar,
        'enable_class':
        inplace_settings.INPLACE_ENABLE_CLASS,
        'success_text':
        inplace_settings.INPLACEEDIT_SUCCESS_TEXT,
        'unsaved_changes':
        inplace_settings.INPLACEEDIT_UNSAVED_TEXT,
        'inplace_get_field_url':
        inplace_settings.INPLACE_GET_FIELD_URL or reverse('inplace_get_field'),
        'inplace_save_url':
        inplace_settings.INPLACE_SAVE_URL or reverse('inplace_save'),
        'field_types':
        inplace_settings.INPLACE_FIELD_TYPES,
        'focus_when_editing':
        json.dumps(inplace_settings.INPLACE_FOCUS_WHEN_EDITING),
        'inplace_js_extra':
        getattr(request, 'inplace_js_extra', '')
    }
Beispiel #3
0
def prod_plan_view(request):
  curr_date = datetime.strptime(request.GET.get('date', date.today().strftime('%d.%m.%Y')), '%d.%m.%Y')
  y,m,d = curr_date.year, curr_date.month, curr_date.day
  wd = curr_date.weekday()
  sdate = curr_date - timedelta(days = wd)
  edate = curr_date + timedelta(days = 6-wd)
  
  days =  [sdate + timedelta(days=i) for i in range(0,7)]
  week_days = {i.weekday(): {'date': custom_date(i.year,i.month,i.day)} for i in days}
  prodplan_list = ProdPlan.objects.filter(start_date__range = (sdate,edate))
  
  tables = []
  for week_day in week_days:
    tdate = week_days[week_day]['date']
    prodplan_list = ProdPlan.objects.filter(start_date = tdate)
    tables.append(ProdPlanTable(prodplan_list))
    tables[week_day].verbose_name = ', '.join((tdate.strftime('%d.%m.%Y'), tdate.weekday_name))
  
  title = u'Производственный план на %s - %s' % (sdate.strftime('%d.%m.%Y'), edate.strftime('%d.%m.%Y'))
  date_form = DateForm({'date':curr_date})
  add_form  = ProdPlanForm()
  request.ADMIN_MEDIA_PREFIX = get_admin_static_url()
  for table in tables:
    RequestConfig(request).configure(table)
  return render(request, 'asuzr/table_n.html', {'tables': tables, 'title': title, 'dateform': date_form, 'add_form': add_form, 'form_action' : 'add-plan-item'})
Beispiel #4
0
def inplace_static(context):
    return {
        'STATIC_URL': get_static_url(),
        'ADMIN_MEDIA_PREFIX': get_admin_static_url(),
        'toolbar': False,
        'request': context['request']
    }
Beispiel #5
0
def orders(request, archive):
  is_archive = (archive == '1')
  Table = ArchiveOrdersTable if is_archive else OrdersTable
  table = Table(Order.objects.filter(is_done = is_archive))
  title = u'Архивная таблица заказов' if is_archive else u'Таблица выхода заказов'
  RequestConfig(request).configure(table)
  request.ADMIN_MEDIA_PREFIX = get_admin_static_url()
  return render(request, 'asuzr/table.html', {'table': table, 'title': title})
Beispiel #6
0
    def render_media_field(self, template_name="inplaceeditform/render_media_field.html", extra_context=None):
        extra_context = extra_context or {}
        context = {'field': self.get_field(),
                   'STATIC_URL': get_static_url(),
                   'ADMIN_MEDIA_PREFIX': get_admin_static_url()}
        context.update(extra_context)

        return render_to_string(template_name, context)
Beispiel #7
0
    def render_media_field(self, template_name="inplaceeditform/render_media_field.html", extra_context=None):
        extra_context = extra_context or {}
        context = {'field': self.get_field(),
                   'STATIC_URL': get_static_url(),
                   'ADMIN_MEDIA_PREFIX': get_admin_static_url()}
        context.update(extra_context)

        return render_to_string(template_name, context)
Beispiel #8
0
def inplace_css(context, toolbar=False):
    request = context['request']
    request.inplace_css_rendered = True
    return {
        'STATIC_URL': get_static_url(),
        'ADMIN_MEDIA_PREFIX': get_admin_static_url(),
        'toolbar': toolbar,
        'inplace_js_extra': getattr(request, 'inplace_css_extra', '')
    }
Beispiel #9
0
def inplace_css(context, toolbar=False):
    request = context['request']
    request.inplace_css_rendered = True
    return {
        'STATIC_URL': get_static_url(),
        'ADMIN_MEDIA_PREFIX': get_admin_static_url(),
        'toolbar': toolbar,
        'inplace_js_extra': getattr(request, 'inplace_css_extra', '')
    }
def inplace_js(context, activate_inplaceedit=True, toolbar=False):
    return context.update({
        'STATIC_URL': get_static_url(),
        'ADMIN_MEDIA_PREFIX': get_admin_static_url(),
        'activate_inplaceedit': activate_inplaceedit,
        'auto_save': simplejson.dumps(getattr(settings, "INPLACEEDIT_AUTO_SAVE", False)),
        'event': getattr(settings, "INPLACEEDIT_EVENT", "dblclick"),
        'disable_click': simplejson.dumps(getattr(settings, "INPLACEEDIT_DISABLE_CLICK", True)),
        'toolbar': toolbar,
    })
Beispiel #11
0
def desreport(request):
  start_date = request.GET.get('sdate', date.today().strftime('%d.%m.%Y'))
  sdate = datetime.strptime(start_date, '%d.%m.%Y')
  end_date = request.GET.get('edate', date.today().strftime('%d.%m.%Y'))
  edate = datetime.strptime(end_date, '%d.%m.%Y')
  Table = DesignerTable
  table = Table(Order.objects.filter(cancelled=False, date__range=(sdate,edate)).values('designer__first_name','designer__last_name').annotate(Sum('price'),Count('designer')))
  title = u'Отчет по дизайнерам за '+' - '.join((start_date, end_date))
  form = DiapDateForm({'sdate': sdate, 'edate': edate})
  RequestConfig(request).configure(table)
  request.ADMIN_MEDIA_PREFIX = get_admin_static_url()
  return render(request, 'asuzr/table.html', {'table': table, 'title': title, 'dateform': form})
def inplace_js(context, activate_inplaceedit=True, toolbar=False):
    return context.update({
        'STATIC_URL': get_static_url(),
        'ADMIN_MEDIA_PREFIX': get_admin_static_url(),
        'activate_inplaceedit': activate_inplaceedit,
        'auto_save': json.dumps(inplace_settings.INPLACEEDIT_AUTO_SAVE),
        'event': inplace_settings.INPLACEEDIT_EVENT,
        'disable_click': json.dumps(inplace_settings.INPLACEEDIT_DISABLE_CLICK),
        'toolbar': toolbar,
        'inplace_get_field_url': reverse('inplace_get_field'),
        'inplace_save_url': reverse('inplace_save'),
    })
Beispiel #13
0
def inplace_js(context, activate_inplaceedit=True, toolbar=False):
    return context.update({
        'STATIC_URL':
        get_static_url(),
        'ADMIN_MEDIA_PREFIX':
        get_admin_static_url(),
        'activate_inplaceedit':
        activate_inplaceedit,
        'auto_save':
        simplejson.dumps(getattr(settings, "INPLACEEDIT_AUTO_SAVE", False)),
        'event':
        getattr(settings, "INPLACEEDIT_EVENT", "dblclick"),
        'disable_click':
        simplejson.dumps(getattr(settings, "INPLACEEDIT_DISABLE_CLICK", True)),
        'toolbar':
        toolbar,
    })
Beispiel #14
0
def inplace_js(context, activate_inplaceedit=True, toolbar=False):
    request = context['request']
    request.inplace_js_rendered = True
    return {
        'STATIC_URL': get_static_url(),
        'ADMIN_MEDIA_PREFIX': get_admin_static_url(),
        'activate_inplaceedit': activate_inplaceedit,
        'auto_save': json.dumps(inplace_settings.INPLACEEDIT_AUTO_SAVE),
        'event': inplace_settings.INPLACEEDIT_EVENT,
        'disable_click': json.dumps(inplace_settings.INPLACEEDIT_DISABLE_CLICK),
        'toolbar': toolbar,
        'enable_class': inplace_settings.INPLACE_ENABLE_CLASS,
        'success_text': inplace_settings.INPLACEEDIT_SUCCESS_TEXT,
        'unsaved_changes': inplace_settings.INPLACEEDIT_UNSAVED_TEXT,
        'inplace_get_field_url': inplace_settings.INPLACE_GET_FIELD_URL or reverse('inplace_get_field'),
        'inplace_save_url': inplace_settings.INPLACE_SAVE_URL or reverse('inplace_save'),
        'field_types': inplace_settings.INPLACE_FIELD_TYPES,
        'focus_when_editing': json.dumps(inplace_settings.INPLACE_FOCUS_WHEN_EDITING),
        'inplace_js_extra': getattr(request, 'inplace_js_extra', '')
    }
Beispiel #15
0
def visit_view(request):
  curr_date = datetime.strptime(request.GET.get('date', date.today().strftime('%d.%m.%Y')), '%d.%m.%Y')
  form = DateForm({'date':curr_date})
  create_attendance_if_need(curr_date)
  attendance_table, add_info = get_attendance_table(curr_date.year, curr_date.month, 'attendance-')
  RequestConfig(request, paginate={'per_page': 32}).configure(attendance_table)

  orders_table = get_day_orders_table(curr_date, 'orders-')
  RequestConfig(request).configure(orders_table)
  
  order_form = OrderForm(initial = {'designer': request.user})

  request.ADMIN_MEDIA_PREFIX = get_admin_static_url()

  title = u'Таблица посещаемости на %s' % dateformat.format(curr_date, 'F Y')
  return render(request, 'asuzr/table2.html', {
                                               'table1': attendance_table, 
                                               'table2': orders_table,
                                               'additional_info': add_info,
                                               'title': title,
                                               'dateform': form,
                                               'add_form': order_form,
                                               'form_action': 'add-order'
                                               })
def inplace_css(context, toolbar=False):
    return context.update({
        'STATIC_URL': get_static_url(),
        'ADMIN_MEDIA_PREFIX': get_admin_static_url(),
        'toolbar': toolbar,
    })
def inplace_toolbar(context):
    return context.update({
        'STATIC_URL': get_static_url(),
        'ADMIN_MEDIA_PREFIX': get_admin_static_url(),
        'toolbar': True,
    })
def inplace_css(context, toolbar=False):
    return context.update({
        'STATIC_URL': get_static_url(),
        'ADMIN_MEDIA_PREFIX': get_admin_static_url(),
        'toolbar': toolbar,
    })
def inplace_toolbar(context):
    return context.update({
        'STATIC_URL': get_static_url(),
        'ADMIN_MEDIA_PREFIX': get_admin_static_url(),
        'toolbar': True,
    })