events Package

activity Module

class kawaz.apps.events.activity.EventActivityMediator[source]

Bases: activities.mediator.ActivityMediator

alter(instance, activity, **kwargs)[source]
m2m_fields = ('attendees',)
prepare_context(activity, context, typename=None)[source]

admin Module

class kawaz.apps.events.admin.EventAdmin(model, admin_site)[source]

Bases: django.contrib.admin.options.ModelAdmin

list_display = ('title', 'organizer_name', 'get_pub_state_display', 'period_start', 'number_of_attendees', 'created_at', 'updated_at')
media
number_of_attendees(obj)[source]
organizer_name(obj)[source]
save_model(request, obj, form, change)[source]
search_fields = ('title', 'body', 'organizer__username', 'organizer__nickname', 'category__label', 'place')
class kawaz.apps.events.admin.EventCategoryAdmin(model, admin_site)[source]

Bases: django.contrib.admin.options.ModelAdmin

list_display = ('label', 'number_of_events')
media
number_of_events(obj)[source]

filters Module

forms Module

gcal Module

Google Calendar 連携用 Backend kawaz.core.google.calendar に依存し settings.GOOGLE_CALENDAR_BACKEND で指定 されている

class kawaz.apps.events.gcal.KawazGoogleCalendarBackend[source]

Bases: google_calendar.backend.Backend

is_valid(event, raise_exception=False)[source]

Kawaz3のEventモデルインスタンスが、Google Calendar API Version3の Bodyパラメーターと適合しているかをチェックします

translate(event)[source]

Kawaz3のEventモデルをGoogle Calendar API Version3のBodyパラメーターに変換します

Params:
event [Event] Eventモデルインスタンス
Returns:[dict] パラメーター
kawaz.apps.events.gcal.get_base_url()[source]

models Module

class kawaz.apps.events.models.Category(*args, **kwargs)[source]

Bases: django.db.models.base.Model

イベントの大カテゴリ 運営が設置したものをユーザーが選ぶ

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception Category.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Category.events

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

Category.id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Category.label

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Category.objects = <django.db.models.manager.Manager object>
Category.order

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class kawaz.apps.events.models.Event(id, pub_state, title, body, period_start, period_end, place, number_restriction, attendance_deadline, organizer, category, created_at, updated_at)[source]

Bases: django.db.models.base.Model

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception Event.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Event.active_attendees
Event.attend(user)[source]

指定されたユーザーをこのイベントに参加させる

Event.attendance_deadline

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Event.attendees

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

pizza.toppings and topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

Event.body

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Event.category

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

Event.category_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Event.clean()[source]

下記のルールに従ってValidationする 1. イベント終了時間は開始時間より遅い必要がある(時間は逆行できない) 2. 過去のイベントは作成できない(スネーク!タイムパラドックスだ!) 3. 7日以上にまたがるイベントは作成できない 4. 開始時間が指定されているが終了時間が指定されていないイベントは

作成できない(一生イベントに参加とかは物理的に不可能)
  1. 参加者制限が0人のイベントは作成できない
  2. 参加締め切りは未来でなければいけない
Event.created_at

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Event.get_absolute_url()[source]
Event.get_next_by_created_at(*moreargs, **morekwargs)
Event.get_next_by_updated_at(*moreargs, **morekwargs)
Event.get_previous_by_created_at(*moreargs, **morekwargs)
Event.get_previous_by_updated_at(*moreargs, **morekwargs)
Event.get_pub_state_display(*moreargs, **morekwargs)
Event.googlecalendarbridge

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

place.restaurant is a ReverseOneToOneDescriptor instance.

Event.humanized_period

開催日時をいい感じで描画します

Output:
5月10日(月) 13:00 ~ 19:00 2013年9月21(土) 13:00 ~ 19:00 6月11日(月) 13:00 ~ 6月12日(火) 10:00 未定 6月11日(月) 13:00 ~ 終了日時未定
Event.id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Event.is_active()[source]

イベントが終了していないか否か

Event.is_attendee(user)[source]

参加者か否か

Event.is_over_deadline()[source]

参加締め切りを超えているか否か

Event.is_over_restriction()[source]

人数制限を超えているか否か

Event.number_restriction

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Event.objects = <kawaz.apps.events.models.EventManager object>
Event.organizer

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

Event.organizer_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Event.period_end

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Event.period_start

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Event.place

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Event.pub_state

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Event.quit(user)[source]

指定されたユーザーをこのイベントから退会させる

Event.save(force_insert=False, force_update=False, using=None, update_fields=None)

Saves the current instance. Override this in a subclass if you want to control the saving process.

The ‘force_insert’ and ‘force_update’ parameters can be used to insist that the “save” must be an SQL insert or update (or equivalent for non-SQL backends), respectively. Normally, they should not be set.

Event.title

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Event.updated_at

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class kawaz.apps.events.models.EventManager[source]

Bases: django.db.models.manager.Manager, kawaz.core.publishments.models.PublishmentManagerMixin

active(user)[source]

指定されたユーザーに公開されたイベントの中で、まだ終わっていない or イベントの終了時期が指定されていないかつ、作成日から30日日以内のイベントを含むクエリを返す

attendable(user)[source]

指定されたユーザーに公開されたイベントの中で、参加可能なイベントを 含むクエリを返す

author_field_name = 'organizer'
kawaz.apps.events.models.join_organizer(**kwargs)[source]

作成者を自動的に参加させるシグナルレシーバ

perms Module

class kawaz.apps.events.perms.EventPermissionLogic[source]

Bases: permission.logics.base.PermissionLogic

Permission logic of Event model which for

  • events.add_event
  • events.change_event
  • events.delete_event
  • events.attend_event
  • events.quit_event
has_perm(user_obj, perm, obj=None)[source]

Check if user have a specified event permissions (of obj)

urls Module

views Module