–fake-initial vs –fake in Django migration?

Well the documentation is very clear about this –fake-initial Allows Django to skip an app’s initial migration if all database tables with the names of all models created by all CreateModel operations in that migration already exist. This option is intended for use when first running migrations against a database that preexisted the use of … Read more

Django: implementing JOIN using Django ORM?

This is exactly what select_related() does. The only gotcha is that you have to start with the Answer model, rather than Question, but the result is the same: answers = Answer.objects.filter(question_id=1).select_related() Now each answer object has a pre-fetched ‘question’ attribute, and accessing it won’t hit the db again.

Does Django queryset values_list return a list object?

The values_list method returns a ValuesListQuerySet. This means it has the advantages of a queryset. For example it is lazy, so you only fetch the first 25 elements from the database when you slice it. To convert it to a list, use list(). all_commenter_ids = PhotoComment.objects.filter(which_photo=which_photo).order_by(‘-id’).values_list(‘submitted_by’, flat=True)[:25] all_commenter_ids = list(all_commenter_ids) You might be able to … Read more

Django Admin ManyToManyField

Hmm, I don’t think you want inlines here. You want to be using the Django admin’s filter_horizontal: https://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.filter_horizontal class ProfileAdmin(UserAdmin) filter_horizontal = (‘opetest’,) That will give you the widget that you’re describing, used to add/remove Groups on the User Change page. Ok, based on your edits, updated answer – basically, what we have is a … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)