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 November 14, 2024 11:30
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):