Anders (izzno / gooood) 🇳🇴
What?
Marko
the posts
Marko
and it is impossible to do it is set {% if forloop.counter|divisibleby:3 %}
Anders (izzno / gooood) 🇳🇴
Use wrap in stead
Anders (izzno / gooood) 🇳🇴
If you want the last two / one centered you could do that with som clever slicing and flex align to in your templates.
Marko
If you want the last two / one centered you could do that with som clever slicing and flex align to in your templates.
have tried the code from the answer https://stackoverflow.com/questions/43908072/css-flexbox-wrap-not-resizing-to-fit-contents but failed maybe you know what should be changed?
Marko
used before your advice trying flex
Anders (izzno / gooood) 🇳🇴
Bootstrap has flex too... You need to search within the frameworks you are using....
Marko
Ok will be trying
Marko
Thanks
Anders (izzno / gooood) 🇳🇴
https://getbootstrap.com/docs/4.0/utilities/flex/
the dark
this is my template
add media url in urls file
007
I'm getting error :- NOT FOUND : /media/media/1.jpg
007
Where 1.jpg is my image file
007
But media/ appears 2 time
Anonymous
How can we do external authentication in django where i have an external api which takes username and password and returns session id how can we map with django user
ʚɞÇherry Łoveʚɞ
what exactly external authentication mean ?
ʚɞÇherry Łoveʚɞ
what do you want to do ?
Anonymous
I have a third party login url which is based on basic authentication i need to use that success response and create session for mapped django user
ʚɞÇherry Łoveʚɞ
or try with this :
ʚɞÇherry Łoveʚɞ
https://docs.djangoproject.com/en/2.1/topics/auth/default/#django.contrib.auth.login
Anonymous
Third Party authentication is basic username and password. My login api will be using this third party to verify the login.
ʚɞÇherry Łoveʚɞ
Third Party authentication is basic username and password. My login api will be using this third party to verify the login.
do you use other external API with this authentication ? your API only verify the login ?
Anonymous
If the third party login returns a success response i need to allow it access resources to my django applications. either create a session for that user or token.
ʚɞÇherry Łoveʚɞ
you need cors header first.
Kowalski
I was following this tutorial: https://books.agiliq.com/projects/django-api-polls-tutorial/en/latest/more-views-and-viewsets.html
Kowalski
At the part where it says POST with data {"voted_by": 1}, i tried it on curl with this command: curl -H "Content-Type: application/json" -X POST -d '{"voted_by":2}' http://localhost:8000/polls/1/choices/1/vote
Kowalski
Its not working and i get an error {"detail":"JSON parse error - Expecting value: line 1 column 1 (char 0)"} Anyone know what this means? I couldn't figure it our. Sorry if its stupid :/
Anders (izzno / gooood) 🇳🇴
I'm getting error :- NOT FOUND : /media/media/1.jpg
dont include /media in your upload_to=, so upload_to="media/something" should be upload_to="something"
Sebuhi
so i want to display a table in admin area where both model fields will display
Define your models in admin.py then you will be able to see your models in admin admin.site.register(name of model)
Михаил
Hey guys! Is it possible to pass list of strings to DRF m2m relation? By default it requires list if dictionaries
Михаил
Like list of tags ['one', 'two'], which will resolve to Tag.name == 'one' + Tag.name == 'two'
Михаил
Ho do I get it function like this?
Михаил
Looks like found similar question https://stackoverflow.com/questions/52329266/django-rest-framework-create-or-update-values-from-json
007
Is it possible to create only one entry in table and each time instead of creating new entry the old one would get updated using ORM
cj
yes
007
Can you share me the code/article/blog
Ronan Felipe
I have a model representing a relationship between a User model and a Car model, with foreign key. I have a listview class that show all Cars objects. And also a detailview to show each Car in detail. I would like to in the detailview template to have a button to associate the current user to the car object represented in that detail view. Would be like the current user would be associating himself with that Car. So I'm not sure how to perform it, I'm since yesterday thinking about it. Do I need to create a new view to perform it, or can I make it inside my detailview? Do I need a form to represent it? Also I have some doubt about doing in a diferent view, because How I would get the Car ID outside of the detailview. I'm really confuse lol. Can anyone describe something to help me find the way? No code yet, just a guide so I can code when I get in home.
Ronan Felipe
I see, I'm going to read about how to get the car ID using the url inside another view. Thanks for the answer.
Guillermo
I see, I'm going to read about how to get the car ID using the url inside another view. Thanks for the answer.
In the template for the detail view you should have an object representing the car of which you are viewing the details. So if you declare an url like this path('<int:pk>/associate', views.associate_with_car, name='associate_with_car') you can then reference this url in the template (as link or as action for the form) like this {% url 'associate_with_car' car.pk %} assuming that car is the name of your car object. the view would then be like this: def associate_with_car(request, pk): where pk is the id of the car...
Ronan Felipe
I see it, awesome, thanks! I didn't knew that it's possible to do something like this {% url 'associate_with_car' car.pk %} inside the template to get the object pk.
Victor
Who maybe know the ready app "Stock" on Django for a shop? In this app I will accounting products/leaving/coming products
Abhi
anyone worked over setting up kibana alerts ?
Anonymous
Hii. who can tell me about top books of django?
Mario
Hi everybody!, How can I use composite keys for a model with Django ORM?
.
I want to create a watchlist in django. Using the user table and the table in have created. The table I have created is S_ID, S_name. Now one username can hold multiple s_id's. I.e. one to many relationship Blank = False Null = False I want the new model having username and S_I'd fields only to work on ! How could I do this ??
.
Unique ( username, S_ID)
{°_°}
Do I need another table to store category ? I wanted to receive items with category option?
Ronald
Anonymous
how to integrate ocr in Django
Googlom
http://bfy.tw/MHJG
KPK
@Sheeban wellcome
KPK
@vocalee wellcome
KPK
👍🏽
Sheeban
Anonymous
Hello everyone
sergio
Hi all. I am trying to minify the HTML using django-pipeline, and for this I add the middleware 'django.middleware.gzip.GZipMiddleware', 'pipeline.middleware.MinifyHTMLMiddleware'. The problem is that I render the html by showing me special characters like "\ n". I am doing something wrong?
sergio
I have searched about it and I have not found anything
Dipe
how-can-i-move-a-field-from-one-model-to-another-and-still-retain-the-data in django
Anders (izzno / gooood) 🇳🇴
how-can-i-move-a-field-from-one-model-to-another-and-still-retain-the-data in django
create the new field. Migrate the data in the database delete the old field
Kowalski
create the new field. Migrate the data in the database delete the old field
migration will only create and delete fields right? how will it retain the data?
cj
migration will only create and delete fields right? how will it retain the data?
create a custom function in the migration file (or create a custom migration), use migrations.RunPython or migrations.RunSQL
cj
to manage your data
cj
okay, so this way i can move data from model to model
in that stage, you can do whatever you want with your data
Kowalski
alright, thanks
Anders (izzno / gooood) 🇳🇴
Anders (izzno / gooood) 🇳🇴
Either by sql commands or a sql admin tool of sorts.
Anders (izzno / gooood) 🇳🇴
backup and try, restore and try again until you got it.
Anders (izzno / gooood) 🇳🇴
But for starters create the field in the other model and do a normal migration. Then you can move the data.
Kowalski
Okay
Kowalski
Which is better for integrating MongoDB: Mongoengine or Djongo? I read that mostly people use mongoengine (it uses ODM) but djongo lets you reuse the ORM in Django.