Skip to content

Instantly share code, notes, and snippets.

View efimerdlerkravitz's full-sized avatar

Efi Merdler-Kravitz efimerdlerkravitz

View GitHub Profile
@efimerdlerkravitz
efimerdlerkravitz / TextWriterTextView.kt
Created February 22, 2018 12:40
TypeWriter animation effect in Android
package com.example.uicomponents
import android.content.Context
import android.os.Handler
import android.util.AttributeSet
import android.widget.TextView
class TypeWriteTextView(context: Context?, attrs: AttributeSet?) : TextView(context, attrs) {
private var textList: List<String> = emptyList()
@efimerdlerkravitz
efimerdlerkravitz / admin.py
Created January 31, 2018 13:25
Edit a many-to-many relationship (ManyToManyField) on the Django Admin change list page.
class BookChangeList(ChangeList):
def __init__(self, request, model, list_display, list_display_links,
list_filter, date_hierarchy, search_fields, list_select_related,
list_per_page, list_max_show_all, list_editable, model_admin):
super().__init__(request, model, list_display, list_display_links,
list_filter, date_hierarchy, search_fields, list_select_related,
list_per_page, list_max_show_all, list_editable, model_admin)
# these need to be defined here, and not in BookAdmin
self.list_display = ('name', 'categories')
@efimerdlerkravitz
efimerdlerkravitz / admin.py
Created January 31, 2018 13:24
Edit a many-to-many relationship (ManyToManyField) on the Django Admin change list page.
class BookChangeList(ChangeList):
def __init__(self, request, model, list_display, list_display_links,
list_filter, date_hierarchy, search_fields, list_select_related,
list_per_page, list_max_show_all, list_editable, model_admin):
super().__init__(request, model, list_display, list_display_links,
list_filter, date_hierarchy, search_fields, list_select_related,
list_per_page, list_max_show_all, list_editable, model_admin)
# these need to be defined here, and not in BookAdmin
self.list_display = ('name', 'categories')