AutoSkill django_event_profile_system
Generates a Django event management system using standard User authentication extended by One-to-One Chef and Collaborateur profiles, including Event models with helper methods, registration forms, and role-based view logic.
git clone https://github.com/ECNU-ICALK/AutoSkill
T=$(mktemp -d) && git clone --depth=1 https://github.com/ECNU-ICALK/AutoSkill "$T" && mkdir -p ~/.claude/skills && cp -r "$T/SkillBank/ConvSkill/english_gpt4_8/django_event_profile_system" ~/.claude/skills/ecnu-icalk-autoskill-django-event-profile-system && rm -rf "$T"
SkillBank/ConvSkill/english_gpt4_8/django_event_profile_system/SKILL.mddjango_event_profile_system
Generates a Django event management system using standard User authentication extended by One-to-One Chef and Collaborateur profiles, including Event models with helper methods, registration forms, and role-based view logic.
Prompt
Role & Objective
Act as a Django backend developer. Generate a comprehensive system including standard User authentication extended by One-to-One Chef and Collaborateur profiles, an Event model with specific relationships, and a role-based registration flow.
Communication & Style Preferences
If the user requests 'just code' or 'without text', output ONLY the Python code blocks with no markdown explanations or comments.
Operational Rules & Constraints
-
User Models: Use the standard
. Do not create a customdjango.contrib.auth.models.User
.AbstractBaseUser- Create
andChef
models that extend the User model using aCollaborateur
.OneToOneField - Use
.on_delete=models.CASCADE - Use appropriate
arguments (e.g.,related_name
,chef_profile
).collaborateur_profile
- Create
-
Event Model: Create an
model with the following structure:Event
:title
(max_length=200).CharField
:description
.TextField
:datetime
.DateTimeField
:chef
to theForeignKey
model (on_delete=CASCADE, related_name='events').Chef
:collaborateurs
to theManyToManyField
model (blank=True, related_name='assigned_events').Collaborateur- Define custom permissions in the
class:Meta
,can_create_events
,can_edit_events
.can_delete_events
-
Event Methods: Include helper methods in the
model:Event
: Returnsis_user_chef(self, user)
if the event's chef matches the provided user.True
: Adds a collaborateur to the event.add_collaborateur(self, collaborateur)
: Removes a collaborateur from the event.remove_collaborateur(self, collaborateur)
-
String Representation: Ensure all models have a
method returning a meaningful string representation (e.g., username for profiles, title for events).__str__ -
Forms: Create or update
inheriting fromRegisterUserForm
. Include fields:UserCreationForm
,email
,first_name
,last_name
,password1
. Add a Boolean fieldpassword2
to determine role assignment. Applyis_chef
CSS classes to all widget inputs.form-control -
Views: Update
view inregister_user
. After saving the user, checkmembers/views.py
. Ifform.cleaned_data['is_chef']
is True, create ais_chef
profile linked to the user; otherwise, create aChef
profile. Authenticate and login the user immediately after registration.Collaborateur
Anti-Patterns
Do not create a custom User model (AbstractBaseUser); use the standard Django User. Do not use a
user_type field on the User model; use One-to-One profiles. Do not use single underscores for __str__ (e.g., avoid def str(self):). Do not leave related_name clashes unresolved. Do not create a Venue model or related forms/admin unless requested. Do not use generic 'optimize' or 'rewrite' instructions; follow the specific field and logic requirements above.
Triggers
- create django models for chef and collaborateur
- django event model with chef and collaborateur
- update register_user view for profile assignment
- django user profiles one-to-one
- django event app with permissions