Skip to content

Instantly share code, notes, and snippets.

View AndySun25's full-sized avatar

Andy Sun AndySun25

View GitHub Profile
import inspect
from datetime import timedelta
from rest_framework.settings import import_from_string
from api.models.user import ParentChildRelation
from gimi.celery import app
class UnknownNotificationError(BaseException):
@AndySun25
AndySun25 / polymorphic_related_queryset.py
Last active August 29, 2023 12:53
django-polymorphic select_related monkey patch
@AndySun25
AndySun25 / iblame
Last active January 31, 2018 14:56
Public version
#!/usr/bin/env bash
CONFIG_FILE=~/.iblame
if [ ! -e "$CONFIG_FILE" ] ; then
echo "Enter your name:"
read BLAMER
echo "BLAMER=${BLAMER}" >> ${CONFIG_FILE}
echo "Enter your webhook url:"
read BLAMES_TO
echo "BLAMES_TO=${BLAMES_TO}" >> ${CONFIG_FILE}
else
def test_filter_child_events_by_event_type(self):
InsertionFactory(account=children[0].transactional_account, created_by=parent)
transaction_content_type = ContentType.objects.get_for_model(Transaction)
self._test(children[0], status.HTTP_200_OK, set(children[0].events.all()[:10]))
self._test(children[0], status.HTTP_200_OK, set(children[0].events.filter(content_type=transaction_content_type)[:10]),
{'event_type': 'transaction'})
self._test(children[0], status.HTTP_200_OK, [], {'event_type': 'derp'})
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/nodejs', '/usr/bin/npm', 'run', 'manage', 'migrate' ]
2 info using npm@3.8.9
3 info using node@v6.1.0
4 verbose run-script [ 'premanage', 'manage', 'postmanage' ]
5 info lifecycle veckopengen-server@1.0.0~premanage: veckopengen-server@1.0.0
6 silly lifecycle veckopengen-server@1.0.0~premanage: no script for premanage, continuing
7 info lifecycle veckopengen-server@1.0.0~manage: veckopengen-server@1.0.0
8 verbose lifecycle veckopengen-server@1.0.0~manage: unsafe-perm in lifecycle true
9 verbose lifecycle veckopengen-server@1.0.0~manage: PATH: /usr/lib/node_modules/npm/bin/node-gyp-bin:/home/andy/Work/veckopengen-server/node_modules/.bin:/usr/bin:/home/andy/Work/venvs/dev/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
package models;
import javax.persistence.*;
import java.sql.Timestamp;
import java.util.Collection;
@Entity
@Table(name = "post")
public class Post {
@Id @GeneratedValue(strategy = GenerationType.IDENTITY)
Traceback (most recent call last):
File "C:\Python34\lib\site-packages\django\core\handlers\base.py", line 132, in get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "C:\Python34\lib\site-packages\django\views\decorators\csrf.py", line 58, in wrapped_view
return view_func(*args, **kwargs)
File "C:\Python34\lib\site-packages\rest_framework\viewsets.py", line 87, in view
return self.dispatch(request, *args, **kwargs)
File "C:\Python34\lib\site-packages\rest_framework\views.py", line 466, in dispatch
response = self.handle_exception(exc)
File "C:\Python34\lib\site-packages\rest_framework\views.py", line 463, in dispatch