Anonymous
I do use faker for random words though
Anonymous
does it matter?
Ghazwan
hmmm, no
Okay what does your __str__ (py3) return in your model ?
Anonymous
I don't understand
Anonymous
oh
Anonymous
value of name field of that model
Ghazwan
value of name field of that model
That should be the primary key for your foreign key automatically then
Anonymous
and
Anonymous
But I can query from any field of foreign key
Ghazwan
Would you mind showing us the code ? I still can't understand what's going on
Ghazwan
The foreignkey isn't in your model tables ?
Anonymous
wait
Anonymous
I'll send in an hour
Ghazwan
Okay
Anonymous
High Performance Django
Anonymous
wot
Anonymous
python != high performance
Anonymous
python == simple, easy, quick development
Anonymous
btw i am getting this weird error
Anonymous
DetailView is missing a QuerySet. Define DetailView.model, DetailView.queryset, or override DetailView.get_queryset().
Anonymous
should detailview have a queryset ?
inchidi
something like that
Anonymous
class ArticleDetailView(DetailView): model = Article queryset = Article.objects.all()
inchidi
why you define model?
Anonymous
why you define model?
this is detail view mate, i should define the model this detail view is dealing with
inchidi
yeah i know its detailview, but which model detail it is?
inchidi
ah okay you edit it
Anonymous
yeah i did not copy and paste, used to name if Post model
Anonymous
but it is actually article in this case
Anonymous
also in django 1.8
Anonymous
i used to write my detail view like so class ModelDetailView(): model = Model
inchidi
what happen when you delete model=Article?
Anonymous
Oh!
Anonymous
same error
Anonymous
after deleting model = Article
Anonymous
DetailView is missing a QuerySet. Define DetailView.model, DetailView.queryset, or override DetailView.get_queryset().
inchidi
okay try this class ArticleDetailView(DetailView): model=Article def get_queryset(self): qs=Article.objects.filter(id=self.kwargs.get('pk')) return qs
inchidi
your url must looks like '^article-detail/<pk>^' ...
Anonymous
sure
Anonymous
url(r'^article/(?P<pk>\d+)/$', views.ArticlesDetailView.as_view(), name='detail')
inchidi
same issue, i give up 😂
weird, are you sure your url calling correct view class which is ArticleDetailView?
Anonymous
thanks for help anyway
Anonymous
^^
inchidi
okay
inchidi
thats really weird since the one who throw that exception is get_queryset from django generics.DetailView
inchidi
so when you overriding it, it must not thrown except you call super().get_queryset()
Anonymous
Yeah i never worked with django long time ago
Anonymous
was working on django 1.8 and that gave no errors
Anonymous
now in django 1.11 smth happend apparently
Anonymous
i'll check dat out
Anonymous
@DimasInchidi sloved and the solution is even stranger
inchidi
how is it?
Anonymous
class ArticleListView(ListView, LoginRequiredMixin): model = Post template_name = 'blog/Article_list.html' def get_queryset(self): return Article.objects.filter(publish_date__lte=timezone.now()).order_by('-publish_date')
Anonymous
just changed the name of the function to get_context_data instead of get_queryset
Anonymous
in ArticleListView
inchidi
i thought you want single object, why you are using listview?
Anonymous
my detailview is still class ArticleDetailView(DetailView): model = Article
Anonymous
is there any other method ?
inchidi
maybe i"ll just post how i use listview>>detailview later
Anonymous
maybe i"ll just post how i use listview>>detailview later
mmm u list the elements and from each one users can navigate to the details , don't u ?
Anonymous
using url templating
Anonymous
wot
where can I download?
Anonymous
Anonymous
download wat ?
ebook High Performance Django?
Anonymous
ebook High Performance Django?
https://highperformancedjango.com/
Anonymous
buy it
فارس الأسمري
Is there any group for FLASK framework
فارس الأسمري
??
Ghazwan
Channels' promotion is prohibited here, so is asking for it.
Java Husky 🇬🇧🇺🇸
Anonymous
buy it
thank's