I have this model classes:
class Article(models.Model):
[many fields]
class ArticleArchive(models.Model):
[same fields as Artilce model]
and I want to get objects from Article table and move it to ArticleArchive table:
articles = Article.objects.filter(date__year=2011)
for art in articles:
[and there moving objects]
How to do it?
articles = Article.objects.filter(date__year=2011).values()
for art in articles:
ArticleArchive.objects.create(**art)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With