diff --git a/Clubs/__pycache__/forms.cpython-310.pyc b/Clubs/__pycache__/forms.cpython-310.pyc index ef5907c..ab40148 100644 Binary files a/Clubs/__pycache__/forms.cpython-310.pyc and b/Clubs/__pycache__/forms.cpython-310.pyc differ diff --git a/Clubs/__pycache__/models.cpython-310.pyc b/Clubs/__pycache__/models.cpython-310.pyc index 9a37cfc..7fdf897 100644 Binary files a/Clubs/__pycache__/models.cpython-310.pyc and b/Clubs/__pycache__/models.cpython-310.pyc differ diff --git a/Clubs/__pycache__/views.cpython-310.pyc b/Clubs/__pycache__/views.cpython-310.pyc index bcc13ea..05f75d4 100644 Binary files a/Clubs/__pycache__/views.cpython-310.pyc and b/Clubs/__pycache__/views.cpython-310.pyc differ diff --git a/Clubs/__pycache__/views_schedule.cpython-310.pyc b/Clubs/__pycache__/views_schedule.cpython-310.pyc index 3721a5a..5a75955 100644 Binary files a/Clubs/__pycache__/views_schedule.cpython-310.pyc and b/Clubs/__pycache__/views_schedule.cpython-310.pyc differ diff --git a/Clubs/forms.py b/Clubs/forms.py index bc56f04..8672d61 100644 --- a/Clubs/forms.py +++ b/Clubs/forms.py @@ -5,7 +5,6 @@ from .models import Club from .models import * - class ClubForm(ModelForm): class Meta: model = Club @@ -59,6 +58,9 @@ class Meta: 'placeholder': 'Website (optional) [www.example.com or example.com]' }), required=False) + + + class MemberForm(ModelForm): class Meta: model = UserMembership diff --git a/Clubs/migrations/0026_clubtrainingsession.py b/Clubs/migrations/0026_clubtrainingsession.py new file mode 100644 index 0000000..2295c76 --- /dev/null +++ b/Clubs/migrations/0026_clubtrainingsession.py @@ -0,0 +1,26 @@ +# Generated by Django 4.1.2 on 2023-03-18 19:17 + +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('WorkoutJournal', '0009_remove_trainingsession_addedbyuser_and_more'), + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ('Clubs', '0025_rename_field_schedule_friday_schedule_monday_and_more'), + ] + + operations = [ + migrations.CreateModel( + name='ClubTrainingSession', + fields=[ + ('trainingsession_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='WorkoutJournal.trainingsession')), + ('Club', models.ForeignKey(blank=True, on_delete=django.db.models.deletion.CASCADE, to='Clubs.club')), + ('participants', models.ManyToManyField(blank=True, to=settings.AUTH_USER_MODEL)), + ], + bases=('WorkoutJournal.trainingsession',), + ), + ] diff --git a/Clubs/migrations/0027_delete_clubtrainingsession.py b/Clubs/migrations/0027_delete_clubtrainingsession.py new file mode 100644 index 0000000..61f4065 --- /dev/null +++ b/Clubs/migrations/0027_delete_clubtrainingsession.py @@ -0,0 +1,16 @@ +# Generated by Django 4.1.2 on 2023-03-18 20:23 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('Clubs', '0026_clubtrainingsession'), + ] + + operations = [ + migrations.DeleteModel( + name='ClubTrainingSession', + ), + ] diff --git a/Clubs/migrations/__pycache__/0026_clubtrainingsession.cpython-310.pyc b/Clubs/migrations/__pycache__/0026_clubtrainingsession.cpython-310.pyc new file mode 100644 index 0000000..58a3f81 Binary files /dev/null and b/Clubs/migrations/__pycache__/0026_clubtrainingsession.cpython-310.pyc differ diff --git a/Clubs/migrations/__pycache__/0027_delete_clubtrainingsession.cpython-310.pyc b/Clubs/migrations/__pycache__/0027_delete_clubtrainingsession.cpython-310.pyc new file mode 100644 index 0000000..fa725c4 Binary files /dev/null and b/Clubs/migrations/__pycache__/0027_delete_clubtrainingsession.cpython-310.pyc differ diff --git a/Clubs/models.py b/Clubs/models.py index 8da2049..9f1f9e9 100644 --- a/Clubs/models.py +++ b/Clubs/models.py @@ -4,6 +4,7 @@ from account_register.models import UserProfile from django.db.models.signals import post_save from django.dispatch import receiver +from WorkoutJournal.models import TrainingSession from django.db.models import Case, When, Value # Create your models here. @@ -52,6 +53,9 @@ def requestList(self): def __str__(self): return f'{self.name} {self.estabilished}' +# class ClubTrainingSession(TrainingSession): +# participants = models.ManyToManyField(User, blank=True) +# class UserMembership(models.Model): MEMBER_TYPES = ( @@ -73,8 +77,8 @@ class UserMembership(models.Model): slug = models.SlugField(null=True, blank=True) club = models.ForeignKey(Club, related_name='membersClub', on_delete=models.CASCADE, null=True) -def userClub( userID): - return UserMembership.objects.get(user_id=userID).club + + class Request(models.Model): ACCEPTED = ( ('YES', 'YES'), diff --git a/Clubs/static/Clubs/sorry.png b/Clubs/static/Clubs/sorry.png new file mode 100644 index 0000000..39e3f92 Binary files /dev/null and b/Clubs/static/Clubs/sorry.png differ diff --git a/Clubs/templates/Clubs/clubMembers.html b/Clubs/templates/Clubs/clubMembers.html index 5a22332..17e2aa1 100644 --- a/Clubs/templates/Clubs/clubMembers.html +++ b/Clubs/templates/Clubs/clubMembers.html @@ -1,6 +1,11 @@ {% extends base_template %}{#{% if %}#} {% block content %} +{% if not userHasClub %} + {% include 'Clubs/noClub.html' %} +{% else %} + {% include 'CLubs/membersModals.html' %} +
-{% endblock %} \ No newline at end of file +{% endif %} +{% endblock %} diff --git a/Clubs/templates/Clubs/clubsList.html b/Clubs/templates/Clubs/clubsList.html index 0761d0a..62708fe 100644 --- a/Clubs/templates/Clubs/clubsList.html +++ b/Clubs/templates/Clubs/clubsList.html @@ -1,8 +1,8 @@ {% extends base_template %} {% block content %} - -
- + {% endif %} {% endblock %} \ No newline at end of file diff --git a/Clubs/templates/Clubs/clubsTrainings.html b/Clubs/templates/Clubs/clubsTrainings.html index a91130c..15e9705 100644 --- a/Clubs/templates/Clubs/clubsTrainings.html +++ b/Clubs/templates/Clubs/clubsTrainings.html @@ -1,7 +1,14 @@ {% extends base_template %} {% block content %} +{% if not userHasClub %} + {% include 'Clubs/noClub.html' %} +{% else %} + +{% endif %} + + {% endblock %} \ No newline at end of file diff --git a/Clubs/templates/Clubs/noClub.html b/Clubs/templates/Clubs/noClub.html new file mode 100644 index 0000000..a48c72a --- /dev/null +++ b/Clubs/templates/Clubs/noClub.html @@ -0,0 +1,11 @@ +{% load static %} + \ No newline at end of file diff --git a/Clubs/templates/Clubs/singleClubView.html b/Clubs/templates/Clubs/singleClubView.html index 4eaf3df..13075ea 100644 --- a/Clubs/templates/Clubs/singleClubView.html +++ b/Clubs/templates/Clubs/singleClubView.html @@ -1,11 +1,12 @@ {% load crispy_forms_filters %} {% load static %} -
+
-