Re: INPUT TEXT in grid

2021-10-03 Thread Adeyemi Deji
Good to know that you now understand why ur code wasn't working and you
have learnt from asking questions. We always here for you. Peace

On Sun, Oct 3, 2021, 1:44 AM Gabriel Araya Garcia <
gabrielaraya2...@gmail.com> wrote:

> Thanks for your help, My problem I've solved. David Nugent says that the
> template must be built with using 'POST', and also the grid (table) is from
> database table, then the name  in each row I put the ID (numeric),
> therefore in view get the value with:
> valor_saca = request.POST.get(str(sigma.id_reg)) # obligadamente debe ser
> string
> Here is important the 'str', it must be string (chracter, or no numeric)
>
> (Excuse me my english )
> Regards
>
>
> El miércoles, 29 de septiembre de 2021 a las 16:58:11 UTC-3,
> adeyem...@gmail.com escribió:
>
>> Based on my observation. Your form doesn't have it's href attribute,
>> secondly in the view, the function should ve a post method and not get,
>> thirdly back to the template, u should have a name attribute for ur input
>> tag which u do but the value should be an arbitrary name or any name of ur
>> choice as a string which u will use to reference in the view function.
>>
>> Little modification to ur view function:
>> To reference the input name attribute lets give it a value called para.
>>
>> def parasalidaView(request):
>> if request.method == 'POST'
>> parasalida = Parasalida.objects.all()
>> a_prueba = []
>> for cue in parasalida:
>> data = request.POST.get('para')
>> a_prueba.append(data)
>>
>>
>>
>> On Wed, 29 Sep 2021, 00:38 David Nugent,  wrote:
>>
>>> Request.GET can't apply when processing a POST request.
>>>
>>> You are quoting 'cur.id_reg' when accessing the GET (should be POST)
>>> params and it probably should not be - you need to access the "name"
>>> attribute that your form uses. You should also be using cleaned_data
>>>  after using
>>> proper form validation, and in this case you should probably be using a f
>>> ormset  
>>> instead
>>> of manually generating a multiple record input form.
>>>
>>> HTH, David
>>>
>>> On Wed, Sep 29, 2021 at 7:15 AM Gabriel Araya Garcia <
>>> gabriela...@gmail.com> wrote:
>>>
 I have one grid

 

 {% for pr in parasalida %}
   
 {{ pr.estado}}
 {{ pr.fecha_ing|date:'d-m-Y'}}
 {{ pr.lote}}
 {{ pr.oc_ascoex}}
 {{ pr.cantidad}}
 {{ pr.extraida}}
 >>> name='{{pr.id_reg}}' class='saca' value="{{saca_x}}" placeholder='0'/>

   
 {% endfor %}

 but, I don't know how to get the value in view:

 parasalida = Parasalida.objects.all()
 a_prueba = []
 for cur in parasalida:
 saca_x = request.GET.get('cur.id_reg') #  template's value
 according to name property
 a_prueba.append(saca_x)

 The list is full with  [None,None,None,..]

 All others fields are already with values. The only values that user
 input is "input text"

 Thank for your help

 --
 You received this message because you are subscribed to the Google
 Groups "Django users" group.
 To unsubscribe from this group and stop receiving emails from it, send
 an email to django-users...@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/django-users/a2ba10d5-639e-4a08-88fe-a4206e18c249n%40googlegroups.com
 
 .

>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users...@googlegroups.com.
>>>
>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CAE5VhgWG3AjQD_vASX%3DG%2BpgmNdg9FVc6VSEn-dCf%3DjiNuPncwQ%40mail.gmail.com
>>> 
>>> .
>>>
>> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/6ffed308-dcbb-4849-b67d-7ac2878b82cbn%40googlegroups.c

Where are you deploying Django App? How much does it cost for a hobby project

2021-10-03 Thread Avi Mehenwal
Hello! I am building a prototype Django app and would like to deploy it so 
that people can use it.
What would be the most cost-effective and cheapest deployment solution to 
host a django backend? How much would it cost?
Any ideas, help is most welcomed and appretiated

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4b731458-38a3-4eeb-980d-ac4477bbc7f7n%40googlegroups.com.


Re: New to Django

2021-10-03 Thread bnmng
I think you'll get a few opinions on this.  My opinion is no.  I feel the 
docs are very good but difficult to understand as a beginner.  I like 
Mozilla's into with the Local Library tutorial to get 
started https://developer.mozilla.org/en-US/docs/Learn/Server-side/Django

On Friday, October 1, 2021 at 11:09:04 PM UTC-4 richluet...@gmail.com wrote:

> Hi, I want to learn django very well but tutorials like youtube videos, 
> books and pay for online courses are not really satisfying me that much . 
> So if I decide to learn django directly from the documentation will I learn 
> good enough to Intermediate and Advance level ?  if yes please help me with 
> an order path to follow. Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a928d80a-eaf4-495e-8e0f-abc46ba3c9a0n%40googlegroups.com.


Reverse look fails when importing from the admin for an app

2021-10-03 Thread Derek
My pytest suite is currently not working, as the reverse lookup is failing
for admin views; for example, trying to access
`reverse('admin:myapp_mymodel_changelist')` or
`reverse_lazy('admin:myapp_mymodel_changelist')`.

I have narrowed down the cause to the trigger being *any* kind of import
being made from the `admin.py` code for that app; the available URLs are
still there for all the other apps but *not* for the one being imported.

In `django/urls/resolvers.py` package, the available possible matches are
determined here:

possibilities = self.reverse_dict.getlist(lookup_view)

And one can add a debug statement which shows all the keys:

keys = [key for key in [*self.reverse_dict] if isinstance(key, str)]
print(keys)

Some basic test code, which I run in the Django shell, demonstrates how the
failure is triggered, and shows that this is not an artefact related to the
tests themselves:

from django.core.urlresolvers import reverse_lazy
from myapp.admin import MyModelAdmin
print(reverse_lazy('admin:myapp_mymodel_changelist'))

But this passes:

from django.core.urlresolvers import reverse_lazy
print(reverse_lazy('admin:myapp_mymodel_changelist'))

i.e. if I comment out the import line the code works, otherwise it fails.

Any ideas on why Django is failing when importing from the app's admin?

Thanks
Derek

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAF1Wu3Mdz08vD74vsBWQOT1UNDTqRXOV0C57rz%3DiXXH-TPiFCA%40mail.gmail.com.


Re: List Index out of Range

2021-10-03 Thread Lalit Suthar
Adding to above 2 answers index error may also occur when your
time_frame_list or responsible_list does not have the same number of items
as your input_list. You should try bnmng' s answer also
> Which line in your code is triggering the error?

you check it with simple print statements or using a debugger in vscode, or
with ipdb.set_trace()


On Sun, 3 Oct 2021 at 05:50, Hedrick Godson's 
wrote:

> Make sure you fill all the inputs with list and also make sure that you
> provide the correct input name to request.POST.getlist() method otherwise
> it will returns empty list which will raise IndexError
>
> On Sun, 3 Oct 2021, 03:13 bnmng,  wrote:
>
>> Which line in your code is triggering the error?
>>
>> On Saturday, October 2, 2021 at 11:07:13 AM UTC-4 eugenet...@gmail.com
>> wrote:
>>
>>> Good day all,
>>>
>>> I need assistance. Am trying to save data from the below form but I am
>>> getting *list out of range* error
>>>  can someone help me to write a successful save function?
>>>
>>> here is the code I am using:
>>>
>>>
>>> def submit_work(request):
>>> if request.method != "POST":
>>> return HttpResponse("Method Not Allowed")
>>> else:
>>> pillar_id=request.POST.get("pillar")
>>> object_id=request.POST.get("objects")
>>> output_id=request.POST.get("output")
>>> activity_id=request.POST.get("activity")
>>> input_list=request.POST.getlist("input[]")
>>> time_frame_list=request.POST.getlist("timeframe[]")
>>> responsible_list=request.POST.getlist("responsible[]")
>>> j=0
>>> for inp in input_list:
>>> wf=WORKFRAMS(pillar_id=pillar_id,object_id=object_id,output_id=output_id
>>> ,activity_id=activity_id,
>>> input=inp,time_frame=time_frame_list[j],responsible=responsible_list[j])
>>> wf.save()
>>> j=j+1
>>> return HttpResponse("OK")
>>>
>>>
>>>
>>> [image: image.png]
>>>
>>> Regards,
>>>
>>> *TUYIZERE Eugene*
>>>
>>>
>>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/8d69a634-0a2d-42e3-994c-5e19f88a799en%40googlegroups.com
>> 
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAJAxQD%3Dw6GmZkS%2BPJs%2BJp21Z4Mn3pDS7XbxXp%2BBhLB1Rf3k7wg%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGp2JVEecPWditPgWcGWKpx%2BqPz9owKtGfU%2BOUpWbGvTgUtuAw%40mail.gmail.com.