Skip to content

Commit 03cda37

Browse files
authored
Merge pull request #6 from SpokaneTech/init_script
adding events to init script
2 parents eb44a78 + 78c7216 commit 03cda37

File tree

4 files changed

+134
-52
lines changed

4 files changed

+134
-52
lines changed

.github/workflows/build_and_publish_docker.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ jobs:
5959
context: .
6060
file: ./src/docker/Dockerfile
6161
push: true
62+
build-args: |
63+
IMAGE_TAG=${{ steps.vars.outputs.tag }}
6264
tags: |
6365
ghcr.io/${{ steps.vars.outputs.image_name }}:${{ steps.vars.outputs.tag }}
6466
${{ steps.vars.outputs.latest == 'true' && format('ghcr.io/{0}:latest', steps.vars.outputs.image_name) || '' }}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from django.utils import timezone
2+
3+
4+
class PstTimezoneMiddleware:
5+
def __init__(self, get_response):
6+
self.get_response = get_response
7+
8+
def __call__(self, request):
9+
timezone.activate("America/Los_Angeles")
10+
return self.get_response(request)

src/django_project/core/settings.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
"django.contrib.auth.middleware.AuthenticationMiddleware",
7575
"django.contrib.messages.middleware.MessageMiddleware",
7676
"django.middleware.clickjacking.XFrameOptionsMiddleware",
77+
"core.middleware.PstTimezoneMiddleware",
7778
]
7879
if DEPLOYMENT_ENV in ["local", "dev"]:
7980
INSTALLED_APPS += [

src/django_project/web/scripts/initialize_data.py

Lines changed: 121 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
from datetime import datetime
2+
from zoneinfo import ZoneInfo
3+
14
from web.models import Event, Resource, ResourceCategory
25

36

@@ -254,86 +257,152 @@ def create_events() -> None:
254257
events: list[dict[str, str]] = [
255258
{
256259
"name": "Coffee and Code",
257-
"description": "Join us to talk code, work on coding projects, share knowledge, or just hang out.",
260+
"description": "Grab some coffee and write code, together. Every first Monday of the month, local tech enthusiasts meet at a coffee shop to collaborate on code, or just talk tech.",
261+
"start_date_time": "2025-10-06T07:00:00",
262+
"end_date_time": "2025-10-06T08:00:00",
263+
"location": "Indaba Coffee",
264+
"url": "https://www.meetup.com/python-spokane/events/308944537",
265+
},
266+
{
267+
"name": "Coffee and Code",
268+
"description": "Grab some coffee and write code, together. Every first Monday of the month, local tech enthusiasts meet at a coffee shop to collaborate on code, or just talk tech.",
269+
"start_date_time": "2025-09-01T07:00:00",
270+
"end_date_time": "2025-09-01T08:00:00",
271+
"location": "Indaba Coffee",
272+
"url": "https://www.meetup.com/python-spokane/events/310155895",
273+
},
274+
{
275+
"name": "Coffee and Code",
276+
"description": "Grab some coffee and write code, together. Every first Monday of the month, local tech enthusiasts meet at a coffee shop to collaborate on code, or just talk tech.",
258277
"start_date_time": "2025-08-04T07:00:00",
259-
"end_date_time": "2025-08-04T09:00:00",
260-
"location": "Indaba Coffee, Spokane",
278+
"end_date_time": "2025-08-04T08:00:00",
279+
"location": "Indaba Coffee",
261280
"url": "https://www.meetup.com/python-spokane/events/308977832",
262281
},
263282
{
264-
"name": "Spokane Python User Group Monthly Meetup",
265-
"description": "Join us for our monthly meetup to discuss Python, share knowledge, and network with fellow Python enthusiasts.",
266-
"start_date_time": "2025-08-15T18:00:00",
267-
"end_date_time": "2025-08-15T20:00:00",
268-
"location": "Spokane Public Library, Downtown Branch",
269-
"url": "https://www.meetup.com/python-spokane/events/309061819",
283+
"name": "Coffee and Code",
284+
"description": "Grab some coffee and write code, together. Every first Monday of the month, local tech enthusiasts meet at a coffee shop to collaborate on code, or just talk tech.",
285+
"start_date_time": "2025-07-07T07:00:00",
286+
"end_date_time": "2025-07-07T08:00:00",
287+
"location": "Indaba Coffee",
288+
"url": "https://www.meetup.com/python-spokane/events/306382747",
270289
},
271290
{
272291
"name": "Coffee and Code",
273-
"description": "Join us to talk code, work on coding projects, share knowledge, or just hang out.",
274-
"start_date_time": "2025-07-03T07:00:00",
275-
"end_date_time": "2025-07-03T08:00:00",
276-
"location": "Indaba Coffee, Spokane",
292+
"description": "Grab some coffee and write code, together. Every first Monday of the month, local tech enthusiasts meet at a coffee shop to collaborate on code, or just talk tech.",
293+
"start_date_time": "2025-06-02T07:00:00",
294+
"end_date_time": "2025-06-02T08:00:00",
295+
"location": "Indaba Coffee",
277296
"url": "https://www.meetup.com/python-spokane/events/306382746",
278297
},
279-
{
280-
"name": "Python Workshop: Data Analysis with Pandas",
281-
"description": "A hands-on workshop where you will learn how to use Pandas for data analysis in Python.",
282-
"start_date_time": "2025-07-22T10:00:00",
283-
"end_date_time": "2025-07-22T12:00:00",
284-
"location": "Intellitect, Spokane",
285-
"url": "https://www.meetup.com/python-spokane/events/308298845",
286-
},
287298
{
288299
"name": "Coffee and Code",
289-
"description": "Join us to talk code, work on coding projects, share knowledge, or just hang out.",
290-
"start_date_time": "2025-06-03T07:00:00",
291-
"end_date_time": "2025-06-03T08:00:00",
292-
"location": "Indaba Coffee, Spokane",
300+
"description": "Grab some coffee and write code, together. Every first Monday of the month, local tech enthusiasts meet at a coffee shop to collaborate on code, or just talk tech.",
301+
"start_date_time": "2025-05-05T07:00:00",
302+
"end_date_time": "2025-05-05T08:00:00",
303+
"location": "Indaba Coffee",
293304
"url": "https://www.meetup.com/python-spokane/events/306382744",
294305
},
295306
{
296-
"name": "Python for Beginners",
297-
"description": "An introductory workshop for those new to Python programming.",
298-
"start_date_time": "2025-06-29T10:00:00",
299-
"end_date_time": "2025-06-29T12:00:00",
300-
"location": "Limelight, Spokane",
301-
"url": "https://www.meetup.com/python-spokane/events/308298845",
307+
"name": "Coffee and Code",
308+
"description": "Grab some coffee and write code, together. Every first Monday of the month, local tech enthusiasts meet at a coffee shop to collaborate on code, or just talk tech.",
309+
"start_date_time": "2025-04-07T07:00:00",
310+
"end_date_time": "2025-04-07T08:00:00",
311+
"location": "Indaba Coffee",
312+
"url": "https://www.meetup.com/python-spokane/events/306368361",
302313
},
303314
{
304315
"name": "Coffee and Code",
305-
"description": "Join us to talk code, work on coding projects, share knowledge, or just hang out.",
306-
"start_date_time": "2025-05-03T07:00:00",
307-
"end_date_time": "2025-05-03T08:00:00",
308-
"location": "Indaba Coffee, Spokane",
309-
"url": "https://www.meetup.com/python-spokane/events/306382744",
316+
"description": "Grab some coffee and write code, together. Every first Monday of the month, local tech enthusiasts meet at a coffee shop to collaborate on code, or just talk tech.",
317+
"start_date_time": "2025-03-03T07:00:00",
318+
"end_date_time": "2025-03-03T08:00:00",
319+
"location": "Indaba Coffee",
320+
"url": "https://www.meetup.com/python-spokane/events/305925589",
310321
},
311322
{
312-
"name": "Advanced Python Techniques",
313-
"description": "A workshop for experienced Python developers to learn advanced techniques and best practices.",
314-
"start_date_time": "2025-05-15T10:00:00",
315-
"end_date_time": "2025-05-15T12:00:00",
316-
"location": "Intellitect, Spokane",
317-
"url": "https://www.meetup.com/python-spokane/events/308298845",
323+
"name": "Coffee and Code",
324+
"description": "Grab some coffee and write code, together. Every first Monday of the month, local tech enthusiasts meet at a coffee shop to collaborate on code, or just talk tech.",
325+
"start_date_time": "2025-02-03T07:00:00",
326+
"end_date_time": "2025-02-03T08:00:00",
327+
"location": "Indaba Coffee",
328+
"url": "https://www.meetup.com/python-spokane/events/305609285",
318329
},
319330
{
320331
"name": "Coffee and Code",
321-
"description": "Join us to talk code, work on coding projects, share knowledge, or just hang out.",
322-
"start_date_time": "2025-04-03T07:00:00",
323-
"end_date_time": "2025-04-03T08:00:00",
324-
"location": "Indaba Coffee, Spokane",
325-
"url": "https://www.meetup.com/python-spokane/events/306382744",
332+
"description": "Grab some coffee and write code, together. Every first Monday of the month, local tech enthusiasts meet at a coffee shop to collaborate on code, or just talk tech.",
333+
"start_date_time": "2025-01-06T07:00:00",
334+
"end_date_time": "2025-01-06T08:00:00",
335+
"location": "Indaba Coffee",
336+
"url": "https://www.meetup.com/python-spokane/events/305044389",
337+
},
338+
{
339+
"name": "Getting started with Pulumi",
340+
"description": "Ready to streamline your infrastructure management? Join us for our next meetup where we'll dive deep into Infrastructure as Code (IaC) using Pulumi with Python examples!",
341+
"start_date_time": "2025-07-23T17:30:00",
342+
"end_date_time": "2025-07-23T19:00:00",
343+
"location": "IntelliTect",
344+
"url": "https://www.meetup.com/python-spokane/events/309061819",
326345
},
327346
{
328-
"name": "Python in Data Science",
329-
"description": "A workshop focused on using Python for data science applications.",
330-
"start_date_time": "2025-04-20T10:00:00",
331-
"end_date_time": "2025-04-20T12:00:00",
332-
"location": "Limelight, Spokane",
347+
"name": "GitHub Copilot Global Bootcamp",
348+
"description": "Spokane Python User Group Update: Join Spokane DevOps Meetup This Month!",
349+
"start_date_time": "2025-06-19T13:00:00",
350+
"end_date_time": "2025-06-19T16:00:00",
351+
"location": "IntelliTect",
333352
"url": "https://www.meetup.com/python-spokane/events/308298845",
334353
},
354+
{
355+
"name": "From Data to Dream Home: A Data Scientist's Workflow in Python",
356+
"description": """What does a data scientist actually do from start to finish? In this demo, we walk through a full data science workflow using a real estate use case: finding the optimal house to buy.
357+
We'll cover data collection, exploratory analysis, feature engineering, model building, and interpretation — all with hands-on Python code. Along the way, you’ll see how tools like Pandas, scikit-learn, and visualization libraries come together to solve a real-world problem.
358+
Whether you're a data practitioner or just curious about applied data science, this talk will bring the process to life through a practical and engaging example around real estate.""",
359+
"start_date_time": "2025-05-20T17:30:00",
360+
"end_date_time": "2025-05-20T19:30:00",
361+
"location": "Burbity Workspaces - Sullivan Valley Commons",
362+
"url": "https://www.meetup.com/python-spokane/events/307606946",
363+
},
364+
{
365+
"name": "Community Show & Tell",
366+
"description": "Join us for an interactive Show & Tell event in collaboration with Launchpad INW! This is a relaxed and informal gathering where members of our local tech community are invited to present interesting projects, innovative ideas, or anything they're currently passionate about. Whether you're a seasoned developer, a budding entrepreneur, or just curious about the tech landscape, this event is for you! Come to present, network with fellow tech enthusiasts, or just discover the amazing things being built right here in Spokane.",
367+
"start_date_time": "2025-04-23T17:30:00",
368+
"end_date_time": "2025-04-23T19:30:00",
369+
"location": "Fuel Coworking",
370+
"url": "https://www.meetup.com/python-spokane/events/307187069",
371+
},
372+
{
373+
"name": "Join Us for a Special Python & Rust Meetup!",
374+
"description": "Are you interested in starting your next project in Python or Rust but unsure where to begin? Whether you're new to coding or looking to explore a new language, this event is for you!",
375+
"start_date_time": "2025-03-18T17:30:00",
376+
"end_date_time": "2025-03-18T19:30:00",
377+
"location": "Limelyte Technology Group, Inc.",
378+
"url": "https://www.meetup.com/python-spokane/events/306366620",
379+
},
380+
{
381+
"name": "Spokane Python User Group Monthly Meetup",
382+
"description": "This months meetup will be on a Wednesday 01/22. We are diverting from our regularly schedule date to join with the Spokane Go Users Group for an informal show and tell.",
383+
"start_date_time": "2025-01-22T17:30:00",
384+
"end_date_time": "2025-01-22T19:30:00",
385+
"location": "Limelyte Technology Group, Inc.",
386+
"url": "https://www.meetup.com/python-spokane/events/304921795",
387+
},
388+
{
389+
"name": "2024 Holiday Hangout",
390+
"description": "Hello Pythonistas! Join us for a jolly good time as our tech community comes together to celebrate the holiday season in style! Whether you're a coder, designer, tinkerer, or tech enthusiast, we’re all about festive cheer and good vibes.No presentation or topic this month, just a cool hang with your friends in the local tech community.",
391+
"start_date_time": "2024-12-17T18:00:00",
392+
"end_date_time": "2024-12-17T20:00:00",
393+
"location": "No-Li Brewhouse",
394+
"url": "https://www.meetup.com/python-spokane/events/304949560",
395+
},
335396
]
336397

398+
# Use ZoneInfo for timezone handling instead of pytz
399+
for event in events:
400+
# Parse and localize to PDT, then convert to UTC and format as ISO string
401+
start_dt = datetime.fromisoformat(event["start_date_time"]).replace(tzinfo=ZoneInfo("America/Los_Angeles"))
402+
end_dt = datetime.fromisoformat(event["end_date_time"]).replace(tzinfo=ZoneInfo("America/Los_Angeles"))
403+
event["start_date_time"] = start_dt.astimezone(ZoneInfo("UTC")).isoformat()
404+
event["end_date_time"] = end_dt.astimezone(ZoneInfo("UTC")).isoformat()
405+
337406
for event in events:
338407
Event.objects.get_or_create(
339408
name=event["name"],

0 commit comments

Comments
 (0)