Re: Using Primary key in two fields

2018-10-17 Thread Ігор Магур
As I saw earlier, Django does not allow you to have two rows as autofield, you can make your own save method for model. Ex. get first of YourModel.objects invert sorted by wanted field, add to it's value 1 and save ср, 17 жовт. 2018, 08:55 користувач Rakhee Menon пише: > Hi Everyone, > > I have

Re: Use tables from database with creating models

2018-10-15 Thread Ігор Магур
You can read how to generate models here: https://docs.djangoproject.com/en/2.1/howto/legacy-databases/ without models you'll need to write musch more code for managing and handling, and point of using django will be lost) вт, 16 жовт. 2018, 08:52 користувач Rakhee Menon пише: > > > I am sorry .

view must be a callable or a list/tuple in the case of include()

2018-10-12 Thread Ігор Магур
You need to import polls.views, and pass view.index into path func Ex from polls import views urlpatterns = [ path('polls/', views.index), ] -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving em

Re: Regarding static media setup

2018-10-11 Thread Ігор Магур
If you wrote something like this: if settings.DEBUG: # static files (images, css, javascript, etc.) urlpatterns += path(...) Make shure that you defined urlpatterns before, like urlpatterns = [], or probably missing definition sign. Need your's urls.py content for a correct answer)

Django Blog app (Error): __str__ returned non-string (type User)

2018-10-11 Thread Ігор Магур
Sorry correct return self.author.username -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send

Django Blog app (Error): __str__ returned non-string (type User)

2018-10-11 Thread Ігор Магур
In class Comment in str method you need to user.username or something you want as string, now you are returning full user object. Ex def __str__(self): return user.username -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from th