Skip to content

Instantly share code, notes, and snippets.

View mathjazz's full-sized avatar

Matjaž Horvat mathjazz

View GitHub Profile
Yes, you *can* import data from your local **SQLite** database into your **production PostgreSQL** database in a **Django + Wagtail** app — but you’ll need to be careful, especially with things like IDs, foreign keys, and data integrity.
Here’s a breakdown of your options and steps:
---
## ✅ Option 1: Use `manage.py dumpdata` + `loaddata`
### Step 1: Dump the data from SQLite
On your **local machine**, run:
What is the yearly gas consumption for heating a 100 m2 appartment in Slovenia with a ceiling height of 290 cm? The appartment is 200 years old, but has been renovated in 2023. It used floor heating, the windows are new and the walls (15 cm styrofoam) and the ceiling have been insulated.
Gas is also used for heating the sanitary water for 2 people.
Thanks for the detailed info — it really helps to give a more accurate estimate! Let’s break it down.
---
### 🔢 **Assumptions and Inputs:**
@mathjazz
mathjazz / patch.diff
Created January 13, 2025 20:29
Centralized Notification parsing logic
Sideshow:pontoon mathjazz$ git diff a0b431cff0b6844dd1ba9018010db4010e11497e 4575dbf4d09b79fbac72467b07b8337767e28e4c translate/
diff --git a/translate/src/context/BadgeTooltip.tsx b/translate/src/context/BadgeTooltip.tsx
index aaf56db37..e79b6dba0 100644
--- a/translate/src/context/BadgeTooltip.tsx
+++ b/translate/src/context/BadgeTooltip.tsx
@@ -1,49 +1,17 @@
-import { createContext, useEffect, useState } from 'react';
-import { Localized } from '@fluent/react';
-
-export type BadgeTooltipMessage = Readonly<{
diff --git a/pontoon/base/forms.py b/pontoon/base/forms.py
index 73fe2a93b..181cb2686 100644
--- a/pontoon/base/forms.py
+++ b/pontoon/base/forms.py
@@ -10,12 +10,10 @@ from django import forms
from django.conf import settings
from django.core.exceptions import ValidationError
from django.urls import reverse
-from django.utils import timezone
diff --git a/pontoon/base/forms.py b/pontoon/base/forms.py
index 27e1aaa5d..4c393b2a0 100644
--- a/pontoon/base/forms.py
+++ b/pontoon/base/forms.py
@@ -107,33 +107,54 @@ class UserPermissionLogFormMixin:
group.user_set.clear()
- before_count = self.user.badges_promotion_count
- now = timezone.now()
@mathjazz
mathjazz / search-panel.diff
Created July 22, 2024 20:09
search-panel.diff
diff --git a/translate/src/modules/search/components/SearchBox.tsx b/translate/src/modules/search/components/SearchBox.tsx
index f4cd3c37d..06e533e80 100644
--- a/translate/src/modules/search/components/SearchBox.tsx
+++ b/translate/src/modules/search/components/SearchBox.tsx
@@ -21,6 +21,7 @@ import { getAuthorsAndTimeRangeData } from '../actions';
import { FILTERS_EXTRA, FILTERS_STATUS } from '../constants';
import { FiltersPanel } from './FiltersPanel';
+import { SearchPanel } from './SearchPanel';
import './SearchBox.css';
Sideshow:pontoon mathjazz$ git diff pontoon/
diff --git a/pontoon/contributors/utils.py b/pontoon/contributors/utils.py
index 840efcb42..6600252ae 100644
--- a/pontoon/contributors/utils.py
+++ b/pontoon/contributors/utils.py
@@ -381,14 +381,16 @@ def get_project_locale_contribution_counts(contributions_qs):
for item in (
contributions_qs.annotate(
+ month=TruncMonth("created_at"),
@mathjazz
mathjazz / email_script_lr_94.py
Created April 18, 2024 09:58
Email Mozilla L10n event: LR-94
"""
Send email to all users who submitted at least 5 translations that are now approved in the last 12 months.
"""
from django.core.mail import EmailMultiAlternatives
from pontoon.base.models import *
from datetime import datetime
MIN_COUNT = 5
START_DATE = datetime(2023,4,15)
@mathjazz
mathjazz / email_script_lr_83.py
Created March 15, 2024 12:27
Email Mozilla L10n event: LR-83
"""
Send email to all users who submitted at least 5 translations that are now approved in the last 12 months.
"""
from django.core.mail import EmailMultiAlternatives
from pontoon.base.models import *
from datetime import datetime
MIN_COUNT = 5
START_DATE = datetime(2023,3,15)
@mathjazz
mathjazz / patch.diff
Created November 20, 2023 17:55
Fix for the 404 error
diff --git a/pontoon/contributors/views.py b/pontoon/contributors/views.py
index f47656815..ffea38cff 100644
--- a/pontoon/contributors/views.py
+++ b/pontoon/contributors/views.py
@@ -312,24 +312,29 @@ def settings(request):
all_locales.insert(0, default_homepage_locale)
# Set custom homepage selector value
- custom_homepage_code = profile.custom_homepage
- custom_homepage_locale = get_locale_or_redirect(