bug_hub package

bug_hub Subpackages

bug_hub Submodules

bug_hub.admin module

Django admin configuration for the Bug_Hub app

class bug_hub.admin.BugAdmin(model, admin_site)[source]

Bases: ModelAdmin

Django admin configuration for the Bug model Makes it accessible and manageable through the Django admin interface.

fields = ('bug_type', 'title', 'description', 'status')
list_display = ('title', 'bug_type', 'report_date', 'status')
property media

bug_hub.apps module

Django Application Configuration

class bug_hub.apps.BugHubConfig(app_name, app_module)[source]

Bases: AppConfig

This class configures BugHub

default_auto_field = 'django.db.models.BigAutoField'
name = 'bug_hub'

bug_hub.choices module

Choice Sets for Bug Types and Statuses

This module fixes predefined options for specifying bug types and statuses used in the Bug model.

Choice Sets:

  • BUG_TYPE_CHOICES (list of tuple): Choice set for bug types.
    • “error”: Error

    • “feature”: Feature Request

    • “enhancement”: Enhancement

    • “documentation”: Documentation

  • STATUS_CHOICES (list of tuple): Choice set for bug statuses.
    • “todo”: To Do

    • “in_progress”: In Progress

    • “under_review”: Under Review

    • “done”: Done

    • “wont_fix”: Won’t Fix

bug_hub.forms module

This module defines custom forms for the Bug Hub application.

class bug_hub.forms.BugCreationForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, instance=None, use_required_attribute=None, renderer=None)[source]

Bases: ModelForm

A form for creating bug reports.

This form is used for creating bug reports in the Glitch Guru Django project.

Parameters:
  • title (CharField) – Name of the bug report.

  • description (CharField) – A detailed description of the bug.

  • bug_type (ChoiceField) – The type of bug, such as error, feature request, enhancement, documentation.

  • status (ChoiceField) – The current status of the bug report (e.g., To Do, In Progress, Done, Under Review, Won’t Fix).

class Meta[source]

Bases: object

fields = ['title', 'description', 'bug_type', 'status']
model

alias of Bug

base_fields = {'bug_type': <django.forms.fields.ChoiceField object>, 'description': <django.forms.fields.CharField object>, 'status': <django.forms.fields.ChoiceField object>, 'title': <django.forms.fields.CharField object>}
clean_title()[source]

Custom validation to check for duplicate bug titles. For ensuring that a bug report with the same title does not already exist.

Returns:

The validated title if it’s unique.

Return type:

str

Raises:

ValidationError – If a bug report with the same title already exists.

declared_fields = {'bug_type': <django.forms.fields.ChoiceField object>, 'description': <django.forms.fields.CharField object>, 'status': <django.forms.fields.ChoiceField object>, 'title': <django.forms.fields.CharField object>}
property media

Return all media required to render the widgets on this form.

bug_hub.model_validators module

This module contains custom validation functions for the Bug Hub application.

bug_hub.model_validators.validate_bug_type(value)[source]

Ensures the bug_type field value is one of the predefined choices.

Parameters:

value (str) – The value of the bug_type field.

Raises:

ValidationError – If the value is not in the predefined choices.

bug_hub.model_validators.validate_description_not_empty(value)[source]

Ensures the description field is not empty.

Parameters:

value (str) – The value of the description field.

Raises:

ValidationError – If the description is empty.

bug_hub.model_validators.validate_min_length(value)[source]

Ensures the title field value is at least 10 characters long.

Parameters:

value (str) – The value of the title field.

Raises:

ValidationError – If the title is shorter than 10 characters.

bug_hub.model_validators.validate_report_date_not_future(value)[source]

Ensures the report_date is in the past (no future reports allowed).

Parameters:

value (datetime) – The value of the report_date field.

Raises:

ValidationError – If the report_date is in the future.

bug_hub.model_validators.validate_status(value)[source]

Ensures the status field value is one of the predefined choices.

Parameters:

value (str) – The value of the status field.

Raises:

ValidationError – If the value is not in the predefined choices.

bug_hub.models module

Database models for storing bug information and related data

class bug_hub.models.Bug(*args, **kwargs)[source]

Bases: Model

Model for storing bug details in a database.

This model represents various attributes related to bugs, including their description, type, reporting date, and status.

Parameters:
  • title (CharField) – Name of the bug.

  • description (TextField) – A detailed description of the bug.

  • bug_type (CharField) – The type of bug, such as error, feature request, enhancement, documentation.

  • report_date (DateTimeField) – The date when the bug was reported. User cannot set it. Only auto-generated.

  • status (CharField) – The current status of the bug (e.g., To Do, In Progress, Done, Under Review, Won’t Fix).

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

bug_type

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

description

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

get_bug_type_display(*, field=<django.db.models.fields.CharField: bug_type>)
get_next_by_report_date(*, field=<django.db.models.fields.DateTimeField: report_date>, is_next=True, **kwargs)
get_previous_by_report_date(*, field=<django.db.models.fields.DateTimeField: report_date>, is_next=False, **kwargs)
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.

objects = <django.db.models.manager.Manager object>
report_date

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.

title

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

bug_hub.urls module

URL configuration for routing web requests to views in Bug_Hub.

bug_hub.views module

This module defines all the views for the Bug Hub application.

class bug_hub.views.BugCreateView(**kwargs)[source]

Bases: CreateView

A view for creating a new bug report.

This view allows users to create and submit new bug reports.

Parameters:
  • model (Bug) – The model representing bug reports.

  • form_class (BugCreationForm) – The form class for creating bug reports.

  • template_name (str) – The path to the HTML template for rendering the bug creation form.

  • success_url (str) – The URL to redirect to after successfully creating a bug report.

form_class

alias of BugCreationForm

form_valid(form)[source]

Handle form submission and set the user who reported the bug.

Returns:

A response indicating the success of bug creation.

Return type:

HttpResponse

model

alias of Bug

success_url = '/bugs/'
template_name = 'bug_hub/bug_create.html'
class bug_hub.views.BugDetailView(**kwargs)[source]

Bases: DetailView

A view for displaying the details of a single bug report.

Parameters:
  • model (Bug) – The model representing bug reports.

  • template_name (str) – The path to the HTML template for rendering the bug details.

  • context_object_name (str) – The name to use for the bug report in the template context.

context_object_name = 'bug'
model

alias of Bug

template_name = 'bug_hub/bug_detail.html'
class bug_hub.views.BugListView(**kwargs)[source]

Bases: ListView

A view for displaying a paginated list of bug reports.

Parameters:
  • model (Bug) – The model representing bug reports.

  • template_name (str) – The path to the HTML template for rendering the bug list.

  • context_object_name (str) – The name to use for the list of bug reports in the template context.

  • paginate_by (int) – The number of bug reports to display per page.

  • ordering (list of str) – The default ordering of bug reports in the list.

context_object_name = 'bugs'
get_context_data(**kwargs)[source]

Get the context data for the view.

Parameters:

kwargs – The keyword arguments passed to the function.

Returns:

The context data with additional filters.

get_queryset()[source]

Returns a queryset object containing the filtered results based on the filter parameters provided in the request.GET.

model

alias of Bug

ordering = ['-report_date']
paginate_by = 10
template_name = 'bug_hub/bug_list.html'