(self, request)
| 482 | description="Get list of all supported timezones", |
| 483 | ) |
| 484 | def get(self, request): |
| 485 | import pytz |
| 486 | |
| 487 | # Get all common timezones (excludes deprecated ones) |
| 488 | all_timezones = sorted(pytz.common_timezones) |
| 489 | |
| 490 | # Group by region for better UX |
| 491 | grouped = {} |
| 492 | for tz in all_timezones: |
| 493 | if '/' in tz: |
| 494 | region = tz.split('/')[0] |
| 495 | if region not in grouped: |
| 496 | grouped[region] = [] |
| 497 | grouped[region].append(tz) |
| 498 | else: |
| 499 | # Handle special zones like UTC, GMT, etc. |
| 500 | if 'Other' not in grouped: |
| 501 | grouped['Other'] = [] |
| 502 | grouped['Other'].append(tz) |
| 503 | |
| 504 | return Response({ |
| 505 | 'timezones': all_timezones, |
| 506 | 'grouped': grouped, |
| 507 | 'count': len(all_timezones) |
| 508 | }) |
| 509 | |
| 510 | |
| 511 | # ───────────────────────────── |
no outgoing calls