Abhi
whenever i am making a call to login function i am getting this error, https://dpaste.de/CmA1
Abhi
what might be the problem ?
Anonymous
You're sending string instead of integer
ππππ¬ππΎππππ
why would anyone use dajngo with Apache or nginx ? django use a python server, right?
Essa
ππππ¬ππΎππππ
so i will have to switch the server that django use when i deploy the web site 😩. though, i worked with Apache and Drupal for a while 😁
ππππ¬ππΎππππ
is it hard to make CMS like Drupal using Django?
Essa
I donβt know what drupal is
But there tones of them already made with Django
Essa
Val
Anonymous
Anonymous
Just use a wsgi compliant server on top of it
Anonymous
Guys, anyone working on any django project?
Anonymous
Because I would to join if anyone is working
Muhammed
ππππ¬ππΎππππ
i know that i will use get_context_data
inchidi
where you get the username?
ππππ¬ππΎππππ
from urls.py
ππππ¬ππΎππππ
it's passed as argument
inchidi
its named username? you can retrieve it by self.kwargs['username'] then
inchidi
ππππ¬ππΎππππ
so it will be like this:
class TestView(ListView):
model = Post
paginate_by = 12
context_object_name = 'posts'
def get_context_data(self, **kwargs):
user = User.objects.get(username=self.kwargs['username'])
context = super(TestView, self).get_context_data(**kwargs)
context['posts_num'] = Post.objects.filter(user=user).count()
context['followed_num'] = Follow.objects.filter(follower=user).count()
context['followers_num'] = Follow.objects.filter(followed=user).count()
return context
??
inchidi
inchidi
inchidi
ππππ¬ππΎππππ
this web site have really good tutorials
https://godjango.com/69-the-class-based-view/
Django Bot
>> Links
- Django tips wiki
- Getting to know the Django ORM | Opensource.com
Anonymous
sure
inchidi
noice i'll pm you
Aluma
hey
do you know an alternative for only() query on django 1.10?
Aluma
I tried values() and values_list() but it does not work 🙁
inchidi
Aluma
yeah
Aluma
and I get as output [{'field1':'attribute'}]
Aluma
liiterly
just the string 'attribute'
Aluma
and I want to get a list : ['value1', 'value2'], not a dict
Aluma
I did not understood you
inchidi
Aluma
(the db is salesforce)
Aluma
but
i can't get the right values with values()
look at the picture 🙁 I got the string 'attributes' as value while the keys are ok
Aluma
maybe it's a bug with salesforce?
inchidi
inchidi
just realize that using values_list better for this case
Aluma
ohhh I got it!!
the problem is with salesforce models
Aluma
salesforce models are not saved like a normal django models, so you can't query them like that
Aluma
https://stackoverflow.com/questions/2143438/is-it-possible-to-reference-a-property-using-djangos-queryset-values-list thats the answer
inchidi
nice
Aluma
thank you β€οΈ
Anonymous
Hi, i'm just beginning to learn django
i want to custom my users that register on my web app
like give rank to them or amount that pey for it and so on
should i write all stuff or i can inherit from django user auth module?
inchidi
Anonymous
inchidi
its model (database table) that have relationship with User (from django.contrib.auth.models import User)
Anonymous
Anonymous
You can use cache for that
Anonymous
Why did you delete that message?
Anonymous
@ErSoul
David
Oh, sorry, didn't get your answer on time (lag in here). But I thought I didn't ask the question correctly...
Django Bot
>> Blogs
- Django Logging, The Right Way
Anonymous
Anonymous
I guess so
David
Ok now I have a more concrete question:
Shouldn't HttpResponseRedirect render the template of the passed URL?
Note: the view that returns HttpResponseRedirect, renders a different template that the view called by HttpResponseRedirect
Anonymous
Anonymous
And redirect to the stated url
Anonymous
Then it's all upto the view which controls the stated link
David
🤔 the problem is that after the status 302, it gets the requested URL (according to the Firefox and python console) with: "GET /my/url/ HTTP/1.1" 200 4473
But does not render the page on my browser
David
But if I put manually that URL on my browser, it does render like it should.
Anonymous
Hmm
Anonymous
Can you show the network tab of developer tools of your browser after doing all this
David
OK, give me a minute
David
there it is!
Anonymous
I would have liked a bigger picture
Anonymous
With more dara
Anonymous
Nvm
Anonymous
You are making Ajax request I guess