Diffusion
Diffusion application: models, LoRAs, prompts, and image generation jobs.
Models
Django models for Generative Creative Lab diffusion image generation system.
Models are based on the presets.json structure and integrate with the existing lib modules (models/, loras/, prompt_enhancer).
- class cw.diffusion.models.DiffusionModel(*args, **kwargs)[source]
Bases:
ModelRepresents a diffusion model for image generation.
Corresponds to models in presets.json.
- label
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- slug
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- base_architecture
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- path
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- pipeline
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- steps
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- guidance_scale
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- default_width
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- default_height
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- max_pixels
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- scheduler
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- dtype
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- supports_negative_prompt
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- force_default_guidance
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- max_sequence_length
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- token_window
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- vram_usage
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- is_active
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- created_at
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- updated_at
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- exception DoesNotExist
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned
Bases:
MultipleObjectsReturned
- exception NotUpdated
Bases:
ObjectNotUpdated,DatabaseError
- get_base_architecture_display(*, field=<django.db.models.fields.CharField: base_architecture>)
- get_dtype_display(*, field=<django.db.models.fields.CharField: dtype>)
- get_next_by_created_at(*, field=<django.db.models.fields.DateTimeField: created_at>, is_next=True, **kwargs)
- get_next_by_updated_at(*, field=<django.db.models.fields.DateTimeField: updated_at>, is_next=True, **kwargs)
- get_previous_by_created_at(*, field=<django.db.models.fields.DateTimeField: created_at>, is_next=False, **kwargs)
- get_previous_by_updated_at(*, field=<django.db.models.fields.DateTimeField: updated_at>, is_next=False, **kwargs)
- get_scheduler_display(*, field=<django.db.models.fields.CharField: scheduler>)
- id
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- jobs
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.childrenis aReverseManyToOneDescriptorinstance.Most of the implementation is delegated to a dynamically defined manager class built by
create_reverse_many_to_one_manager()defined below.
- objects = <django.db.models.manager.Manager object>
- storyboards
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.childrenis aReverseManyToOneDescriptorinstance.Most of the implementation is delegated to a dynamically defined manager class built by
create_reverse_many_to_one_manager()defined below.
- class cw.diffusion.models.LoraModel(*args, **kwargs)[source]
Bases:
ModelRepresents a LoRA (Low-Rank Adaptation) model.
Corresponds to loras in presets.json.
- label
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- path
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- air
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- base_architecture
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- prompt_suffix
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- negative_prompt_suffix
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- default_strength
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- guidance_scale
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- clip_skip
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- notes
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- theme
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- is_active
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- created_at
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- updated_at
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- exception DoesNotExist
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned
Bases:
MultipleObjectsReturned
- exception NotUpdated
Bases:
ObjectNotUpdated,DatabaseError
- get_base_architecture_display(*, field=<django.db.models.fields.CharField: base_architecture>)
- get_next_by_created_at(*, field=<django.db.models.fields.DateTimeField: created_at>, is_next=True, **kwargs)
- get_next_by_updated_at(*, field=<django.db.models.fields.DateTimeField: updated_at>, is_next=True, **kwargs)
- get_previous_by_created_at(*, field=<django.db.models.fields.DateTimeField: created_at>, is_next=False, **kwargs)
- get_previous_by_updated_at(*, field=<django.db.models.fields.DateTimeField: updated_at>, is_next=False, **kwargs)
- id
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- jobs
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.childrenis aReverseManyToOneDescriptorinstance.Most of the implementation is delegated to a dynamically defined manager class built by
create_reverse_many_to_one_manager()defined below.
- objects = <django.db.models.manager.Manager object>
- storyboards
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.childrenis aReverseManyToOneDescriptorinstance.Most of the implementation is delegated to a dynamically defined manager class built by
create_reverse_many_to_one_manager()defined below.
- class cw.diffusion.models.ControlNetModel(*args, **kwargs)[source]
Bases:
ModelRepresents a ControlNet conditioning model.
ControlNet models provide structural guidance (edges, depth, poses) for image generation. Must be paired with a base diffusion model of the same architecture.
- label
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- slug
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- path
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- control_type
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- base_architecture
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- default_conditioning_scale
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- default_guidance_end
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- is_active
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- created_at
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- updated_at
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- exception DoesNotExist
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned
Bases:
MultipleObjectsReturned
- exception NotUpdated
Bases:
ObjectNotUpdated,DatabaseError
- get_base_architecture_display(*, field=<django.db.models.fields.CharField: base_architecture>)
- get_control_type_display(*, field=<django.db.models.fields.CharField: control_type>)
- get_next_by_created_at(*, field=<django.db.models.fields.DateTimeField: created_at>, is_next=True, **kwargs)
- get_next_by_updated_at(*, field=<django.db.models.fields.DateTimeField: updated_at>, is_next=True, **kwargs)
- get_previous_by_created_at(*, field=<django.db.models.fields.DateTimeField: created_at>, is_next=False, **kwargs)
- get_previous_by_updated_at(*, field=<django.db.models.fields.DateTimeField: updated_at>, is_next=False, **kwargs)
- id
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- jobs
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.childrenis aReverseManyToOneDescriptorinstance.Most of the implementation is delegated to a dynamically defined manager class built by
create_reverse_many_to_one_manager()defined below.
- objects = <django.db.models.manager.Manager object>
- storyboards
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.childrenis aReverseManyToOneDescriptorinstance.Most of the implementation is delegated to a dynamically defined manager class built by
create_reverse_many_to_one_manager()defined below.
- class cw.diffusion.models.Prompt(*args, **kwargs)[source]
Bases:
ModelStores prompts with enhancement tracking.
- STYLE_CHOICES = [('auto', 'Auto-detect'), ('photography', 'Photography'), ('artistic', 'Artistic'), ('realistic', 'Realistic'), ('cinematic', 'Cinematic'), ('coloring-book', 'Coloring Book')]
- ENHANCEMENT_METHOD_CHOICES = [('none', 'No Enhancement'), ('rule-based', 'Rule-based'), ('huggingface', 'HuggingFace Local Model'), ('llm', 'LLM API')]
- source_prompt
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- enhanced_prompt
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- negative_prompt
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- enhancement_style
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- enhancement_method
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- creativity
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- created_at
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- updated_at
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- exception DoesNotExist
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned
Bases:
MultipleObjectsReturned
- exception NotUpdated
Bases:
ObjectNotUpdated,DatabaseError
- get_enhancement_method_display(*, field=<django.db.models.fields.CharField: enhancement_method>)
- get_enhancement_style_display(*, field=<django.db.models.fields.CharField: enhancement_style>)
- get_next_by_created_at(*, field=<django.db.models.fields.DateTimeField: created_at>, is_next=True, **kwargs)
- get_next_by_updated_at(*, field=<django.db.models.fields.DateTimeField: updated_at>, is_next=True, **kwargs)
- get_previous_by_created_at(*, field=<django.db.models.fields.DateTimeField: created_at>, is_next=False, **kwargs)
- get_previous_by_updated_at(*, field=<django.db.models.fields.DateTimeField: updated_at>, is_next=False, **kwargs)
- id
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- jobs
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.childrenis aReverseManyToOneDescriptorinstance.Most of the implementation is delegated to a dynamically defined manager class built by
create_reverse_many_to_one_manager()defined below.
- objects = <django.db.models.manager.Manager object>
- class cw.diffusion.models.DiffusionJob(*args, **kwargs)[source]
Bases:
ModelTracks diffusion image generation jobs.
Jobs are processed by Django-RQ workers.
- STATUS_CHOICES = [('pending', 'Pending'), ('queued', 'Queued'), ('processing', 'Processing'), ('completed', 'Completed'), ('failed', 'Failed'), ('cancelled', 'Cancelled')]
- diffusion_model
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.parentis aForwardManyToOneDescriptorinstance.
- lora_model
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.parentis aForwardManyToOneDescriptorinstance.
- prompt
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.parentis aForwardManyToOneDescriptorinstance.
- identifier
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- width
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- height
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- steps
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- guidance_scale
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- lora_strength
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- seed
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- scheduler
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- num_images
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- controlnet_model
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.parentis aForwardManyToOneDescriptorinstance.
- reference_image
Just like the FileDescriptor, but for ImageFields. The only difference is assigning the width/height to the width_field/height_field, if appropriate.
- preprocessing_type
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- conditioning_scale
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- control_guidance_end
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- status
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- rq_job_id
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- result_images
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- generation_metadata
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- error_message
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- created_at
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- started_at
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- completed_at
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- get_generation_params()[source]
Return complete generation parameters, using model/LoRA defaults where needed.
- exception DoesNotExist
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned
Bases:
MultipleObjectsReturned
- exception NotUpdated
Bases:
ObjectNotUpdated,DatabaseError
- controlnet_model_id
- diffusion_model_id
- get_next_by_created_at(*, field=<django.db.models.fields.DateTimeField: created_at>, is_next=True, **kwargs)
- get_preprocessing_type_display(*, field=<django.db.models.fields.CharField: preprocessing_type>)
- get_previous_by_created_at(*, field=<django.db.models.fields.DateTimeField: created_at>, is_next=False, **kwargs)
- get_scheduler_display(*, field=<django.db.models.fields.CharField: scheduler>)
- get_status_display(*, field=<django.db.models.fields.CharField: status>)
- id
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- lora_model_id
- objects = <django.db.models.manager.Manager object>
- prompt_id
- storyboard_image
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.restaurantis aReverseOneToOneDescriptorinstance.
Tasks
Celery tasks for diffusion image generation and prompt enhancement.
These tasks integrate with the cw.lib modules: - cw/lib/models/ (BaseModel, ModelFactory, Flux, Qwen, SDXL, etc.) - cw/lib/loras/manager.py - cw/lib/prompt_enhancer.py (HFPromptEnhancer)
Celery is configured with ‘solo’ pool to avoid fork() issues with MPS on macOS. This allows tasks to use GPU acceleration (MPS on Apple Silicon, CUDA on NVIDIA).
Admin
Django admin configuration for diffusion models.
Uses Django Unfold for tabs, display decorators, and styled actions.
- class cw.diffusion.admin.UserAdmin(model, admin_site)[source]
Bases:
UserAdmin,ModelAdmin- Parameters:
model (type[Model])
admin_site (AdminSite)
- property media
- class cw.diffusion.admin.GroupAdmin(model, admin_site)[source]
Bases:
GroupAdmin,ModelAdmin- Parameters:
model (type[Model])
admin_site (AdminSite)
- property media
- class cw.diffusion.admin.TaskResultAdmin(model, admin_site)[source]
Bases:
TaskResultAdmin,ModelAdmin- Parameters:
model (type[Model])
admin_site (AdminSite)
- property media
- class cw.diffusion.admin.GroupResultAdmin(model, admin_site)[source]
Bases:
GroupResultAdmin,ModelAdmin- Parameters:
model (type[Model])
admin_site (AdminSite)
- property media
- class cw.diffusion.admin.JobInline(model, admin_site)[source]
Bases:
TabularInlineInline display of jobs for Prompts.
- Parameters:
model (type[Model])
admin_site (AdminSite)
- model
alias of
DiffusionJob
- tab = True
- extra = 0
- fields = ['diffusion_model', 'lora_model', 'status', 'num_images', 'created_at']
- readonly_fields = ['status', 'created_at']
- can_delete = False
- show_change_link = True
- has_add_permission(request, obj=None)[source]
Return True if the given request has permission to add an object. Can be overridden by the user in subclasses.
- property media
- class cw.diffusion.admin.DiffusionModelAdmin(model, admin_site)[source]
Bases:
ModelAdmin- Parameters:
model (type[Model])
admin_site (AdminSite)
- list_display = ['label', 'base_architecture', 'show_scheduler', 'token_window', 'vram_in_gb', 'steps', 'show_resolution', 'show_negative_prompt', 'show_downloaded', 'show_active', 'show_loras_count']
- list_filter = ['is_active', 'base_architecture', 'pipeline', 'scheduler', 'supports_negative_prompt', 'dtype']
- search_fields = ['label', 'slug', 'path']
- readonly_fields = ['created_at', 'updated_at']
- fieldsets = (('Model', {'classes': ['tab'], 'fields': ('label', ('slug', 'path'), ('pipeline', 'base_architecture', 'is_active'))}), ('Generation', {'classes': ['tab'], 'fields': (('default_width', 'default_height', 'max_pixels'), ('steps', 'guidance_scale', 'scheduler'), ('dtype', 'max_sequence_length', 'supports_negative_prompt'), ('token_window', 'vram_usage'))}), ('Metadata', {'classes': ['tab'], 'fields': ('created_at', 'updated_at')}))
- property media
- class cw.diffusion.admin.ControlNetModelAdmin(model, admin_site)[source]
Bases:
ModelAdmin- Parameters:
model (type[Model])
admin_site (AdminSite)
- list_display = ['label', 'control_type', 'base_architecture', 'show_conditioning_scale', 'show_downloaded', 'show_active', 'show_compatible_models']
- list_filter = ['is_active', 'base_architecture', 'control_type']
- search_fields = ['label', 'slug', 'path']
- readonly_fields = ['created_at', 'updated_at']
- fieldsets = (('ControlNet', {'classes': ['tab'], 'fields': ('label', ('slug', 'path'), ('control_type', 'base_architecture', 'is_active'))}), ('Conditioning', {'classes': ['tab'], 'fields': (('default_conditioning_scale', 'default_guidance_end'),)}), ('Metadata', {'classes': ['tab'], 'fields': ('created_at', 'updated_at')}))
- property media
- class cw.diffusion.admin.LoraModelAdmin(model, admin_site)[source]
Bases:
ModelAdmin- Parameters:
model (type[Model])
admin_site (AdminSite)
- list_display = ['label', 'theme', 'base_architecture', 'show_downloaded', 'show_active']
- list_filter = ['is_active', 'base_architecture', 'theme']
- search_fields = ['label', 'path', 'air', 'theme']
- readonly_fields = ['created_at', 'updated_at', 'show_token_counts']
- actions = ['refresh_metadata_bulk_action']
- actions_list = ['import_from_civitai_action']
- actions_row = ['refresh_metadata_action']
- fieldsets = (('LoRA', {'classes': ['tab'], 'fields': (('label', 'is_active'), ('path', 'air'), ('base_architecture', 'theme'))}), ('Prompt & Settings', {'classes': ['tab'], 'fields': (('default_strength', 'guidance_scale', 'clip_skip'), ('prompt_suffix', 'negative_prompt_suffix'), 'show_token_counts', 'notes')}), ('Metadata', {'classes': ['tab'], 'fields': ('created_at', 'updated_at')}))
- refresh_metadata_action(request, *args, **kwargs)
- refresh_metadata_bulk_action(request, *args, **kwargs)
- change_form_buttons(request, obj=None, add=False)[source]
Add custom Download and Refresh Metadata buttons to the change form for LoRAs with AIR.
- refresh_metadata_view(request, lora_id)[source]
Refresh metadata from CivitAI for an existing LoRA.
- import_from_civitai_action(request, *args, **kwargs)
- property media
- class cw.diffusion.admin.PromptStatusFilter(request, params, model, model_admin)[source]
Bases:
SimpleListFilter- title = 'Status'
- parameter_name = 'is_enhanced'
- class cw.diffusion.admin.PromptAdmin(model, admin_site)[source]
Bases:
ModelAdmin- Parameters:
model (type[Model])
admin_site (AdminSite)
- list_display = ['show_preview', 'enhancement_style', 'show_status', 'show_jobs', 'created_at']
- list_filter = ['enhancement_method', 'enhancement_style', <class 'cw.diffusion.admin.PromptStatusFilter'>, 'created_at']
- search_fields = ['source_prompt', 'enhanced_prompt']
- readonly_fields = ['created_at', 'updated_at', 'enhancement_method']
- actions = ['enhance_prompts_action', 'create_job_for_prompts']
- actions_row = ['enhance_single_action', 'create_job_action']
- inlines = [<class 'cw.diffusion.admin.JobInline'>]
- fieldsets = (('Prompt', {'classes': ['tab'], 'fields': ('source_prompt',)}), ('Enhancement', {'classes': ['tab'], 'fields': (('enhanced_prompt', 'negative_prompt'), ('enhancement_method', 'enhancement_style', 'creativity'))}), ('Metadata', {'classes': ['tab'], 'fields': ('created_at', 'updated_at')}))
- enhance_single_action(request, *args, **kwargs)
- create_job_action(request, *args, **kwargs)
- enhance_prompts_action(request, *args, **kwargs)
- create_job_for_prompts(request, *args, **kwargs)
- property media
- class cw.diffusion.admin.DiffusionJobAdmin(model, admin_site)[source]
Bases:
ModelAdmin- Parameters:
model (type[Model])
admin_site (AdminSite)
- change_form_template = 'admin/diffusion/diffusionjob/change_form.html'
- changeform_view(request, object_id=None, form_url='', extra_context=None)[source]
Changeform contains actions_submit_line and actions_detail custom actions.
- formfield_for_foreignkey(db_field, request, **kwargs)[source]
Filter LoRA and ControlNet choices based on the selected model’s architecture.
- list_display = ['show_id', 'identifier', 'show_status', 'diffusion_model', 'lora_model', 'show_scheduler', 'show_prompt', 'num_images', 'created_at', 'show_duration']
- list_filter = ['status', 'diffusion_model', 'lora_model', 'scheduler', 'created_at']
- search_fields = ['rq_job_id', 'prompt__source_prompt']
- readonly_fields = ['rq_job_id', 'status', 'created_at', 'started_at', 'completed_at', 'show_result_images', 'show_generation_metadata', 'show_duration']
- actions = ['queue_jobs_action', 'cancel_jobs_action', 'retry_failed_jobs']
- actions_row = ['queue_single_action', 'retry_single_action', 'cancel_single_action']
- fieldsets = (('Configuration', {'classes': ['tab'], 'fields': ('diffusion_model', 'lora_model', 'prompt', 'identifier')}), ('Parameters', {'classes': ['tab'], 'description': 'Leave blank to use model/LoRA defaults.', 'fields': (('width', 'height'), ('steps', 'guidance_scale'), ('scheduler', 'lora_strength'), ('seed', 'num_images'))}), ('ControlNet', {'classes': ['tab'], 'description': 'Optional: attach a ControlNet and reference image for structure-guided generation (wireframe storyboards, etc.).', 'fields': ('controlnet_model', 'reference_image', 'preprocessing_type', ('conditioning_scale', 'control_guidance_end'))}), ('Status', {'classes': ['tab'], 'fields': ('status', 'rq_job_id', 'error_message')}), ('Results', {'classes': ['tab'], 'fields': ('show_result_images', 'show_generation_metadata')}), ('Timing', {'classes': ['tab'], 'fields': ('created_at', 'started_at', 'completed_at', 'show_duration')}))
- queue_single_action(request, *args, **kwargs)
- retry_single_action(request, *args, **kwargs)
- cancel_single_action(request, *args, **kwargs)
- queue_jobs_action(request, *args, **kwargs)
- cancel_jobs_action(request, *args, **kwargs)
- retry_failed_jobs(request, *args, **kwargs)
- property media