Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python
# coding: utf-8
import operator
def dayOfYear(year, month, day):
# we suppose input is always correct
if year % 4 == 0 and (year % 100 != 0 or year % 400 == 0):
monthDays = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
else:
@shymonk
shymonk / customize-save-in-django-admin-inline-form.org
Last active April 14, 2024 02:55
How to customize save in django admin inline form?

Customize Save In Django Admin Inline Form

Background

This is a common case in django ORM.

from django.db import models

class Author(models.Model):