Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

featuture (Event-registration): added registaration in Event model #71

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Nitesh-mint
Copy link

Hello,

I have implemented the requested feature. While the majority of the requirements have been followed as outlined, I made a slight modification to the relationship between the Event model and the Participant model.

Requested:
•Relationship: Event to be a Many-to-Many relationship with Participant.

Implemented:
•Relationship: Event has a One-to-Many relationship with Participant.

Reason for the Change:

Since the system does not currently have an authentication mechanism, each event is highly likely to have unique participants. Therefore, it made more sense to model Event as having multiple participants (One-to-Many) rather than a Many-to-Many relationship.

I would like to submit a pull request for review. Please let me know if this adjustment aligns with the project’s requirements or if further changes are needed.

@@ -23,6 +25,49 @@ class EventImagesInline(SummernoteInlineMixin, NestedStackedInline):
extra = 1


class ParticipantsInline(SummernoteInlineMixin, NestedStackedInline):
model = models.Participant
extra = 0
Copy link
Collaborator

@rex9840 rex9840 Jan 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you have defined extra=0 here but again called get_extra() to configure inline.extra ?? if you are using it extra=0 is just a extra line of code

def get_extra(self, request, obj=None, **kwargs):

if obj: # Ensure we're dealing with an existing Event object
if obj.participants.count() < obj.max_capacity:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can remove nested if else simply buy using and operator comparision

def has_add_permission(self, request, obj=None):
"""
Prevent adding new participants if the event is full.
"""
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as get_extra() remove nested if

@@ -23,6 +25,49 @@ class EventImagesInline(SummernoteInlineMixin, NestedStackedInline):
extra = 1


class ParticipantsInline(SummernoteInlineMixin, NestedStackedInline):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also rather than admin pannel it would be great if we could present api for participants
so i dont think we need to make particiant more complicated than this

@@ -23,6 +25,49 @@ class EventImagesInline(SummernoteInlineMixin, NestedStackedInline):
extra = 1


class ParticipantsInline(SummernoteInlineMixin, NestedStackedInline):
model = models.Participant
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also do we need inline as event is independent to the participants
just update the participants
why do we need it in the event sections

@@ -35,12 +35,19 @@ class Meta:
fields = "__all__"


Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seriailzer exiss but not route and view for the participants

Copy link
Collaborator

@rex9840 rex9840 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please make the changes as requested and make sure its working as intended

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants