Anonymous
For example i have this method to convert file and I'd like to log if this user successfully convert it or nah. So, do i use logging module or just save it to my model 🤔
Anders (izzno / gooood) ๐ณ๐ด
file...
Anonymous
File?
Anders (izzno / gooood) ๐ณ๐ด
log it to a file.
Anders (izzno / gooood) ๐ณ๐ด
look at this:
Anders (izzno / gooood) ๐ณ๐ด
https://github.com/jsocol/django-adminplus
Anders (izzno / gooood) ๐ณ๐ด
All you need is to display a log file with current events on top right ?
Anders (izzno / gooood) ๐ณ๐ด
So something simulare.
Anonymous
No
Anders (izzno / gooood) ๐ณ๐ด
I'm out
Anders (izzno / gooood) ๐ณ๐ด
:)
Anonymous
I need to save that log to a model which referenced to user 😂
Anders (izzno / gooood) ๐ณ๐ด
Well then I dont get it, thats basic python
Anders (izzno / gooood) ๐ณ๐ด
hehe
Anders (izzno / gooood) ๐ณ๐ด
make a field for it, import the model in the function and save the ressult of the function
Anders (izzno / gooood) ๐ณ๐ด
Or make a model (on its own) with ressults and relate it towards the user.
Anonymous
😂 I want to know how to properly do it considering some function like converting_file(file) would accept file only but I'd like to know who's trying to convert it
Anders (izzno / gooood) ๐ณ๐ด
I think you should make a pastebin with some examples and we might understand what you want 😭
Anders (izzno / gooood) ๐ณ๐ด
hehe
Anders (izzno / gooood) ๐ณ๐ด
Its hard to help when I "assume" your knowledge / problem. ;)
Anonymous
I have a model call "ActionLog" then i have functions like
"converting_file(file)" , "converting_sound(sound)" ,
Basically if i want to save a log to my model i could do
ActionLog(user=user_object, log=log).save()
right
Anonymous
My question is what should i do if i want to log stuff inside
"converting_file" function
And save it to "ActionLog"
Anders (izzno / gooood) ๐ณ๐ด
There is no shortcut, you have to use ActionLog inside your function
Anders (izzno / gooood) ๐ณ๐ด
import ActionLog in the file containing converting_file
Anonymous
Then I'd need to pass user as another argument besides my file then?
Anders (izzno / gooood) ๐ณ๐ด
yes, but you can do it the other way around. Import converting_file in models and make a method.
Anonymous
How about import logging module
Anonymous
Can i make use of it and store it in database?
Anders (izzno / gooood) ๐ณ๐ด
again, what do you mean ?
Anders (izzno / gooood) ๐ณ๐ด
Just so you know, logs are "usually" not stored in DB's
Anonymous
I knewww
Anonymous
That's why im asking 😂
Anders (izzno / gooood) ๐ณ๐ด
Why dont you make a "main" log file and add lines as your program executes code ?
Anders (izzno / gooood) ๐ณ๐ด
Then just display that in admin.
Anonymous
Im confused
Anonymous
But thank you anyway
Anders (izzno / gooood) ๐ณ๐ด
again, paste your code and what you want it to do ;)
Anders (izzno / gooood) ๐ณ๐ด
Now, cooking...
Anders (izzno / gooood) ๐ณ๐ด
Anonymous
Would be a whole project lol 😂
Anders (izzno / gooood) ๐ณ๐ด
Yes... git?
Anders (izzno / gooood) ๐ณ๐ด
and BTW, I still dont understand what you want
Mirco
Anonymous
Me either
Alireza
I need some helpe.
I am searching a lot about hierarchical display, but I could not find any use full information.
Alireza
Please help me if anyone has any experience about django mptt
inchidi
Alireza
Wir have question and each question kann have one or more answers. Also each question kann have one or more sub question. Self join
Shubham
I am getting an error , while submitting the form, on submit it should redirect to post_detail.html...but it givin an erro
https://github.com/shubham1507/blog_project
Ghorz
You have an issue with 'reverse' either missing primary key or slug in kwargs={'pk':pk}
inchidi
Shubham
Okay
Shubham
inchidi
Shubham
inchidi
then you can try make it more specific by passing the parameter too with:
reverse('post_detail', kwargs={'pk': int(self.id)})
Shubham
Shubham
😐😢
inchidi
can you dpase.de full traceback from this page?
Shubham
Shubham
?
Shubham
http://dpaste.com/3QHGTRB
Shubham
@Inchidi
inchidi
http://dpaste.com/3QHGTRB
the problem is here: https://github.com/shubham1507/blog_project/blob/06c5b38475fcbdddeb68657a85394b1c4a452bf2/blog/templates/post_detail.html#L5
this is the correct one:{% url 'post_detail' pk=post.id %}
Shubham
inchidi
you're welcome
Shubham
How you debugged it using traceback
Shubham
?
inchidi
first, i read the traceback and searching when the exception raised, the result is when django try to render the page
inchidi
and the error also said Reverse for 'post_detail' with no arguments not found. that means, the error not raised by your Model.get_absolute_url() like i said earlier.
inchidi
with these information what should i do is reading your template which is post_detail.html
Shubham
Simply supp
Shubham
👍😁
Adonis
Hi mates.
Adonis
Please is it possible to make a post request to a TemplateView ?
Adonis
I am performing one but I get 405 not allowed error I want to know if there is a way to enable it
inchidi
Adonis
But i did it ... I had just to add the post() method to that view