Login

Tag "merge"

Snippet List

Model merging function

Generic function to merge model instances. Useful when you need to merge duplicate models together, e.g. for users. Based on http://djangosnippets.org/snippets/382/, with several enhancements: * *Type checking*: only Model subclasses can be used and testing that all instances are of same model class * *Handles symmetrical many-to-may*: original snippet failed in that case * *Filling up blank attrs of original when duplicate has it filled* * *Prepared to use outside of command-line*

  • django
  • model
  • generic
  • related
  • merge
Read More

update-django: Update your django git branches.

This is the (revamped) bash script I use to keep my git branches up-to-date with SVN to make my life a lot easier, just save it in a text file and read the instructions at the top! Hope it's useful to somebody else than me ;)

  • bash
  • merge
  • update
  • svn
  • git
Read More

duplicate model object merging script

Use this function to merge model objects (i.e. Users, Organizations, Polls, Etc.) and migrate all of the related fields from the alias objects the primary object. Usage: from django.contrib.auth.models import User primary_user = User.objects.get(email='[email protected]') duplicate_user = User.objects.get(email='[email protected]') merge_model_objects(primary_user, duplicate_user)

  • django
  • fields
  • model
  • generic
  • related
  • merge
  • duplicates
  • genericforeignkey
Read More

3 snippets posted so far.