Given a sequence (queryset, generator, tuple, list) of dicts import them into the given model

def import_queryset(qs, dest_model,  clear=False, dry_run=True, verbosity=1):
    """Given a sequence (queryset, generator, tuple, list) of dicts import them into the given model"""

    # # FIXME: use this info to connect relationships, ignoring missing targets (unlike manage.py loaddata)
    # fields = dest_model._meta.get_fields_with_model()
    # fk_fields = [(f.name, f.related.parent_model, f.related.field) for (f, m) in fields if isinstance(f, ForeignKey)] 

    try:
        qs = qs.objects
    except:
        pass
    N = qs.count()

    if verbosity > 0:
        print('Loading %r records from the queryset provided...' % N)

    if clear and not dry_run:
        if verbosity > 0:
            print "WARNING: Deleting %d records from %r !!!!!!!" % (dest_model.objects.count(), dest_model)
        dest_model.objects.all().delete()
    if verbosity > 0:
        widgets = [pb.Counter(), '/%d rows: ' % N, pb.Percentage(), ' ', pb.RotatingMarker(), ' ', pb.Bar(),' ', pb.ETA()]
        pbar = pb.ProgressBar(widgets=widgets, maxval=N).start()
    i = 0
    dest_model._meta.get_all
    for d in qs.values():
        if verbosity > 2:
            print(repr(d))
        m = django_object_from_row(d, dest_model)
        if verbosity > 0:
            pbar.update(i)
            i += 1
            if verbosity > 2:
                print m
        if not dry_run:
            m.save()
    if verbosity > 0:
        pbar.finish()