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

remove timezone from calendar #15

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions my_hebrew_dates/hebcal/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,9 @@
class CalendarForm(forms.ModelForm):
class Meta:
model = Calendar
fields = ["name", "timezone"]
fields = ["name"]
labels = {
"name": "Name",
"timezone": "Timezone",
}
widgets = {
"timezone": forms.Select(choices=Calendar.TIMEZONE_CHOICES),
}


Expand Down
607 changes: 0 additions & 607 deletions my_hebrew_dates/hebcal/migrations/0001_initial.py

Large diffs are not rendered by default.

4 changes: 0 additions & 4 deletions my_hebrew_dates/hebcal/models.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import uuid
import zoneinfo

from django.conf import settings
from django.db import models
Expand Down Expand Up @@ -64,9 +63,6 @@ class Calendar(models.Model):
settings.AUTH_USER_MODEL,
on_delete=models.CASCADE,
)
# https://stackoverflow.com/a/70251235
TIMEZONE_CHOICES = ((x, x) for x in sorted(zoneinfo.available_timezones(), key=str.lower))
timezone = models.CharField("Timezone", choices=TIMEZONE_CHOICES, max_length=250, default="America/New_York")
calendar_file_str = models.TextField(blank=True, null=True)

def __str__(self):
Expand Down
6 changes: 1 addition & 5 deletions my_hebrew_dates/hebcal/utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from datetime import date

from icalendar import Calendar, Event, Timezone
from icalendar import Calendar, Event

from .models import Calendar as ModelCalendar
from .models import HebrewDate
Expand All @@ -12,10 +12,6 @@ def generate_ical(modelCalendar: ModelCalendar):
newcal.add("version", "2.0")
newcal.add("x-wr-calname", modelCalendar.name)

newtimezone = Timezone()
newtimezone.add("tzid", modelCalendar.timezone)
newcal.add_component(newtimezone)

events = []

for hebrewDate in modelCalendar.calendarOf.all():
Expand Down
4 changes: 2 additions & 2 deletions my_hebrew_dates/hebcal/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class CalendarCreateView(LoginRequiredMixin, CreateView):
model = Calendar
login_url = reverse_lazy("login")
template_name = "hebcal/calendar_detail.html"
fields = ["name", "timezone"]
fields = ["name"]

def get_queryset(self):
# Retrieve the calendars belonging to the current user
Expand Down Expand Up @@ -129,7 +129,7 @@ class CalendarUpdateView(LoginRequiredMixin, UpdateView):
model = Calendar
login_url = reverse_lazy("login")
template_name = "hebcal/calendar_detail.html"
fields = ["name", "timezone"]
fields = ["name"]

def get_queryset(self):
# Retrieve the calendars belonging to the current user
Expand Down
4 changes: 0 additions & 4 deletions my_hebrew_dates/templates/hebcal/calendar_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ <h2 class="text-center">My Calendar</h2>
Calendar {{ form.name.label_tag }}
{{ form.name }}
</div>
<div class="col-sm-6">
{{ form.timezone.label_tag }}
{{ form.timezone }}
</div>
</div>


Expand Down
1 change: 0 additions & 1 deletion my_hebrew_dates/templates/hebcal/calendar_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ <h1 class="text-center">My Calendars</h1>
<h5 class="mb-0">
<a href="{% url 'hebcal:calendar_share' calendar.uuid %}">{{ calendar.name }}</a>
</h5>
<p class="text-muted mb-0">{{ calendar.timezone }}</p>
</div>
<div>
<input hidden id="calendar_file_url{{calendar.id}}" value="https://{{domain_name}}{% url 'hebcal:calendar_share' calendar.uuid %}">
Expand Down