Adam Johnson 
							
						 
					 
					
						
						
							
						
						6e36f7f784 
					 
					
						
						
							
							Fixed   #36383  -- Improved migration serialization for functools.partial objects.  
						
						
						
						
					 
					
						2025-05-13 21:42:19 -03:00 
						 
				 
			
				
					
						
							
							
								Adam Johnson 
							
						 
					 
					
						
						
							
						
						57fdc104d2 
					 
					
						
						
							
							Refs  #36383  -- Added extra tests for serializing functools.partial in tests/migrations/test_writer.py.  
						
						... 
						
						
						
						This includes a test helper to better assert over the expected output.
Co-authored-by: Natalia <124304+nessita@users.noreply.github.com > 
						
						
					 
					
						2025-05-13 21:42:19 -03:00 
						 
				 
			
				
					
						
							
							
								Adam Johnson 
							
						 
					 
					
						
						
							
						
						4647e2b866 
					 
					
						
						
							
							Refs  #36383  -- Extended DeconstructibleSerializer to support non-identifier keyword arguments.  
						
						... 
						
						
						
						In Python, keyword arguments must normally be valid identifiers (i.e.,
variable names that follow Python's naming rules). However, Python dicts
can have keys that aren't valid identifiers, like "foo-bar" or "123foo".
This commit ensures that keyword arguments that are nt valid
identifiers, are properly handled when deconstructing an object. 
						
						
					 
					
						2025-05-13 21:42:19 -03:00 
						 
				 
			
				
					
						
							
							
								Mikuláš Poul 
							
						 
					 
					
						
						
							
						
						494d2dc316 
					 
					
						
						
							
							Fixed   #36274  -- Added support for run_before and atomic in MigrationWriter.  
						
						
						
						
					 
					
						2025-04-16 10:20:49 +02:00 
						 
				 
			
				
					
						
							
							
								Song Junho 
							
						 
					 
					
						
						
							
						
						126417be43 
					 
					
						
						
							
							Fixed   #36265  -- Added support for serialization of ZoneInfo instances in migrations.  
						
						
						
						
					 
					
						2025-03-31 13:44:54 +02:00 
						 
				 
			
				
					
						
							
							
								Mariusz Felisiak 
							
						 
					 
					
						
						
							
						
						efb7f9ced2 
					 
					
						
						
							
							Refs  #36005  -- Used datetime.UTC alias instead of datetime.timezone.utc.  
						
						... 
						
						
						
						datetime.UTC was added in Python 3.11. 
						
						
					 
					
						2025-02-18 08:35:36 +01:00 
						 
				 
			
				
					
						
							
							
								Bendeguz Csirmaz 
							
						 
					 
					
						
						
							
						
						978aae4334 
					 
					
						
						
							
							Fixed   #373  -- Added CompositePrimaryKey.  
						
						... 
						
						
						
						Thanks Lily Foote and Simon Charette for reviews and mentoring
this Google Summer of Code 2024 project.
Co-authored-by: Simon Charette <charette.s@gmail.com >
Co-authored-by: Lily Foote <code@lilyf.org > 
						
						
					 
					
						2024-11-29 11:23:04 +01:00 
						 
				 
			
				
					
						
							
							
								Jacob Walls 
							
						 
					 
					
						
						
							
						
						4082a8886e 
					 
					
						
						
							
							Fixed   #35724  -- Tested migration commands handling of distributed namespace packages.  
						
						... 
						
						
						
						Also increased coverage of module_loading.py. 
						
						
					 
					
						2024-09-03 08:07:53 +02:00 
						 
				 
			
				
					
						
							
							
								David Sanders 
							
						 
					 
					
						
						
							
						
						06264258dc 
					 
					
						
						
							
							Fixed   #35175  -- Made migraton writer preserve keyword-only arguments.  
						
						... 
						
						
						
						Thanks Gerald Goh for the report. 
						
						
					 
					
						2024-02-09 09:37:13 +01:00 
						 
				 
			
				
					
						
							
							
								Natalia 
							
						 
					 
					
						
						
							
						
						691f70c477 
					 
					
						
						
							
							Fixed   #24561  -- Added support for callables on model fields' choices.  
						
						
						
						
					 
					
						2023-09-14 10:15:33 -03:00 
						 
				 
			
				
					
						
							
							
								Nick Pope 
							
						 
					 
					
						
						
							
						
						f92e68c30a 
					 
					
						
						
							
							Fixed   #34822  -- Added support for serializing functions decorated with functools.lru_cache in migrations.  
						
						... 
						
						
						
						`@functools.cache` and `@functools.lru_cache` return an object of type
`functools._lru_cache_wrapper` which prevented the migrations serializer from
working. Simply using the existing `FunctionTypeSerializer` for this additional
type works as expected. 
						
						
					 
					
						2023-09-13 15:57:18 -03:00 
						 
				 
			
				
					
						
							
							
								Nick Pope 
							
						 
					 
					
						
						
							
						
						c131949e3e 
					 
					
						
						
							
							Refs  #34822  -- Added tests for serializing decorated functions in migrations.  
						
						... 
						
						
						
						Functions decorated with a decorator that is properly wrapped, e.g. by
using `@functools.wraps`, are already supported. 
						
						
					 
					
						2023-09-13 15:39:56 -03:00 
						 
				 
			
				
					
						
							
							
								Nick Pope 
							
						 
					 
					
						
						
							
						
						500e01073a 
					 
					
						
						
							
							Fixed   #31262  -- Added support for mappings on model fields and ChoiceField's choices.  
						
						
						
						
					 
					
						2023-08-30 22:57:40 -03:00 
						 
				 
			
				
					
						
							
							
								Nicolò Intrieri 
							
						 
					 
					
						
						
							
						
						e8252fc445 
					 
					
						
						
							
							Fixed   #34716  -- Fixed serialization of nested class methods in migrations.  
						
						... 
						
						
						
						Co-authored-by: Nicolò <nicolo.intrieri@spinforward.it > 
						
						
					 
					
						2023-07-18 05:27:40 +02:00 
						 
				 
			
				
					
						
							
							
								Yury V. Zaytsev 
							
						 
					 
					
						
						
							
						
						02966a30dd 
					 
					
						
						
							
							Fixed   #34697  -- Fixed non-deterministic order of dependencies and sets/frozensets in migrations.  
						
						... 
						
						
						
						Co-authored-by: Dakota Hawkins <dakotahawkins@gmail.com > 
						
						
					 
					
						2023-07-12 12:33:23 +02:00 
						 
				 
			
				
					
						
							
							
								T. Franzel 
							
						 
					 
					
						
						
							
						
						a2eaea8f22 
					 
					
						
						
							
							Fixed   #34388  -- Allowed using choice enumeration types directly on model and form fields.  
						
						
						
						
					 
					
						2023-03-21 19:44:41 +01:00 
						 
				 
			
				
					
						
							
							
								Andy Chosak 
							
						 
					 
					
						
						
							
						
						b295b31171 
					 
					
						
						
							
							Fixed   #34420  -- Corrected the order of imports in generated migration files.  
						
						
						
						
					 
					
						2023-03-20 06:23:08 +01:00 
						 
				 
			
				
					
						
							
							
								Nick Pope 
							
						 
					 
					
						
						
							
						
						fd21f82aa8 
					 
					
						
						
							
							Refs  #34233  -- Used types.NoneType.  
						
						... 
						
						
						
						Available since Python 3.10 where it was reintroduced. 
						
						
					 
					
						2023-01-18 17:27:23 +01:00 
						 
				 
			
				
					
						
							
							
								Mariusz Felisiak 
							
						 
					 
					
						
						
							
						
						3bbe22dafc 
					 
					
						
						
							
							Fixed   #34233  -- Dropped support for Python 3.8 and 3.9.  
						
						
						
						
					 
					
						2023-01-18 09:46:01 +01:00 
						 
				 
			
				
					
						
							
							
								Mariusz Felisiak 
							
						 
					 
					
						
						
							
						
						d6816bff73 
					 
					
						
						
							
							Refs  #32365  -- Removed django.utils.timezone.utc per deprecation timeline.  
						
						
						
						
					 
					
						2023-01-17 11:49:15 +01:00 
						 
				 
			
				
					
						
							
							
								Mariusz Felisiak 
							
						 
					 
					
						
						
							
						
						e6f82438d4 
					 
					
						
						
							
							Refs  #32365  -- Removed support for pytz timezones per deprecation timeline.  
						
						
						
						
					 
					
						2023-01-17 11:49:15 +01:00 
						 
				 
			
				
					
						
							
							
								Willem Van Onsem 
							
						 
					 
					
						
						
							
						
						16fffc829c 
					 
					
						
						
							
							Fixed   #33916  -- Added support for serialization of enum.Flag in migrations.  
						
						
						
						
					 
					
						2022-08-25 06:43:48 +02:00 
						 
				 
			
				
					
						
							
							
								Willem Van Onsem 
							
						 
					 
					
						
						
							
						
						08688bd7dd 
					 
					
						
						
							
							Refs  #33916  -- Added tests for serialization of enum.Flag in migrations.  
						
						
						
						
					 
					
						2022-08-16 07:52:27 +02:00 
						 
				 
			
				
					
						
							
							
								Carlton Gibson 
							
						 
					 
					
						
						
							
						
						59ab3fd0e9 
					 
					
						
						
							
							Refs  #32365  -- Deprecated django.utils.timezone.utc.  
						
						
						
						
					 
					
						2022-03-29 14:47:44 +02:00 
						 
				 
			
				
					
						
							
							
								Carlton Gibson 
							
						 
					 
					
						
						
							
						
						bb61f0186d 
					 
					
						
						
							
							Refs  #32365  -- Removed internal uses of utils.timezone.utc alias.  
						
						... 
						
						
						
						Remaining test case ensures that uses of the alias are mapped
canonically by the migration writer. 
						
						
					 
					
						2022-03-24 06:29:50 +01:00 
						 
				 
			
				
					
						
							
							
								Carlton Gibson 
							
						 
					 
					
						
						
							
						
						d46e158ee2 
					 
					
						
						
							
							Refs  #32365  -- Made migration writer use datetime.timezone.utc.  
						
						
						
						
					 
					
						2022-03-23 12:43:43 +01:00 
						 
				 
			
				
					
						
							
							
								Mariusz Felisiak 
							
						 
					 
					
						
						
							
						
						7119f40c98 
					 
					
						
						
							
							Refs  #33476  -- Refactored code to strictly match 88 characters line length.  
						
						
						
						
					 
					
						2022-02-07 20:37:05 +01:00 
						 
				 
			
				
					
						
							
							
								django-bot 
							
						 
					 
					
						
						
							
						
						9c19aff7c7 
					 
					
						
						
							
							Refs  #33476  -- Reformatted code with Black.  
						
						
						
						
					 
					
						2022-02-07 20:37:05 +01:00 
						 
				 
			
				
					
						
							
							
								Mariusz Felisiak 
							
						 
					 
					
						
						
							
						
						c5cd878382 
					 
					
						
						
							
							Refs  #33476  -- Refactored problematic code before reformatting by Black.  
						
						... 
						
						
						
						In these cases Black produces unexpected results, e.g.
def make_random_password(
    self,
    length=10,
    allowed_chars='abcdefghjkmnpqrstuvwxyz' 'ABCDEFGHJKLMNPQRSTUVWXYZ' '23456789',
):
or
cursor.execute("""
SELECT ...
""",
    [table name],
) 
						
						
					 
					
						2022-02-03 11:20:46 +01:00 
						 
				 
			
				
					
						
							
							
								Allen Jonathan David 
							
						 
					 
					
						
						
							
						
						28c98d4113 
					 
					
						
						
							
							Fixed   #33216  -- Simpilified deconstructed paths for some expressions.  
						
						
						
						
					 
					
						2022-01-07 11:19:29 +01:00 
						 
				 
			
				
					
						
							
							
								Carlton Gibson 
							
						 
					 
					
						
						
							
						
						306607d5b9 
					 
					
						
						
							
							Fixed   #32365  -- Made zoneinfo the default timezone implementation.  
						
						... 
						
						
						
						Thanks to Adam Johnson, Aymeric Augustin, David Smith, Mariusz Felisiak, Nick
Pope, and Paul Ganssle for reviews. 
						
						
					 
					
						2021-09-16 12:11:05 +02:00 
						 
				 
			
				
					
						
							
							
								abhiabhi94 
							
						 
					 
					
						
						
							
						
						fde6fb2898 
					 
					
						
						
							
							Fixed   #32893  -- Fixed serialization of models.Model class in migrations.  
						
						... 
						
						
						
						Migrations assumed that an import of the models.Model class must
already be included when it's serialized, but for models with only
custom fields this was not necessarily the case.
Thanks Jaap Joris Vens for the report. 
						
						
					 
					
						2021-07-01 12:42:32 +02:00 
						 
				 
			
				
					
						
							
							
								Chris Jerdonek 
							
						 
					 
					
						
						
							
						
						7272e1963f 
					 
					
						
						
							
							Fixed   #32821  -- Updated os.scandir() uses to use a context manager.  
						
						
						
						
					 
					
						2021-06-07 06:52:42 +02:00 
						 
				 
			
				
					
						
							
							
								Nick Pope 
							
						 
					 
					
						
						
							
						
						d06c5b3581 
					 
					
						
						
							
							Fixed   #32366  -- Updated datetime module usage to recommended approach.  
						
						... 
						
						
						
						- Replaced datetime.utcnow() with datetime.now().
- Replaced datetime.utcfromtimestamp() with datetime.fromtimestamp().
- Replaced datetime.utctimetuple() with datetime.timetuple().
- Replaced calendar.timegm() and datetime.utctimetuple() with datetime.timestamp(). 
						
						
					 
					
						2021-05-12 11:08:41 +02:00 
						 
				 
			
				
					
						
							
							
								Nick Pope 
							
						 
					 
					
						
						
							
						
						6b7960188b 
					 
					
						
						
							
							Added extra assertion to migrations.test_writer.WriterTests.test_serialize_datetime.  
						
						... 
						
						
						
						This checks that datetime.timezone.utc serializes correctly. 
						
						
					 
					
						2021-05-12 11:06:30 +02:00 
						 
				 
			
				
					
						
							
							
								Nick Pope 
							
						 
					 
					
						
						
							
						
						074844e947 
					 
					
						
						
							
							Fixed   #31529  -- Added support for serialization of pathlib.Path/PurePath and os.PathLike in migrations.  
						
						
						
						
					 
					
						2020-06-24 11:45:34 +02:00 
						 
				 
			
				
					
						
							
							
								John Bowen 
							
						 
					 
					
						
						
							
						
						29d8198841 
					 
					
						
						
							
							Fixed   #27914  -- Fixed serialization of nested classes in migrations.  
						
						
						
						
					 
					
						2019-11-25 11:12:44 +01:00 
						 
				 
			
				
					
						
							
							
								John Bowen 
							
						 
					 
					
						
						
							
						
						8008795a38 
					 
					
						
						
							
							Refs  #23950  --- Moved test DeconstructibleInstances class to a module level.  
						
						... 
						
						
						
						DeconstructibleInstances was not importable from the asserted path. 
						
						
					 
					
						2019-11-25 11:05:09 +01:00 
						 
				 
			
				
					
						
							
							
								Hasan Ramezani 
							
						 
					 
					
						
						
							
						
						6452112640 
					 
					
						
						
							
							Refs  #27914  -- Fixed serialization of nested enum.Enum classes in migrations.  
						
						
						
						
					 
					
						2019-10-03 08:39:30 +02:00 
						 
				 
			
				
					
						
							
							
								Hasan Ramezani 
							
						 
					 
					
						
						
							
						
						d3030deaaa 
					 
					
						
						
							
							Refs  #27914  -- Moved test enum.Enum subclasses outside of WriterTests.test_serialize_enums().  
						
						
						
						
					 
					
						2019-10-03 08:39:30 +02:00 
						 
				 
			
				
					
						
							
							
								Hasan Ramezani 
							
						 
					 
					
						
						
							
						
						f0adf3b9b7 
					 
					
						
						
							
							Fixed   #30774  -- Made serialization in migrations use members names for Enums.  
						
						
						
						
					 
					
						2019-09-30 10:28:05 +02:00 
						 
				 
			
				
					
						
							
							
								Shai Berger 
							
						 
					 
					
						
						
							
						
						72ebe85a26 
					 
					
						
						
							
							Fixed   #27910  -- Added enumeration helpers for use in Field.choices.  
						
						... 
						
						
						
						These classes can serve as a base class for user enums, supporting
translatable human-readable names, or names automatically inferred
from the enum member name.
Additional properties make it easy to access the list of names, values
and display labels.
Thanks to the following for ideas and reviews:
Carlton Gibson, Fran Hrženjak, Ian Foote, Mariusz Felisiak, Shai Berger.
Co-authored-by: Shai Berger <shai@platonix.com >
Co-authored-by: Nick Pope <nick.pope@flightdataservices.com >
Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com > 
						
						
					 
					
						2019-09-04 14:42:49 +02:00 
						 
				 
			
				
					
						
							
							
								Florian Apolloner 
							
						 
					 
					
						
						
							
						
						2e38f2015a 
					 
					
						
						
							
							Fixed   #30350  -- Prevented recreation of migration for operations with a range object.  
						
						... 
						
						
						
						Thanks to Mariusz Felisiak for helping with the patch. 
						
						
					 
					
						2019-04-14 12:04:48 +02:00 
						 
				 
			
				
					
						
							
							
								Tim Graham 
							
						 
					 
					
						
						
							
						
						7e6b214ed3 
					 
					
						
						
							
							Fixed   #30116  -- Dropped support for Python 3.5.  
						
						
						
						
					 
					
						2019-01-30 10:19:48 -05:00 
						 
				 
			
				
					
						
							
							
								can 
							
						 
					 
					
						
						
							
						
						7d3b3897c1 
					 
					
						
						
							
							Refs  #29738  -- Allowed registering serializers with MigrationWriter.  
						
						
						
						
					 
					
						2019-01-11 18:13:16 -05:00 
						 
				 
			
				
					
						
							
							
								Tim Graham 
							
						 
					 
					
						
						
							
						
						8f4eee1777 
					 
					
						
						
							
							Moved django.db.migrations.writer.SettingsReference to django.conf.  
						
						... 
						
						
						
						Reduces the possibility of circular imports. 
						
						
					 
					
						2019-01-11 15:28:22 -05:00 
						 
				 
			
				
					
						
							
							
								Dakota Hawkins 
							
						 
					 
					
						
						
							
						
						8d3147e130 
					 
					
						
						
							
							Fixed   #30031  -- Added --no-header option to makemigrations/squashmigrations.  
						
						
						
						
					 
					
						2018-12-19 12:41:31 +01:00 
						 
				 
			
				
					
						
							
							
								Patrik Sletmo 
							
						 
					 
					
						
						
							
						
						adfdb9f169 
					 
					
						
						
							
							Fixed   #29814  -- Added support for NoneType serialization in migrations.  
						
						
						
						
					 
					
						2018-10-11 09:02:14 -04:00 
						 
				 
			
				
					
						
							
							
								Tim Graham 
							
						 
					 
					
						
						
							
						
						c72dde41e6 
					 
					
						
						
							
							Fixed   #29595  -- Allowed using timedelta in migrations questioner.  
						
						... 
						
						
						
						Refs #29600  -- Removed usage of django.utils.datetime_safe in migrations. 
						
						
					 
					
						2018-07-27 11:53:49 -04:00 
						 
				 
			
				
					
						
							
							
								Sergey Fedoseev 
							
						 
					 
					
						
						
							
						
						338f741c5e 
					 
					
						
						
							
							Fixed   #29546  -- Deprecated django.utils.timezone.FixedOffset.  
						
						
						
						
					 
					
						2018-07-09 16:33:36 -04:00