How to retrieve data from different related model

2019-10-24 Thread Benedict Uwazie
I have an issue that I have been battling for a long time I want to get data out from different related models. I have three models. Category, Author, Post. The Category model categories my post that are on the Post model. The issue I am having is this, when I perform my loop on my template (i.e

Re: How to retrieve data from different related model

2019-10-24 Thread Manish Maurya
its not looking so clear. On Thu, 24 Oct 2019 at 17:21, Benedict Uwazie wrote: > I have an issue that I have been battling for a long time I > want to get data out from different related models. I have three > models. Category, Author, Post. The Category model categories my post > that are on t

Re: How to retrieve data from different related model

2019-10-24 Thread Umang Bisht
use select_related for querying related data from a model On Thu, Oct 24, 2019 at 5:22 PM Manish Maurya wrote: > its not looking so clear. > > > On Thu, 24 Oct 2019 at 17:21, Benedict Uwazie wrote: > >> I have an issue that I have been battling for a long time I >> want to get data out from dif

Django Rest Framework test fails or passes, depending on number of functions in APITestCase class

2019-10-24 Thread Conor
Hei all, I have an issue with a test class (APITestCase) where a function can pass the test if it is the only function within the class, or fail, if it is one of two or more functions. I have put this question on Stack Overflow where it is available with nicer formatting. https://stackoverfl

ElementTree problem saving images

2019-10-24 Thread Nuno Vieira
Hi, i receive an xml file and i am parsing the values and sving them to database. > XML Example: ... ... ... 9896 2019-07-11 13:12:09 BC30401 895000 EUR sale 0 0 0 915 Villa 37.134720 -8.020436 optional location detail Vilamoura Algarve Portugal 4 3 1 https://bc-villas.com/wp-content/up

How to retrieve data from different related model (This post was posted earlier on but was deleted due code not being clear)

2019-10-24 Thread Benedict Uwazie
*Please I am new to using google groups. This post have been posted earlier but the* *code was not clear enough* I have an issue that I have been battling for a long time I want to get data out from different related models. I have three models. Category, Author, Post. The Category model categor

Re: How to retrieve data from different related model (This post was posted earlier on but was deleted due code not being clear)

2019-10-24 Thread Gil Obradors
Hi, I don't know if I understand what you mean... Is this good for you? from first_app.models import Author, Category, Post def post_from_cat(request, cat_id): b = Category.objects.get(pk=cat_id) return render(request, 'first_app/index.html', {'key': b}) Missatge de Benedict Uwazie del dia dj.

Re: How to retrieve data from different related model (This post was posted earlier on but was deleted due code not being clear)

2019-10-24 Thread Benedict Uwazie
Thanks, but this did not help On Thursday, 24 October 2019 19:43:51 UTC+1, Gil Obradors wrote: > > Hi, > > I don't know if I understand what you mean... > > Is this good for you? > from first_app.models import Author, Category, Post > def post_from_cat(request, cat_id): > b = Category.objects.get(

Re: How to retrieve data from different related model (This post was posted earlier on but was deleted due code not being clear)

2019-10-24 Thread Gil Obradors
What field of Category you want to get from post model ? name? maybe k.category instead of k.name? ( template) Or explain better :P Missatge de Benedict Uwazie del dia dj., 24 d’oct. 2019 a les 21:19: > Thanks, but this did not help > > On Thursday, 24 October 2019 19:43:51 UTC+1, Gil Obradors

Re: Daphne behavior question: Application close timeout and caching

2019-10-24 Thread DeVonte Applewhite
Thanks. I found my answer in the Specification document. On Tuesday, October 22, 2019 at 9:41:23 PM UTC-6, WD Wang wrote: > > https://asgi.readthedocs.io/en/latest/specs/main.html#specification-details > here > is the spec for ASGI, you can check what the doc says. > > On Wed, Oct 23, 2019 at 7:

Re: ElementTree problem saving images

2019-10-24 Thread Jody Fitzpatrick
Would something like XMLTODICT help? https://pypi.org/project/xmltodict/ import xmltodict # Third Party data = "" parsed_data =xmltodict.parse(data) # do your data thing here... -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubsc

Re: ElementTree problem saving images

2019-10-24 Thread Arthur Antoine
The image urls are being set to None on every iteration where the id doesn't match. Try setting all of the urls to None before the loop, then remove the else blocks. On Thursday, October 24, 2019 at 11:28:00 AM UTC-4, Nuno Vieira wrote: > > Hi, > > i receive an xml file and i am parsing the valu

TypeError: api_view() takes from 0 to 1 positional arguments but 2 were given

2019-10-24 Thread chiyabgs
Project was working fine on macos. Now trying to host on linux. Getting this error on makemigrations / createsuperuser / runserver . @api_view(['GET'], ['POST']) TypeError: api_view() takes from 0 to 1 positional arguments but 2 were given ( full trace below): Other projects with similar fu

Maybe you can help me? Dynamic Admin Cache clearing/restarting?

2019-10-24 Thread Jody Fitzpatrick
I'm working on a project where the admin models are registered dynamically, this is including dynamically adding features like list_display, search_fields etc. The issue I'm having now is that when I make a change ( params are loaded from a database table ) it seems to be caching the response u

Error with urls

2019-10-24 Thread Harold Yamit Achipiz Quina
Hello everyone, I would like you to help me with this problem. I have two models Headquarters and Salon when I click on a venue {{headquarters.name}} list all the rooms that the headquarters has, when I want to edit a salon when saving the changes generates the following error: NoReverse

Re: TypeError: api_view() takes from 0 to 1 positional arguments but 2 were given

2019-10-24 Thread Jorge Gimeno
It looks like the call to @api_view should be like this: @api_view(['GET', 'POST']) In other words, pass in a single list of the permitted HTTP methods. Docs here: https://www.django-rest-framework.org/api-guide/views/#api_view -Jorge On Thu, Oct 24, 2019 at 5:01 PM chiyabgs wrote: > Project

Re: TypeError: api_view() takes from 0 to 1 positional arguments but 2 were given

2019-10-24 Thread chiyabgs
Thanks Jorge , this is working fine on my local (mac) but failing on the linux m/c hence getting confused but fixing it seems to have done the trick -Thanks again for the response. my first attempt posting on a group :-) BGS On Friday, October 25, 2019 at 5:58:13 AM UTC+5:30, jlgimeno71 wrote:

Re: How to retrieve data from different related model (This post was posted earlier on but was deleted due code not being clear)

2019-10-24 Thread Suraj Thapa FC
Try select_related() On Fri, 25 Oct, 2019, 1:15 AM Gil Obradors, wrote: > What field of Category you want to get from post model ? name? > maybe k.category instead of k.name? ( template) > > Or explain better :P > > > Missatge de Benedict Uwazie del dia dj., 24 d’oct. > 2019 a les 21:19: > >> T

Re: Maybe you can help me? Dynamic Admin Cache clearing/restarting?

2019-10-24 Thread Motaz Hejaze
Do you mean the frontend cash to view the generated sections ? On Fri, 25 Oct 2019, 2:00 am Jody Fitzpatrick, < jody.lee.fitzpatr...@gmail.com> wrote: > I'm working on a project where the admin models are registered > dynamically, this is including dynamically adding features like > list_display,