Skip to content

Commit

Permalink
Resolved conflicts for beta.3 merge
Browse files Browse the repository at this point in the history
  • Loading branch information
DevilsAutumn committed Sep 19, 2024
2 parents 295530b + bca3eff commit d67f98b
Show file tree
Hide file tree
Showing 47 changed files with 770 additions and 186 deletions.
11 changes: 10 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,13 @@ DJANGO_SUPERUSER_USERNAME=admin
DJANGO_SUPERUSER_EMAIL=[email protected]
DJANGO_SUPERUSER_PASSWORD=admin

NEXT_PUBLIC_API_URL= http://localhost:8000/api/v1
# for running with docker, else put these variables inside .env in frontend folder

# Server-side URL (not prefixed with NEXT_PUBLIC_)
API_URL=http://djangoindia-backend:8000/api/v1
# without docker: API_URL=http://localhost:8000/api/v1

# Client-side URL (prefixed with NEXT_PUBLIC_)
NEXT_PUBLIC_API_URL=http://localhost:8000/api/v1

NEXT_PUBLIC_NODE_ENV=development
130 changes: 129 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,129 @@
# djangoindia.org
<div align="center">
<img src="assets/djangoindia-logo.png" alt="Django India Logo" />
</div>



<hr>

<h1 align="center">Welcome to Django India Community!</h1>


**Django India Community** is a vibrant and inclusive hub for Django developers, offering a supportive environment for learning, growth, and networking. Join us to connect with like-minded individuals, share knowledge, and collaborate on exciting projects. Whether you're a beginner or an experienced developer, our community welcomes everyone with open arms. Discover new opportunities, expand your professional network, and contribute to the growth of the Django ecosystem in India.

## Table of Contents
- [Code of Conduct](#code-of-conduct)
- [Get Involved and Make a Difference](#get-involved-and-make-a-difference)
- [Contributing to djangoindia website](#contributing-to-djangoindia-website)
- [Maintainers](#maintainers)
- [License](#license)


## Code of Conduct

We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, gender identity and expression, level of experience, education, socioeconomic status, nationality, personal appearance, race, religion, or sexual identity and orientation.

We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
For more details, please see our [Code of Conduct.](https://github.com/djangoindia/djangoindia.org/blob/main/CODE_OF_CONDUCT.md)

## Get Involved and Make a Difference


Join our community. Here's how you can get involved:

- **Star the Repo:** Show your support by giving us a star! ⭐️
- **Spread the Word:** Share Django India with your colleagues and friends. 📣
- **Report Issues:** Notice something not quite right? Let us know by creating an issue. Your feedback is invaluable! 🐛
- **Contribute Code:** Dive into open issues and send pull requests to help us squash bugs and implement exciting enhancements. 🛠️
- **Review Pull requests:** By actively reviewing pull requests, you can help maintain the quality and integrity of the project, while also supporting other contributors and fostering a collaborative environment within the Django India community.🕵️

Together, let's build something incredible! ✨🚀


## Contributing to djangoindia website

We welcome contributions from everyone, whether you're fixing bugs, adding new features, or improving documentation. To contribute, please fork the repository, create a new branch for your changes, and submit a pull request. Make sure to follow our coding standards and include tests where applicable. We also encourage you to discuss significant changes by opening an issue before starting development. Your contributions help us build a stronger community—thank you for being a part of Django India!
For more details, please see our [Contributing.md](https://github.com/djangoindia/djangoindia.org/blob/main/contributing.md)

## Maintainers


<table>
<tbody>
<tr>
<td align="center" width="150px">
<a href="https://github.com/ankanchanda">
<img src="https://avatars.githubusercontent.com/u/108596468?v=4" width="75" height="75"  
alt="Saurabh Sharma" />
<br />
Ankan Chanda
</a>
<br />
<p align="center">
<a target="_blank" href="https://www.linkedin.com/in/ankanchanda/">
<img width="32" height="32" src="https://img.icons8.com/color/32/linkedin.png" alt="LinkedIn" />
</a>
<!-- &nbsp;&nbsp; <a href="mailto:[email protected]">
<img width="32" height="32" src="https://img.icons8.com/color/32/gmail-new.png" alt="Gmail" /> -->
</a>
</p>
</td>
<td align="center" width="150px">
<a href="https://github.com/nikhil25803">
<img src="https://avatars.githubusercontent.com/u/93156825?v=4" width="75" height="75"  
alt="Nikhil Raj" />
<br />
Nikhil Raj
</a>
<br />
<p align="center">
<a target="_blank" href="https://www.linkedin.com/in/nikhil25803/">
<img width="32" height="32" src="https://img.icons8.com/color/32/linkedin.png" alt="LinkedIn" />
</a>
<!-- &nbsp;&nbsp; <a href="mailto:[email protected]">
<img width="32" height="32" src="https://img.icons8.com/color/32/gmail-new.png" alt="Gmail" /> -->
</a>
</p>
</td>
<td align="center" width="150px">
<a href="https://github.com/Knighthawk-Leo">
<img src="https://avatars.githubusercontent.com/u/72437494?v=4" width="75" height="75"  
alt="Sanskar Dwivedi" />
<br />
Sanskar Dwivedi
</a>
<br />
<p align="center">
<a target="_blank" href="https://www.linkedin.com/in/sanskar-dwivedi-a20201200/">
<img width="32" height="32" src="https://img.icons8.com/color/32/linkedin.png" alt="LinkedIn" />
</a>
<!-- &nbsp;&nbsp; <a href="mailto:[email protected]">
<img width="32" height="32" src="https://img.icons8.com/color/32/gmail-new.png" alt="Gmail" />
</a> -->
</p>
</td>
<td align="center" width="150px">
<a href="https://github.com/Saurabhsharma884">
<img src="https://avatars.githubusercontent.com/u/65456653?v=4" width="75" height="75"  
alt="Saurabh Sharma" />
<br />
Saurabh Sharma
</a>
<br />
<p align="center">
<a target="_blank" href="https://www.linkedin.com/in/saurabh-sharma-555a501b7/">
<img width="32" height="32" src="https://img.icons8.com/color/32/linkedin.png" alt="LinkedIn" />
</a>
<!-- &nbsp;&nbsp; <a href="mailto:[email protected]">
<img width="32" height="32" src="https://img.icons8.com/color/32/gmail-new.png" alt="Gmail" /> -->
</a>
</p>
</td>
</tr>
</tbody>
</table>

## License

This project is licensed under the MIT License, one of the most permissive and widely used open-source licenses.This means that you can integrate this project into your applications, modify it to fit your needs, and even distribute it as part of a commercial product without any concern for legal restrictions.
For more details, please see our [License.](https://github.com/djangoindia/djangoindia.org/blob/main/LICENSE)
Binary file added assets/djangoindia-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/webiste-front.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion backend/djangoindia/api/serializers/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
from .event import EventSerializer, EventRegistrationSerializer
from .communication import NewsletterSubscriptionSerializer, ContactUsSerializer
from .communication import SubscriberSerializer, ContactUsSerializer
6 changes: 3 additions & 3 deletions backend/djangoindia/api/serializers/communication.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
from rest_framework import serializers
from djangoindia.db.models.communication import NewsletterSubscription, ContactUs
from djangoindia.db.models.communication import Subscriber, ContactUs

class NewsletterSubscriptionSerializer(serializers.Serializer):
class SubscriberSerializer(serializers.Serializer):
name = serializers.CharField(max_length=100)
email = serializers.EmailField()

def create(self, validated_data):
return NewsletterSubscription.objects.create(**validated_data)
return Subscriber.objects.create(**validated_data)

class ContactUsSerializer(serializers.Serializer):
first_name = serializers.CharField(max_length=100)
Expand Down
20 changes: 17 additions & 3 deletions backend/djangoindia/api/serializers/event.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
from rest_framework import serializers

from djangoindia.db.models.event import Event, EventRegistration
from djangoindia.db.models.event import Event, EventRegistration,Sponsor,Sponsorship



class SponsorDetailsSerializer(serializers.Serializer):
name = serializers.CharField(max_length=255)
type = serializers.CharField()
logo = serializers.ImageField()
url = serializers.URLField(allow_blank=True, allow_null=True)

class SponsorSerializer(serializers.Serializer):
sponsor_details = SponsorDetailsSerializer()
tier = serializers.CharField()
type = serializers.CharField()


class EventSerializer(serializers.Serializer):
Expand All @@ -22,8 +35,10 @@ class EventRegistrationSerializer(serializers.Serializer):
email = serializers.EmailField()
first_name = serializers.CharField(max_length=255)
last_name = serializers.CharField(max_length=255)
occupation = serializers.ChoiceField(choices=EventRegistration.OCCUPATION_CHOICES)
professional_status = serializers.ChoiceField(choices=EventRegistration.PROFESSIONAL_STATUS_CHOICES)
gender = serializers.ChoiceField(choices=EventRegistration.GENDER_CHOICES)
organization = serializers.CharField(max_length=100,required=False, allow_blank=True)
description = serializers.CharField(required=False, allow_blank=True)
linkedin = serializers.URLField()
github = serializers.URLField(required=False, allow_blank=True)
twitter = serializers.URLField(required=False, allow_blank=True)
Expand All @@ -32,4 +47,3 @@ class EventRegistrationSerializer(serializers.Serializer):

def create(self, validated_data):
return EventRegistration.objects.create(**validated_data)

4 changes: 2 additions & 2 deletions backend/djangoindia/api/urls/communication.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from django.urls import path

from djangoindia.api.views.communication import NewsletterSubscriptionAPIView, ContactUsAPIView
from djangoindia.api.views.communication import SubscriberAPIView, ContactUsAPIView

urlpatterns = [
path('newsletter/', NewsletterSubscriptionAPIView.as_view(), name='newsletter-subscription'),
path('subscriber/', SubscriberAPIView.as_view(), name='subscriber'),
path('contact-us/', ContactUsAPIView.as_view(), name='contact-us'),
]
2 changes: 1 addition & 1 deletion backend/djangoindia/api/views/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
from .event import EventAPIView
from .communication import NewsletterSubscriptionAPIView, ContactUsAPIView
from .communication import SubscriberAPIView, ContactUsAPIView
12 changes: 6 additions & 6 deletions backend/djangoindia/api/views/communication.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
from djangoindia.api.serializers.communication import (
ContactUsSerializer,
NewsletterSubscriptionSerializer,
SubscriberSerializer,
)
from djangoindia.db.models.communication import NewsletterSubscription
from djangoindia.db.models.communication import Subscriber
from rest_framework import generics, status
from rest_framework.mixins import CreateModelMixin
from rest_framework.response import Response


class NewsletterSubscriptionAPIView(generics.GenericAPIView, CreateModelMixin):
queryset = NewsletterSubscription.objects.all()
serializer_class = NewsletterSubscriptionSerializer
class SubscriberAPIView(generics.GenericAPIView, CreateModelMixin):
queryset = Subscriber.objects.all()
serializer_class = SubscriberSerializer

def post(self, request, *args, **kwargs):
try:
if NewsletterSubscription.objects.filter(
if Subscriber.objects.filter(
email=request.data.get("email")
).exists():
return Response(
Expand Down
24 changes: 20 additions & 4 deletions backend/djangoindia/api/views/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,35 @@
EventSerializer,
)
from djangoindia.bg_tasks.event_registration import registration_confirmation_email_task
from djangoindia.db.models.event import Event, EventRegistration
from djangoindia.db.models.event import Event, EventRegistration,Sponsorship
from rest_framework import generics, status
from rest_framework.mixins import CreateModelMixin, ListModelMixin, RetrieveModelMixin
from rest_framework.response import Response

from djangoindia.constants import POST, PRIMARY_KEY_SHORT
from django.db.models import Prefetch


# Create your views here.
class EventAPIView(
generics.GenericAPIView, ListModelMixin, CreateModelMixin, RetrieveModelMixin
):
queryset = Event.objects.all()
queryset = Event.objects.all().prefetch_related(
Prefetch(
'sponsors',
queryset=Sponsorship.objects.filter(
type='event_sponsorship'
).select_related('sponsor_details').only(
'tier',
'type',
'sponsor_details__url',
'sponsor_details__name',
'sponsor_details__type',
'sponsor_details__logo'
),
to_attr='event_sponsors'
)
)

def get_serializer_class(self):
if self.request.method == POST:
Expand All @@ -40,7 +56,7 @@ def post(self, request, *args, **kwargs):
email=request.data.get("email"), event=request.data.get("event")
).exists():
return Response(
{"message": "You have already registered for this event."},
{"message": "We get it, you’re excited. But you've already secured your ticket!"},
status=status.HTTP_409_CONFLICT,
)
self.create(request, *args, **kwargs)
Expand All @@ -50,7 +66,7 @@ def post(self, request, *args, **kwargs):
event_id = request.data.get("event")
registration_confirmation_email_task.delay(recipient_email, event_id)
return Response(
{"message": "Registration successful. Confirmation email sent."},
{"message": "You're in! We've sent a shiny email to your inbox. Time to celebrate!"},
status=status.HTTP_201_CREATED,
)
except Exception as e:
Expand Down
6 changes: 4 additions & 2 deletions backend/djangoindia/bg_tasks/event_registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ def registration_confirmation_email_task(email, event_id):
'first_name': registration.first_name,
'event': {
'name': registration.event.name,
'date_time': registration.event.date_time,
'start_date': registration.event.start_date,
'end_date': registration.event.end_date,
'event_mode': registration.event.event_mode,
'venue': registration.event.venue,
'description': registration.event.description,
'cover_image': registration.event.cover_image if registration.event.cover_image else None,
Expand All @@ -26,7 +28,7 @@ def registration_confirmation_email_task(email, event_id):
# Strip the HTML tags for a plain text alternative
text_content = strip_tags(html_content)

subject = f'{registration.event.name} - Event Registration Successful!'
subject = f'{registration.event.name} - Registration Successful!'
from_email = settings.DEFAULT_FROM_EMAIL
to_email = [email]

Expand Down
29 changes: 29 additions & 0 deletions backend/djangoindia/bg_tasks/send_update.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
from celery import shared_task
from django.core.mail import send_mass_mail

from django.conf import settings

@shared_task
def send_mass_update_email_task(update_id):
from djangoindia.db.models.update import Update
try:
update = Update.objects.get(id=update_id)
except Update.DoesNotExist:
raise ValueError("Update not found")

email_objs=[]
for subscriber in update.recipients.all():
email_tuple = (
f"Django India: {update.get_formatted_type()}",
update.html_template,
settings.DEFAULT_FROM_EMAIL,
[subscriber.email],
)
email_objs.append(email_tuple)
try:
send_mass_mail((email for email in email_objs), fail_silently=False)
update.mail_sent=True
update.save()
except Exception as e:
# Didn't throw error at django level even for wrong emails.
print(f"Failed to send email : {str(e)}")
Loading

0 comments on commit d67f98b

Please sign in to comment.