Groupon US' recognized holidays are:
- New Year’s Day
- Memorial Day
- Independence Day
- Labor Day
- Thanksgiving Day
- day after Thanksgiving
- day before Christmas
- Christmas Day
| ''' | |
| given a Model with: | |
| category = models.CharField(max_length=32, choices=CATEGORY_CHOICES) | |
| pubdate = models.DateTimeField(default=datetime.now) | |
| <other fields> | |
| Fetch the item from each category with the latest pubdate. | |
| ''' |
| """ | |
| module mydjangolib.bigint_patch | |
| A fix for the rather well-known ticket #399 in the django project. | |
| Create and link to auto-incrementing primary keys of type bigint without | |
| having to reload the model instance after saving it to get the ID set in | |
| the instance. | |
| Logs: |
Groupon US' recognized holidays are:
| # turn dict into an object that allows access to nested keys via dot notation | |
| # from http://stackoverflow.com/questions/3797957/python-easily-access-deeply-nested-dict-get-and-set | |
| # made three modifications: | |
| # --added `get()` method | |
| # --added `if not dict.__contains__...` to `__contains__()` | |
| # --can now accept None as key | |
| class dotdictify(dict): | |
| def __init__(self, value=None): | |
| if value is None: | |
| pass |
| # NOTE This is probably no longer needed, now DRF does this | |
| # automatically if you have ATOMIC_REQUESTS enabled. | |
| # https://github.com/encode/django-rest-framework/pull/2887 | |
| from django.db import transaction | |
| class AtomicMixin(object): | |
| """ | |
| Ensures we rollback db transactions on exceptions. |
If you use atom... download & install the following packages:
| # Since Safari 13 the Wikiwand plugin is no longer available and they | |
| # don't even list Safari as a supported browser anymore. | |
| # | |
| # Most people use some kind of ad blocker, and personally I'm using "AdGuard for Safari" which allows you | |
| # to define filters that inject javascript code on certain domains. | |
| # | |
| # Simply add this to AdGuards "User filter", and any wikipedia article will be redirected to Wikiwand. | |
| # | |
| @@||wikipedia.org^$generichide,badfilter |