Re: Import issue

2021-10-02 Thread Vineet Kothari
Hi,
 Did you check in python manage.py shell then try to import it and
check.

Thanks & Regards,
Vineet Kothari

On Sat, 2 Oct 2021, 10:12 am Malcolm MacKinnon,  wrote:

> Is your module included in your installed apps in the settings.py file?
>
> On Fri, Oct 1, 2021 at 8:09 PM Sophia Iroegbu 
> wrote:
> >
> > I noticed that each time I download a python package and import it.
> > It imports, it works but once I run my code it runs into an error.
> >
> > Error message: ModuleNotFoundError.
> >
> >
> > What do I do?
> >
> > --
> > 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/CAEa7H7eH_O_Zsi4KXMWbK%2B6pz-VAn8a%3DC6r43FRR0xEt-hrePQ%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/CAK8W3XohjqemaRi_KMprnqoweMjsbzhNjdGNiiKOKhdKTmwgDw%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/CAAcansvZ%3DZzgu1nY%3DsOf_SgErD5hia%3DrfVWZNDLHdGNAA1tqyg%40mail.gmail.com.


List Index out of Range

2021-10-02 Thread Eugene TUYIZERE
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/CABxpZHvXVqPzsFj3mq7Z0qHCSC-zMY_vuXAj8Hv%3Dxr2SMGu8Sw%40mail.gmail.com.


Re: Import issue

2021-10-02 Thread Sophia Iroegbu
Thanks it works

On Sat, Oct 2, 2021, 11:47 AM Vineet Kothari 
wrote:

> Hi,
>  Did you check in python manage.py shell then try to import it and
> check.
>
> Thanks & Regards,
> Vineet Kothari
>
> On Sat, 2 Oct 2021, 10:12 am Malcolm MacKinnon, 
> wrote:
>
>> Is your module included in your installed apps in the settings.py file?
>>
>> On Fri, Oct 1, 2021 at 8:09 PM Sophia Iroegbu 
>> wrote:
>> >
>> > I noticed that each time I download a python package and import it.
>> > It imports, it works but once I run my code it runs into an error.
>> >
>> > Error message: ModuleNotFoundError.
>> >
>> >
>> > What do I do?
>> >
>> > --
>> > 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/CAEa7H7eH_O_Zsi4KXMWbK%2B6pz-VAn8a%3DC6r43FRR0xEt-hrePQ%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/CAK8W3XohjqemaRi_KMprnqoweMjsbzhNjdGNiiKOKhdKTmwgDw%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/CAAcansvZ%3DZzgu1nY%3DsOf_SgErD5hia%3DrfVWZNDLHdGNAA1tqyg%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/CAEa7H7eEh5vXjCOsV5X7EqC6TbNT8QORVeCx0Ov_t%3DrLG4LkDA%40mail.gmail.com.


Re: List Index out of Range

2021-10-02 Thread bnmng
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.


Re: List Index out of Range

2021-10-02 Thread Hedrick Godson's
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.


Re: INPUT TEXT in grid

2021-10-02 Thread Gabriel Araya Garcia
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.com.


How to show views when an endpoint is called

2021-10-02 Thread Sophia Iroegbu
Hello guys, thanks for helping the last time.
I am trying to show course views on django admin.  Django is serving as an
API to a flutter app

Am i to create another endpoint to count views?

-- 
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/CAEa7H7fyFD-16-4%2BV%3Dt9HiAdvdxezNvi%3D4sdJEKwT0RwwLi7nw%40mail.gmail.com.


Proper way to create custom Group

2021-10-02 Thread Scot Hacker
It is possible to create a custom Group model in Django, although there is 
no `settings.AUTH_GROUPS_MODEL` equivalent to `AUTH_USER_MODEL`. When 
creating a custom Group system one can either inherit from the Django's 
`Group` model, or not. If you do, you still can use `user.groups.all()`. If 
you do not, you need to use a different related objects manager.

The question is this: I can't seem to find anywhere in the docs where 
Django recommends doing it one way or another. I've always thought that a 
custom group should subclass Group, and that is common, but some projects 
apparently don't do it that way.

I am asking because I am the maintainer of a reusable app that requires 
groups compatibility, and have come across an app that that uses a 
non-Django-derived groups system. 

Are there any best practices on this question in the Django docs or 
elsewhere?

Thanks,
Scot

-- 
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/b54c91b9-debe-4a2b-99fa-f982637568a2n%40googlegroups.com.