-
Notifications
You must be signed in to change notification settings - Fork 8
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
base: main
Are you sure you want to change the base?
featuture (Event-registration): added registaration in Event model #71
Conversation
@@ -23,6 +25,49 @@ class EventImagesInline(SummernoteInlineMixin, NestedStackedInline): | |||
extra = 1 | |||
|
|||
|
|||
class ParticipantsInline(SummernoteInlineMixin, NestedStackedInline): | |||
model = models.Participant | |||
extra = 0 |
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
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. | ||
""" |
There was a problem hiding this comment.
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): |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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__" | |||
|
|||
|
There was a problem hiding this comment.
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
There was a problem hiding this 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
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.