feat: Add catogories, FN, website and GEO
This commit is contained in:
@@ -1,9 +1,13 @@
|
|||||||
{% for contact in contacts %}
|
{% for contact in contacts %}
|
||||||
BEGIN:VCARD
|
BEGIN:VCARD
|
||||||
VERSION:4.0
|
VERSION:4.0
|
||||||
N:{{contact.name}};;;;
|
N:{{contact.name|safe}};;;;
|
||||||
TEL;TYPE=work:{{ contact.phone_number }}
|
FN:{{contact.name|safe}}
|
||||||
|
{% if contact.location %}GEO:geo:{{contact.location.latitude}},{{contact.location.longitude}}
|
||||||
|
{% endif %}TEL;TYPE=work:{{ contact.phone_number }}
|
||||||
{% if contact.email %}EMAIL:{{ contact.email }}
|
{% if contact.email %}EMAIL:{{ contact.email }}
|
||||||
{% endif %}REV:{{ current_time|date:'Ymd' }}T{{ current_time|date:'His' }}T
|
{% endif %}REV:{{ current_time|date:'Ymd' }}T{{ current_time|date:'His' }}Z
|
||||||
END:VCARD
|
CATEGORIES:{{ categories }}
|
||||||
|
{% if contact.website %}URL:{{ contact.website }}
|
||||||
|
{% endif %}END:VCARD
|
||||||
{% endfor %}
|
{% endfor %}
|
@@ -118,9 +118,10 @@ def dedup_locations():
|
|||||||
def export_orgs_as_vcf():
|
def export_orgs_as_vcf():
|
||||||
rescue_orgs = RescueOrganization.objects.filter(phone_number__isnull=False)
|
rescue_orgs = RescueOrganization.objects.filter(phone_number__isnull=False)
|
||||||
result = render_to_string(template_name="fellchensammlung/contacts.vcf",
|
result = render_to_string(template_name="fellchensammlung/contacts.vcf",
|
||||||
context={"contacts": rescue_orgs, "current_time": timezone.now()})
|
context={"contacts": rescue_orgs,
|
||||||
|
"current_time": timezone.now(),
|
||||||
|
"categories": "Tierheim"})
|
||||||
filename = "contacts.vcf"
|
filename = "contacts.vcf"
|
||||||
with open(filename, "w") as f:
|
with open(filename, "w") as f:
|
||||||
f.write(result)
|
f.write(result)
|
||||||
print(f"Wrote {len(rescue_orgs)} contacts to {filename}")
|
print(f"Wrote {len(rescue_orgs)} contacts to {filename}")
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user