Skip to content

Instantly share code, notes, and snippets.

View imomaliev's full-sized avatar

Sardorbek Imomaliev imomaliev

View GitHub Profile
imomaliev /
Last active January 12, 2024 14:13 — forked from jpadilla/
CharacterSeparatedManyField - A Django REST framework field that separates a string with a given separator into a native list and reverts a list into a string separated with a given separator.
from rest_framework import serializers
from rest_framework.fields import empty
from rest_framework.utils import html
class CharacterSeparatedField(serializers.ListField):
Character separated ListField.
Based on
Calculate second lowest cost silver plan (SLCSP) and produce result.csv.
import csv
from collections import defaultdict
def get_slcsp_zipcodes():
"""Get all zipcodes for slcsp research."""
imomaliev /
Last active July 18, 2021 17:52
google-api-python-client Credentails using social-auth
from datetime import datetime
from requests import exceptions as requests_errors
from google.auth.exceptions import RefreshError
from google.oauth2.credentials import Credentials as GoogleCredentials
from googleapiclient import discovery
imomaliev /
Last active May 28, 2018 04:19
Django multiple forms CBV
# coding: utf-8
from __future__ import unicode_literals, absolute_import
from django.http.response import HttpResponseForbidden, HttpResponseRedirect
from django.views.generic.base import TemplateResponseMixin, ContextMixin
from django.views.generic.edit import ProcessFormView
class MultiFormMixin(ContextMixin):
imomaliev / PyCharm CE python
Last active August 29, 2015 14:13
Pycharm python console, for ipython with preloaded models
import os
import sys
import django
print('Django %s' % django.get_version())
if 'setup' in dir(django): django.setup()
import django_manage_shell;