Sources for demo

galleryfield.models.BuiltInGalleryImage

class galleryfield.models.BuiltInGalleryImage(id, image, creator)[source]

Bases: django.db.models.base.Model

creator

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.

image

Just like the FileDescriptor, but for ImageFields. The only difference is assigning the width/height to the width_field/height_field, if appropriate.

demo.models.DemoGallery

class demo.models.DemoGallery(*args, **kwargs)[source]

Bases: django.db.models.base.Model

The gallery model used in demo.

images

A collections of pks of image model instances

owner

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.

demo.views

class demo.views.GalleryCreateView(**kwargs)[source]

Bases: django.contrib.auth.mixins.LoginRequiredMixin, django.views.generic.edit.CreateView

extra_context = {'form_description': 'Create a new gallery'}
form_class

alias of demo.forms.GalleryForm

form_valid(form)[source]

If the form is valid, save the associated model.

get_context_data(**kwargs)[source]

Insert the form into the context dict.

get_success_url()[source]

Return the URL to redirect to after processing a valid form.

template_name = 'form.html'
class demo.views.GalleryDetailView(**kwargs)[source]

Bases: django.views.generic.detail.DetailView

get_context_data(**kwargs)[source]

Insert the single object into the context dict.

model

alias of demo.models.DemoGallery

class demo.views.GalleryUpdateView(**kwargs)[source]

Bases: django.contrib.auth.mixins.UserPassesTestMixin, django.contrib.auth.mixins.LoginRequiredMixin, django.views.generic.edit.UpdateView

form_class

alias of demo.forms.GalleryForm

get_context_data(**kwargs)[source]

Insert the form into the context dict.

model

alias of demo.models.DemoGallery

template_name = 'form.html'
test_func()[source]