Re: Django path, Learn Django, Django document

2019-12-21 Thread John Bagiliko
This is one of the best Django CRUD tutorials you can find:
https://medium.com/@john.bagiliko/django-crud-web-application-77ef05af1f00

On Sat, Dec 21, 2019, 6:44 PM ramadhan ngallen  wrote:

> Okay you can visit JoinCfe via
> https://www.codingforentrepreneurs.com
>
> Or you can visit their youtube channel for videos too on
> https://m.youtube.com/codingentrepreneurs?sub_confirmation=1&uid=WEHue8kksIaktO8KTTN_zg
> On 21 Dec 2019, 21:24 +0300, Integr@te System ,
> wrote:
>
> Hi Friend,
>
> And as if you seeking for learning quickly search around for web basic
> html, css, js each other, example w3school.com... bc of they r combined web
> app together.
>
> When you held overview firmly with each part play its role, you can easily
> understand how Django codes to be put in html(syntax), python control
> behide (reference docs of expert propose previously), many great components
> necessary as well.
>
> Happy code.
>
> On Sat, Dec 21, 2019, 23:12 ramadhan ngallen  wrote:
>
>> Hello
>> You can use this link
>>
>> https://www.djangoproject.com
>> On 21 Dec 2019, 19:04 +0300, Root Video Dạo , wrote:
>>
>> Hello everyone!
>> I make this thread to find some advice to learn the Django framework.
>> I've learned about basic Python and want to learn about Web app using
>> Python but I couldn't find the path for this.
>> Someone can show me the PATH, DOCUMENT to learn Django.
>> Many thank!
>>
>> --
>> 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/5705e890-582d-46e4-8b6e-69d5d69b5259%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/4b55d4fa-8e76-4e51-afa1-87a813f72f1e%40Spark
>> 
>> .
>>
> --
> 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/CAP5HUWow1tcUSoKv7KnCsxi4e%3DXYOGvAdGd79MOJ8FX1czs-Kg%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/ca08d6fa-bf03-481d-8526-478873f0eb25%40Spark
> 
> .
>

-- 
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/CAC26BE1q_O9%2BvOp-bi8cxProduAgRHKj5Dggjg9zCc7emHxASg%40mail.gmail.com.


Re: Django - always getting False in form.is_valid()

2019-04-20 Thread John Bagiliko
Drop the html codes here please. Let one try it actually. It's difficult to
debug like this.

On Sat, Apr 20, 2019, 5:35 PM Sipum Mishra  wrote:

> Hi Vineeth,
>
> when I am trying to add 'add testing' through html form for todo list app
> getting this above form.is_valid() always False.
>
> On Sat, 20 Apr 2019 at 23:02, Sipum Mishra  wrote:
>
>> Hi Vineeth,
>>
>> please find below is the output ->
>>
>> > ['8V0Or1mvx2gtOa5fuYsdmAJ1o7SpGOcbSYulW0WMACHbrBhn8tOI0SO1z65MzXGx'],
>> 'Item': ['add tesing']}>
>>
>> On Fri, 19 Apr 2019 at 19:04, vineeth sagar 
>> wrote:
>>
>>> can you please post, request.POST output?
>>>
>>> On Fri, 19 Apr 2019, 16:34 Sipum Mishra,  wrote:
>>>
 Hi All,

 I am always getting - form.is_valid returning False. kindly check where
 I am doing wrong.
 please find below code.


 views.py
 ---
 def home(request):

 if request.method == 'POST':
 form = ListForm(request.POST or None)
 print(form.is_valid(), "-->",request.POST['Item'])
 print(form.errors)
 print(form)
 if form.is_valid():
 form.save()
 all_items = List.objects.all
 messages.success(request, ('Item has been Added to the List!'))
 return render(request,'home.html', {'all_items' : all_items})
 else:
 print("deba-->",request.POST)
 return HttpResponse("Form is invalid!")
 else:
 all_items = List.objects.all
 return render(request,'home.html', {'all_items' : all_items})

 -
 form.py
 -

 class ListForm(forms.ModelForm):
 class Meta:
 model = List
 fields = ["item", "completed"]


 
 model.py
 -

 class List(models.Model):
 item = models.CharField(max_length=200)
 completed = models.BooleanField(default=False)


 def __str__(self):
 return self.item + '|' + str(self.completed)

 --
 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 post to this group, send email to django-users@googlegroups.com.
 Visit this group at https://groups.google.com/group/django-users.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/django-users/4ca5e82d-f34b-4ab4-8f82-5be0dcdebecc%40googlegroups.com
 
 .
 For more options, visit https://groups.google.com/d/optout.

>>> --
>>> 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 post to this group, send email to django-users@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CAMMZq8OxVOJ8cF%3DFTNriHjBXKvdv29in-gOB-M-ia86L_ntSQw%40mail.gmail.com
>>> 
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAGHZBzwVAQOBoksQFVhUgBpC0bJyL4ZeahDHpKfxLpT6Z833TQ%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAC26BE36LumBC4uGcwJDFNBX-wOyBzjH57uKY9dxQ_G0tGNbDA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


How to ask questions on Django

2019-04-28 Thread John Bagiliko
Hi all,

I am a passionate Python Developer. I love Django. I have seen most of the
questions that are posed here and have tried to help. I usually fail to be
able to help for insufficient information. I think questions asked on this
group should have much information to help us know where one is coming
from, where one wants to go and what problem is stopping one from going
where he wants to go. More importantly, let's know your efforts and where
you've already looked and didn't succeed so you don't get suggestions about
what you've tried already and so on.
I like Stack Overflow for their strict rules. Check how I asked a question
on Stack Overflow and got answered in less than 30 minutes here
<https://stackoverflow.com/questions/52950760/django-manytomany-relationship-details-of-details>.
I also have this tutorial which I think can be a general solution to most
of of the questions asked here about forms, queries, CRUD activities etc.
See it here
<https://medium.com/@john.bagiliko/django-crud-web-application-77ef05af1f00?source=friends_link&sk=2f306ca42251f44828bf0ee27405dca0>


Best,
John

-- 
*Regards*

*JOHN BAGILIKO*
*MSc. Mathematical Sciences (Big Data and Computer Security)*
*African Institute for Mathematical Sciences (AIMS) | AIMS Senegal*

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAC26BE1EwPV-sd1E_otcj1CLXs%2BChp1VDemX2X6%3DMMfYAi%3DqbQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to pass context value from views.py to getElementById in JavaScript?

2019-05-03 Thread John Bagiliko
Dump this result into json and render it on a page. Use AJAX to get this
json data in JavaScript.

On Fri, May 3, 2019, 2:41 PM sachinbg sachin 
wrote:

> If u want to use that context in html means for I context ,I.user
> name,i.products like that u can use
>
> On Fri, May 3, 2019, 8:09 PM sachinbg sachin  wrote:
>
>> In JavaScript I don't know buddy
>>
>> On Fri, May 3, 2019, 6:33 PM Ravi Kumar >
>>> Try to use ajax
>>>
>>> On Fri 3 May, 2019 5:42 pm Mayur Bagul >>
 Hello community,

 I have stored single value from database inside a variable which is
 playing role of context inside views.py function.

 Now I want to use this context(which holds single value) in JavaScript
 to change specific HTML content of template which will give me desired
 webpage.

 I Searched on Google but I didn't found any useful tutorial or solution
 on specified problem.

 I'm looking forward to get solution from community.

 Thanking you.

 --
 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 post to this group, send email to django-users@googlegroups.com.
 Visit this group at https://groups.google.com/group/django-users.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/django-users/37395263-cf1d-4a7d-ad51-911e68da810b%40googlegroups.com
 .
 For more options, visit https://groups.google.com/d/optout.

>>> --
>>> 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 post to this group, send email to django-users@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CAANT8EFTTjuSXF5U87jX_VDwu6yMZpHN3GcbJ-7zBpTU5YPm2g%40mail.gmail.com
>>> 
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAOs61rwmtrTfUFJFnsq2j5THzy34_x3%3DK_LmX3d51MH_NCmxFA%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAC26BE3zOOX0sfNJ1UTohfmmNu1Ec0t0ZBU_k0icY9UQqh7t4g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to pass context value from views.py to getElementById in JavaScript?

2019-05-03 Thread John Bagiliko
import serializers from django.core
You can simply use the serializers.serialize method to do this. No need to
use Restframework.

On Fri, May 3, 2019, 3:25 PM John Bagiliko 
wrote:

> Dump this result into json and render it on a page. Use AJAX to get this
> json data in JavaScript.
>
> On Fri, May 3, 2019, 2:41 PM sachinbg sachin 
> wrote:
>
>> If u want to use that context in html means for I context ,I.user
>> name,i.products like that u can use
>>
>> On Fri, May 3, 2019, 8:09 PM sachinbg sachin > wrote:
>>
>>> In JavaScript I don't know buddy
>>>
>>> On Fri, May 3, 2019, 6:33 PM Ravi Kumar >>
>>>> Try to use ajax
>>>>
>>>> On Fri 3 May, 2019 5:42 pm Mayur Bagul >>>
>>>>> Hello community,
>>>>>
>>>>> I have stored single value from database inside a variable which is
>>>>> playing role of context inside views.py function.
>>>>>
>>>>> Now I want to use this context(which holds single value) in JavaScript
>>>>> to change specific HTML content of template which will give me desired
>>>>> webpage.
>>>>>
>>>>> I Searched on Google but I didn't found any useful tutorial or
>>>>> solution on specified problem.
>>>>>
>>>>> I'm looking forward to get solution from community.
>>>>>
>>>>> Thanking you.
>>>>>
>>>>> --
>>>>> 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 post to this group, send email to django-users@googlegroups.com.
>>>>> Visit this group at https://groups.google.com/group/django-users.
>>>>> To view this discussion on the web visit
>>>>> https://groups.google.com/d/msgid/django-users/37395263-cf1d-4a7d-ad51-911e68da810b%40googlegroups.com
>>>>> .
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>> --
>>>> 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 post to this group, send email to django-users@googlegroups.com.
>>>> Visit this group at https://groups.google.com/group/django-users.
>>>> To view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/django-users/CAANT8EFTTjuSXF5U87jX_VDwu6yMZpHN3GcbJ-7zBpTU5YPm2g%40mail.gmail.com
>>>> <https://groups.google.com/d/msgid/django-users/CAANT8EFTTjuSXF5U87jX_VDwu6yMZpHN3GcbJ-7zBpTU5YPm2g%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>> .
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>> --
>> 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 post to this group, send email to django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAOs61rwmtrTfUFJFnsq2j5THzy34_x3%3DK_LmX3d51MH_NCmxFA%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAOs61rwmtrTfUFJFnsq2j5THzy34_x3%3DK_LmX3d51MH_NCmxFA%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAC26BE2Qm%2BGPqK0rf%2BMq%3Du7WFua0fLZstfoU89FnLKVY3YjXOQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django issue with NoModuleError

2019-05-13 Thread John Bagiliko
Try this in samples/urls.py

from django.urls import path
from . import views

urlpatterns = [
 path(''",views.index, name='index'),
]

By the way, what is the error you are getting?
On Mon, May 13, 2019, 7:14 AM RLM  wrote:

> Hi Everyone.
> I have been away from Django for the past 18 months and am refreshing to
> use it for a complex samples storage project.
>
> Python 3.7, Django 2.2 the LTS fails with too many errors.
>
> Unfortunately I have had this particular error every time I try Django
> over the past 18 months which is why I had to resort to HuGo for a
> particular web site build.
>
> I feel there is something I have forgotten to do and will appreciate
> help understanding why it occurs.
>
> I have researched but no advice helps.
> I have seen pages on PYTHONPATH and the like but problem is not solved
> and it seems to have been an issue for at least a year.
>
> The project is called Storage, it's app is called samples.
>
> The problem I have is the ModuleNotFoundError: No module named 'samples'.
>
> Where samples is the only app.
>
> INSTALLED_APPS = [
>  'django.contrib.admin',
>  'django.contrib.auth',
>  'django.contrib.contenttypes',
>  'django.contrib.sessions',
>  'django.contrib.messages',
>  'django.contrib.staticfiles',
>  'samples',
>
> root urls/py is:
> urlpatterns = [
>  path('admin/', admin.site.urls),
>  path('samples/', include('samples.urls')),
> ]
>
> samples/urls.py is:
> from django.urls import path
> from . import views
>
> urlpatterns = [
>  path('',views.index, name='index'),
> ]
>
> There are no models.
>
> samples/views.py is:
> from django.shortcuts import render
> from django.http import HttpResponse
>
> def index(request):
>  return HttpResponse("Hello from the RMH App")
>
> Thanks for any help
> Cheers
> Roger
>
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/dee6f7a2-23e9-eaa7-052e-fb714dd7f3b4%40gmail.com
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAC26BE02jK937V6XhQXv4MtEGyeo%2BV%2BWpDgB4S%3D%2BHWmv9RxFFA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Novice questions about Pagination syntax and classes in general

2019-06-01 Thread John Bagiliko
I will answer question two. I'm not sure I understand your question 1. The
"objects" is query method of every Django model. You use it to query.
Contacts should be in your models.py and you should import  Contacts in
your views.py before you can use it.

On Sun, Jun 2, 2019, 1:08 AM drone4four  wrote:

> As part of the official Django doc on Pagination
> ,
> take a look at the listing function:
>
> def listing(request):
> contact_list = Contacts.objects.all()
> paginator = Paginator(contact_list, 25) # Show 25 contacts per page
>
>
> My two questions are:
>
>1.
>
>Is it possible to return more than one value when a function is
>assigned to a variable, like at line 3?
>2.
>
>At line 2, is `objects` a method within the Contacts class? If so,
>where is the Contacts class defined? It’s not imported at the top of the
>example views.py also in that Django doc above where I got this code 
> sample.
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/3540a14b-ef8a-4de3-ad59-858ca1c2a7c4%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAC26BE3NXuvsfiOiyF_OAdUXB%3D2nX5S9xEb_OT-8_2v5Zx1cBQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Accessing data from a 30 GB file in json format

2019-07-01 Thread John Bagiliko
What is the error message?

On Mon, Jul 1, 2019, 10:07 AM Nibil Ashraf  wrote:

> Hey,
>
> I have a file with a size of around 30GB. The file is in json format. I
> have to access the data and write that to a csv file. When I tried to do
> that with my laptop which has a a RAM of 4GB, I am getting some error. I
> tried to load the json file like this json_parsed = json.loads(json_data)
>
> Can someone help me with this? How should I do this? If I should go with
> some server, please let me know what specifications should I use?
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAPBZ7vD6Ai5DOAudytO7QeW1ejUqdqyB5YH3F7aTg4YoXtF-uw%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAC26BE3sEbrOUtx5zYcv_%2B5gwOg4Kw8zYQ-nJ1PUws%3DZMu_Asw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Accessing data from a 30 GB file in json format

2019-07-01 Thread John Bagiliko
A screenshot may be better

On Mon, Jul 1, 2019, 10:10 AM John Bagiliko 
wrote:

> What is the error message?
>
> On Mon, Jul 1, 2019, 10:07 AM Nibil Ashraf 
> wrote:
>
>> Hey,
>>
>> I have a file with a size of around 30GB. The file is in json format. I
>> have to access the data and write that to a csv file. When I tried to do
>> that with my laptop which has a a RAM of 4GB, I am getting some error. I
>> tried to load the json file like this json_parsed = json.loads(json_data)
>>
>> Can someone help me with this? How should I do this? If I should go with
>> some server, please let me know what specifications should I use?
>>
>> --
>> 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 post to this group, send email to django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAPBZ7vD6Ai5DOAudytO7QeW1ejUqdqyB5YH3F7aTg4YoXtF-uw%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAPBZ7vD6Ai5DOAudytO7QeW1ejUqdqyB5YH3F7aTg4YoXtF-uw%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAC26BE2Oxrc8kq%3DdfgH7880-h9qRmtjaJeoHmOw851x0WnxT5A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Help me fix this chat feature

2019-07-01 Thread John Bagiliko
Yes, use different incognito tabs for different users.

On Sun, Jun 30, 2019, 10:51 PM Aldian Fazrihady  wrote:

> I think if you run multiple users on the same PC,  you should use
> different browsers, or at least private/incognito mode.
>
> It is because Django gave one browser session to one user. If you are
> still  using one browser,  Django thinks only one user accessing the app.
>
> Regards,
>
> Aldian Fazrihady
>
> On Sun, 30 Jun 2019, 23:57 Rizqullah T,  wrote:
>
>> This is my pet project to build a skill exchange platform. For 3 days
>> I've been banging my head to make the chat working properly. Suppose I
>> logged in as user A then chat to user B, I open another window then logged
>> in as user B, but whenever I try to chat it will always connected to user
>> A. Check out here on github https://github.com/eryzerz/skill-x
>>
>> --
>> 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 post to this group, send email to django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/7bda08b9-f920-49b3-83f9-c51a149662e1%40googlegroups.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAN7EoAZBF7mv_TdtxdWgecMRbhK0N6CJ-kRS%3DTjJG-FBpVYSmQ%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAC26BE3-KuOjK%2BrmQTGCB_nXz6_mSoZUwwjQBc%3DZJX3dkvdRMA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django 2.2 Media files

2019-07-05 Thread John Bagiliko
Remove the upload_to in the model.

On Fri, Jul 5, 2019, 12:55 PM Michał Ratajczak 
wrote:

> Hi, i'm new in Django, I'm trying to configure media files correctly.
>
> That's in my model.py:
>
> class Question(models.Model):
> description = models.CharField(max_length=200)
> image = models.ImageField(upload_to='media/', null=True, blank=True)
>
>
> in settings.py:
>
> STATIC_URL = '/static/'
> MEDIA_URL = '/media/'
>
> ENV_PATH = os.path.abspath(os.path.dirname(__file__))
> STATIC_ROOT = os.path.join(ENV_PATH, '../public/static/')
> MEDIA_ROOT = os.path.join(ENV_PATH, '../public/media/')
>
> in urls.py:
>
> urlpatterns = [
> path('admin/', admin.site.urls),
> path('', include('barber.urls'))
> ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
>
> in view.py:
> def index(request):
> images = Question.objects.values('image')
> template = loader.get_template('barber/index.html')
> context = {
> 'images': images
> }
> return HttpResponse(template.render(context, request))
>
> I'am adding an image via admin site and next i render in template. Url for
> image is "media/image.png" bit file is in .../media/media/image.png, so i
> can't understand it. Can anyone help me ?
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/5613b376-575f-4ab0-bdff-368f0fe8f1cf%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAC26BE3pcXFhzuzWaUhE%3D8z_KGj1UeXKnJOqWQsRrXH-_7eo4g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django 2.2 Media files

2019-07-05 Thread John Bagiliko
Since you already configured static folder called media in settings.py, if
you specifify upload_to='/media', Django will create a folder 'media'
inside the media folder.

On Fri, Jul 5, 2019, 2:21 PM John Bagiliko 
wrote:

> Remove the upload_to in the model.
>
> On Fri, Jul 5, 2019, 12:55 PM Michał Ratajczak 
> wrote:
>
>> Hi, i'm new in Django, I'm trying to configure media files correctly.
>>
>> That's in my model.py:
>>
>> class Question(models.Model):
>> description = models.CharField(max_length=200)
>> image = models.ImageField(upload_to='media/', null=True, blank=True)
>>
>>
>> in settings.py:
>>
>> STATIC_URL = '/static/'
>> MEDIA_URL = '/media/'
>>
>> ENV_PATH = os.path.abspath(os.path.dirname(__file__))
>> STATIC_ROOT = os.path.join(ENV_PATH, '../public/static/')
>> MEDIA_ROOT = os.path.join(ENV_PATH, '../public/media/')
>>
>> in urls.py:
>>
>> urlpatterns = [
>> path('admin/', admin.site.urls),
>> path('', include('barber.urls'))
>> ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
>>
>> in view.py:
>> def index(request):
>> images = Question.objects.values('image')
>> template = loader.get_template('barber/index.html')
>> context = {
>> 'images': images
>> }
>> return HttpResponse(template.render(context, request))
>>
>> I'am adding an image via admin site and next i render in template. Url
>> for image is "media/image.png" bit file is in .../media/media/image.png, so
>> i can't understand it. Can anyone help me ?
>>
>> --
>> 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 post to this group, send email to django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/5613b376-575f-4ab0-bdff-368f0fe8f1cf%40googlegroups.com
>> <https://groups.google.com/d/msgid/django-users/5613b376-575f-4ab0-bdff-368f0fe8f1cf%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAC26BE1jsSya48W0dUgag8XW0eDLjbBjpZW8Ap97mRhq8geNgA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django 2.2 Media files

2019-07-06 Thread John Bagiliko
You need {{ item.image.url }} on your template since you are iterating
through the context you passed in views. I'm sure you did something like
this in views
def home(request)
images = Your_model.objects.all()
context = {'images': images}
return render(request, 'path_to/your/template', context)

On Fri, Jul 5, 2019 at 8:45 PM Michał Ratajczak 
wrote:

> Oh yeah! That's it ! Big thank's for you :)
>
> W dniu piątek, 5 lipca 2019 22:14:52 UTC+2 użytkownik Jani Tiainen napisał:
>>
>> Hi.
>>
>> What you did is correct and expected.
>>
>> Upload_to is relative path to MEDIA_ROOT in case of normal file upload
>> backend. There are many others like S3.
>>
>> Now MEDIA_URL is absolute path of web server which points to MEDIA_ROOT.
>> In development you can use static file serving trick like you did.
>>
>> Now when getting url in template you should use something like {{
>> image.url }} which should render correct absolute url to your  uploaded
>> file.
>>
>> HTH.
>>
>> pe 5. heinäk. 2019 klo 15.55 Michał Ratajczak 
>> kirjoitti:
>>
>>> Hi, i'm new in Django, I'm trying to configure media files correctly.
>>>
>>> That's in my model.py:
>>>
>>> class Question(models.Model):
>>> description = models.CharField(max_length=200)
>>> image = models.ImageField(upload_to='media/', null=True, blank=True)
>>>
>>>
>>> in settings.py:
>>>
>>> STATIC_URL = '/static/'
>>> MEDIA_URL = '/media/'
>>>
>>> ENV_PATH = os.path.abspath(os.path.dirname(__file__))
>>> STATIC_ROOT = os.path.join(ENV_PATH, '../public/static/')
>>> MEDIA_ROOT = os.path.join(ENV_PATH, '../public/media/')
>>>
>>> in urls.py:
>>>
>>> urlpatterns = [
>>> path('admin/', admin.site.urls),
>>> path('', include('barber.urls'))
>>> ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
>>>
>>> in view.py:
>>> def index(request):
>>> images = Question.objects.values('image')
>>> template = loader.get_template('barber/index.html')
>>> context = {
>>> 'images': images
>>> }
>>> return HttpResponse(template.render(context, request))
>>>
>>> I'am adding an image via admin site and next i render in template. Url
>>> for image is "media/image.png" bit file is in .../media/media/image.png, so
>>> i can't understand it. Can anyone help me ?
>>>
>>> --
>>> 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...@googlegroups.com.
>>> To post to this group, send email to django...@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/5613b376-575f-4ab0-bdff-368f0fe8f1cf%40googlegroups.com
>>> <https://groups.google.com/d/msgid/django-users/5613b376-575f-4ab0-bdff-368f0fe8f1cf%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/ce8050ee-be00-449d-86c5-7285888e6f2d%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/ce8050ee-be00-449d-86c5-7285888e6f2d%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
*Regards*

*JOHN BAGILIKO*
*MSc. Mathematical Sciences (Big Data and Computer Security)*
*African Institute for Mathematical Sciences (AIMS) | AIMS Senegal*

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAC26BE1F41X_25WqShPGZp%2Bpk%3DFJabD-hUisHrZBWTnTJrM3hg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: select records from a model in another django app

2019-07-30 Thread John Bagiliko
Import the model from the app of choice and use it as usual.

On Tue, Jul 30, 2019, 11:32 AM Nitin Kumar  wrote:

> Import another app model.
>
> On Tue, 30 Jul, 2019, 4:28 PM Perceval Maturure, 
> wrote:
>
>> i want to display  model data using a class based view from another model
>> in a different app.any idead
>>
>> --
>> 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/5529da22-0981-43ca-a98a-d13edcc5ba94%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/CAKzNicG9paZfyTWFqMD5hNxwrhT-FH1rKFqxA24oj%3DMprzQZtw%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/CAC26BE0uRUNeVi9wjC%2B8R3N9X2fA8_hswt%3DStt-x6jTbLqworw%40mail.gmail.com.


Re: select records from a model in another django app

2019-07-30 Thread John Bagiliko
I stand to be corrected

On Tue, Jul 30, 2019, 11:53 AM John Bagiliko 
wrote:

> Import the model from the app of choice and use it as usual.
>
> On Tue, Jul 30, 2019, 11:32 AM Nitin Kumar 
> wrote:
>
>> Import another app model.
>>
>> On Tue, 30 Jul, 2019, 4:28 PM Perceval Maturure, 
>> wrote:
>>
>>> i want to display  model data using a class based view from another
>>> model in a different app.any idead
>>>
>>> --
>>> 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/5529da22-0981-43ca-a98a-d13edcc5ba94%40googlegroups.com
>>> <https://groups.google.com/d/msgid/django-users/5529da22-0981-43ca-a98a-d13edcc5ba94%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
>> 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/CAKzNicG9paZfyTWFqMD5hNxwrhT-FH1rKFqxA24oj%3DMprzQZtw%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAKzNicG9paZfyTWFqMD5hNxwrhT-FH1rKFqxA24oj%3DMprzQZtw%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
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/CAC26BE218VXdczBfrQD4_CWEf-PyTUML-DgjBoTwdH%3DSmAaNkA%40mail.gmail.com.


Re: Recreating SQL query in ORM

2019-07-30 Thread John Bagiliko
Do you want to make this exact query in Django?
Then use Your_model.objects.raw("the query here except the last semi colon")

On Tue, Jul 30, 2019, 4:56 PM Jonathan Spicer 
wrote:

> Hello,
>
> I have an sql query that I would like to recreate using the ORM. Would it
> be possible for someone to give me some pointers.
>
> select count(*) as total,
>
> concat(loading_code,code1_code,code2_code,code3_code,code4_code) as seq,
>
> concat(loading_id,',',code1_id,',',code2_id,',',code3_id,',',code4_id) as
> ids
> from FullMatches where job_id = %s group by seq, ids order
> by total desc
>
> Thanks in advance.
>
> Johnny
>
> --
> 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/d91ae3ab-f111-4081-8a6e-26fad5a2f782%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/CAC26BE0cEq4c_UWcO9BKMThazgMEHOpLp3dXiU%2Bb_SNmPgU%2BSg%40mail.gmail.com.


Re: [Django] How to retrieve the saved password in raw format

2019-10-21 Thread John Bagiliko
It is so wrong to want to read the users
's password. I think this should not be done.

On Mon, Oct 21, 2019, 7:20 PM Alex Heyden  wrote:

> Password tables should never be human-readable. Never ever. No exceptions.
>
> If the intent is to power automation, store that password where the test
> agent can read it. If you don't know the password, reset it, then save it.
> Don't expect your web server to leak a password, though. Not even if you
> ask it nicely.
>
> On Mon, Oct 21, 2019 at 1:16 PM Dilipkumar Noone 
> wrote:
>
>> Dear Django group,
>>
>> In one of my View i need UserName & Password details in raw format but
>> Django uses *PBKDF2*  algorithm to
>> store the password.
>>
>> I would like to know how to retrieve the saved password from
>> Authentication Form.
>>
>> Using these Username and password details from my Django app , i need to
>> use the same credentials to access another website to perform web
>> automation on it using selenium chrome webdriver.
>>
>> Please let us know how to get the password in raw format once user
>> authenticated using below LoginForm and login_view.
>>
>> *My forms.py:*
>> *===*
>>
>> forms.py:
>> ===
>>
>> class LoginForm(AuthenticationForm):
>>
>> remember_me = forms.BooleanField(required=True, initial=False)
>>
>> def __init__(self, *args, **kwargs):
>>
>> super(LoginForm, self).__init__(*args, **kwargs)
>> self.helper = FormHelper()
>> self.helper.form_action = '.'
>> self.helper.layout = Layout(
>> Field('username', placeholder="Enter Username", autofocus=""),
>> Field('password', placeholder="Enter Password"),
>> Field('remember_me'),
>> Submit('sign_in', 'Log in',
>>css_class="btn btn-lg btn-primary btn-block"),
>> )
>>
>> def apply_gsp_request_form(request, id=None):
>>
>> if id:
>> action = 'edit'
>> model = get_object_or_404(ApplyGSP, pk=id)
>> else:
>> action = 'submit'
>> model = ApplyGSP()
>>
>> message = ""
>>
>> if request.method == 'POST':
>> form = ApplyGSPForm(request.POST, instance=model)
>>
>> if form.is_valid():
>> form.save()
>> username = request.user.username
>> print("password:", request.user.password)
>>* # How to get password details ? If i get pwd here using
>> request.user.password it is displaying
>> in $$$ format.*
>> * # but i need in raw(clear text format)*
>> *applyselenium*(username,password*)*
>>
>> *def applyselenium():*
>>   ---
>>   --
>>
>>
>> My Views.py:
>> ===
>> views.py:
>> 
>> def login_view(request):
>> logout(request)
>>
>> username = password = ''
>> redirect_to = request.GET.get('next', '/gspapp/')
>>
>> form = LoginForm()
>>
>> if request.POST:
>>
>> form = LoginForm(request.POST)
>>
>> username = request.POST['username']
>> password = request.POST['password']
>>
>> user = authenticate(request, username=username,
>> password=password)
>>
>> if user is not None:
>> login(request, user)
>>
>> remember_me = request.POST.get('remember_me', False)
>>
>> if remember_me == "on":
>> ONE_MONTH = 30 * 24 * 60 * 60
>> expiry = getattr(settings, "KEEP_LOGGED_DURATION",
>> ONE_MONTH)
>> request.session.set_expiry(expiry)
>> else:
>> request.session.set_expiry(0)
>>
>> return HttpResponseRedirect(redirect_to)
>>
>> context = {'form': form, 'page_title': page_title,
>> 'loginpage_heading': loginpage_heading}
>> return render(request, 'login.html', context)
>>
>>
>>
>>
>> Regards
>> N.Dilip Kumar.
>>
>> --
>> 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/11a515fc-8b06-4130-8a0d-5ab6c9a21497%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/CA%2Bv0ZYVQUxqqRbKM-2Wbiuia7d5uWFNWTAyuGH200LmnmnK2kg%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed t