Tuesday, October 29, 2013

Tastypie valid lookups


exact
iexact
contains
icontains
in
gt
gte
lt
lte
startswith
istartswith
endswith
iendswith
range
year
month
day
week_day
isnull
search
regex
iregex

Ex:

class ThemeResource(ModelResource):
class Meta:
allowed_methods = ['get', 'put']
queryset = Theme.objects.all()
resource_name = 'theme'
filtering = {
'name': ['exact', 'icontains'],
'id':('exact'),
}

http://local.test:8000/api/v1/theme/?format=json&name__icontains=agenda

Monday, October 28, 2013

django Incorrect string value for object_repr

http://stackoverflow.com/questions/11497744/django-mysql-unicode-errors

ALTER TABLE django_admin_log MODIFY object_repr VARCHAR(200) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL;

Wednesday, October 16, 2013

Showing collation and setting collation MySQL



mysql> show full columns from [table];


ALTER TABLE [table] CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;