Re: formfield_overrides doesn't work

2019-05-11 Thread Tim Johnson
* Tim Johnson  [190511 11:20]:
> django 2.1.5 with python 3.7.2
> 
> I have a models.py class as follows:
> class Article(models.Model):
> title = models.CharField(max_length=255,)
>
> And I want to override the rendered default size attribute to 100 in
> the input/text form field.
> 
> the template rendering is done as follows
> 
> {% csrf_token %}
> {{ form.as_p}}
> Save
> 
> 
> in the application admin.py I have the following:
> class ArticleAdmin(admin.ModelAdmin):
> formfield_overrides = {
> models.CharField: {'widget': TextInput(attrs={'size': '100'}), },
> }
> # registered as 
> admin.site.register(Article, ArticleAdmin)
> 
> Sadly it appears to have no effect.
> Viewing the rendered source, I do not see a size attribute.
> the field is rendered as:
> 
> 
  Still no luck. 
  Tried a custom class:

class LongTextinput(TextInput):
def __init__(self, *args, **kwargs):
attrs = kwargs.setdefault('attrs', {})
attrs.setdefault('size', 100)
super(LongTextinput, self).__init__(*args, **kwargs)
...
formfield_overrides = {
models.CharField: {'widget': LongTextinput},
}

No luck.
Replace admin.site.register with decorator:
@admin.register(Article)
still no luck.

ArticleAdmin has an additional item, with
full code below
@admin.register(Article)
class ArticleAdmin(admin.ModelAdmin):
inlines = [CommentInline]
formfield_overrides = {
models.CharField: {'widget': LongTextinput},
}

It appears that inlines is being executed.
It says right here:
https://stackoverflow.com/questions/910169/resize-fields-in-django-admin

that it is supposed to be easy, but after hours of tweaking, I'm convinced that
formfield_overrides is being ignored.

-- 
Tim Johnson
http://www.tj49.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 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/20190511234232.GD2372%40mail.akwebsoft.com.
For more options, visit https://groups.google.com/d/optout.


formfield_overrides doesn't work

2019-05-11 Thread Tim Johnson
django 2.1.5 with python 3.7.2

I have a models.py class as follows:
class Article(models.Model):
title = models.CharField(max_length=255,)
 
And I want to override the rendered default size attribute to 100 in
the input/text form field.

the template rendering is done as follows

{% csrf_token %}
{{ form.as_p}}
Save


in the application admin.py I have the following:
class ArticleAdmin(admin.ModelAdmin):
formfield_overrides = {
models.CharField: {'widget': TextInput(attrs={'size': '100'}), },
}
# registered as 
admin.site.register(Article, ArticleAdmin)

Sadly it appears to have no effect.
Viewing the rendered source, I do not see a size attribute.
the field is rendered as:


Have I ommited a step?
thanks
-- 
Tim Johnson
http://www.tj49.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 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/20190511190931.GC2372%40mail.akwebsoft.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to make Django Project Mobile Compatible

2019-05-11 Thread Jani Tiainen
Hi,

After all it's just HTML and CSS you need and you can make responsive
layouting.

One quite common CSS library is Bootstrap that allows rather easily to
build layouts that works across the various sized devices.

Of course you can go with any JS framework if you're planning to build
single page app.

la 11. toukok. 2019 klo 10.05 Balaji Shetty 
kirjoitti:

> Hi
>
> How can i make my Django Project view Mobile Compatible.
> Should i use Angular JS / React  . Please let me know.
>
> Thanks in Advance
>
> --
>
>
> *Mr. Shetty Balaji S.Asst. ProfessorDepartment of Information Technology,*
> *SGGS Institute of Engineering & Technology, Vishnupuri, Nanded.MH.India*
> *Official: bsshe...@sggs.ac.in  *
> *  Mobile: +91-9270696267*
>
> --
> 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/CAECSbOveKW_5aohHGKCJcVxPtwMg-wTBC8ttVRpPJc3YOA7dKg%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/CAHn91offk%2BV4uOJuLdA7vKS%3DPXRSgOz40ZzhrzmSQY3iAFs8Pg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: problems with mysql client

2019-05-11 Thread Jorge Gimeno
Rob,

On the off chance you haven't seen it, I found a Stack Overflow question on
this:
https://stackoverflow.com/questions/25459386/mac-os-x-environmenterror-mysql-config-not-found.
Unfortunately, I don't know Mac OS all that well to offer more help than
that.

-Jorge

On Sat, May 11, 2019 at 9:04 AM Rob Gmail  wrote:

> Mac OS
>
> Rob
> 203-671-6514
> Sent from my mobile device, please excuse the typos.
>
> On May 11, 2019, at 11:42 AM, Jorge Gimeno  wrote:
>
>
>
> On Sat, May 11, 2019 at 8:16 AM Rob W  wrote:
>
>> for my django project, we are using mysql.
>>
>> no matter how i try to install it, python-mysqldb, or just pip install
>> mysqlclient, it fails.
>>
>> i've installed mysqlconnector, i've tried everything.
>>
>> any suggestions ?
>>
>>
>> Collecting mysqlclient
>>
>>   Downloading
>> https://files.pythonhosted.org/packages/f4/f1/3bb6f64ca7a429729413e6556b7ba5976df06019a5245a43d36032f1061e/mysqlclient-1.4.2.post1.tar.gz
>> (85kB)
>>
>>  || 92kB 1.3MB/s
>>
>> ERROR: Complete output from command python setup.py egg_info:
>>
>> ERROR: /bin/sh: mysql_config: command not found
>>
>> Traceback (most recent call last):
>>
>>   File "", line 1, in 
>>
>>   File "/private/tmp/pip-install-suhqq3eh/mysqlclient/setup.py",
>> line 16, in 
>>
>> metadata, options = get_config()
>>
>>   File
>> "/private/tmp/pip-install-suhqq3eh/mysqlclient/setup_posix.py", line 51, in
>> get_config
>>
>> libs = mysql_config("libs")
>>
>>   File
>> "/private/tmp/pip-install-suhqq3eh/mysqlclient/setup_posix.py", line 29, in
>> mysql_config
>>
>> raise EnvironmentError("%s not found" % (_mysql_config_path,))
>>
>> OSError: mysql_config not found
>>
>> 
>>
>> ERROR: Command "python setup.py egg_info" failed with error code 1 in
>> /private/tmp/pip-install-suhqq3eh/mysqlclient/
>>
>> --
>> 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/31f86e65-7e0a-49c7-b574-1670fba1ca18%40googlegroups.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> Rob,
>
> What operating system are you using?
>
> -Jorge
>
> --
> 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/CANfN%3DK-vw16fWxhZYa3f8VP6t6cCi5BA%2BoNtjmof99CQWNKb-Q%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/E5694676-28BF-4FEB-92B8-0B5A86300438%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/CANfN%3DK8Bkqk8-8qFV9Wx6QGqUVK2nSCU-u67oFh7TcK63-bw5Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: problems with mysql client

2019-05-11 Thread Rob Gmail
Mac OS 

Rob 
203-671-6514
Sent from my mobile device, please excuse the typos. 

> On May 11, 2019, at 11:42 AM, Jorge Gimeno  wrote:
> 
> 
> 
>> On Sat, May 11, 2019 at 8:16 AM Rob W  wrote:
>> for my django project, we are using mysql.
>> 
>> no matter how i try to install it, python-mysqldb, or just pip install 
>> mysqlclient, it fails.
>> 
>> i've installed mysqlconnector, i've tried everything. 
>> 
>> any suggestions ?
>> 
>> 
>> Collecting mysqlclient
>> 
>>   Downloading 
>> https://files.pythonhosted.org/packages/f4/f1/3bb6f64ca7a429729413e6556b7ba5976df06019a5245a43d36032f1061e/mysqlclient-1.4.2.post1.tar.gz
>>  (85kB)
>> 
>>  || 92kB 1.3MB/s 
>> 
>> ERROR: Complete output from command python setup.py egg_info:
>> 
>> ERROR: /bin/sh: mysql_config: command not found
>> 
>> Traceback (most recent call last):
>> 
>>   File "", line 1, in 
>> 
>>   File "/private/tmp/pip-install-suhqq3eh/mysqlclient/setup.py", line 
>> 16, in 
>> 
>> metadata, options = get_config()
>> 
>>   File "/private/tmp/pip-install-suhqq3eh/mysqlclient/setup_posix.py", 
>> line 51, in get_config
>> 
>> libs = mysql_config("libs")
>> 
>>   File "/private/tmp/pip-install-suhqq3eh/mysqlclient/setup_posix.py", 
>> line 29, in mysql_config
>> 
>> raise EnvironmentError("%s not found" % (_mysql_config_path,))
>> 
>> OSError: mysql_config not found
>> 
>> 
>> 
>> ERROR: Command "python setup.py egg_info" failed with error code 1 in 
>> /private/tmp/pip-install-suhqq3eh/mysqlclient/
>> 
>> -- 
>> 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/31f86e65-7e0a-49c7-b574-1670fba1ca18%40googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
> 
> Rob,
> 
> What operating system are you using?
> 
> -Jorge 
> -- 
> 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/CANfN%3DK-vw16fWxhZYa3f8VP6t6cCi5BA%2BoNtjmof99CQWNKb-Q%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/E5694676-28BF-4FEB-92B8-0B5A86300438%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: problems with mysql client

2019-05-11 Thread Jorge Gimeno
On Sat, May 11, 2019 at 8:16 AM Rob W  wrote:

> for my django project, we are using mysql.
>
> no matter how i try to install it, python-mysqldb, or just pip install
> mysqlclient, it fails.
>
> i've installed mysqlconnector, i've tried everything.
>
> any suggestions ?
>
>
> Collecting mysqlclient
>
>   Downloading
> https://files.pythonhosted.org/packages/f4/f1/3bb6f64ca7a429729413e6556b7ba5976df06019a5245a43d36032f1061e/mysqlclient-1.4.2.post1.tar.gz
> (85kB)
>
>  || 92kB 1.3MB/s
>
> ERROR: Complete output from command python setup.py egg_info:
>
> ERROR: /bin/sh: mysql_config: command not found
>
> Traceback (most recent call last):
>
>   File "", line 1, in 
>
>   File "/private/tmp/pip-install-suhqq3eh/mysqlclient/setup.py", line
> 16, in 
>
> metadata, options = get_config()
>
>   File
> "/private/tmp/pip-install-suhqq3eh/mysqlclient/setup_posix.py", line 51, in
> get_config
>
> libs = mysql_config("libs")
>
>   File
> "/private/tmp/pip-install-suhqq3eh/mysqlclient/setup_posix.py", line 29, in
> mysql_config
>
> raise EnvironmentError("%s not found" % (_mysql_config_path,))
>
> OSError: mysql_config not found
>
> 
>
> ERROR: Command "python setup.py egg_info" failed with error code 1 in
> /private/tmp/pip-install-suhqq3eh/mysqlclient/
>
> --
> 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/31f86e65-7e0a-49c7-b574-1670fba1ca18%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

Rob,

What operating system are you using?

-Jorge

-- 
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/CANfN%3DK-vw16fWxhZYa3f8VP6t6cCi5BA%2BoNtjmof99CQWNKb-Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


problems with mysql client

2019-05-11 Thread Rob W
for my django project, we are using mysql.

no matter how i try to install it, python-mysqldb, or just pip install 
mysqlclient, it fails.

i've installed mysqlconnector, i've tried everything. 

any suggestions ?


Collecting mysqlclient

  Downloading 
https://files.pythonhosted.org/packages/f4/f1/3bb6f64ca7a429729413e6556b7ba5976df06019a5245a43d36032f1061e/mysqlclient-1.4.2.post1.tar.gz
 
(85kB)

 || 92kB 1.3MB/s 

ERROR: Complete output from command python setup.py egg_info:

ERROR: /bin/sh: mysql_config: command not found

Traceback (most recent call last):

  File "", line 1, in 

  File "/private/tmp/pip-install-suhqq3eh/mysqlclient/setup.py", line 
16, in 

metadata, options = get_config()

  File "/private/tmp/pip-install-suhqq3eh/mysqlclient/setup_posix.py", 
line 51, in get_config

libs = mysql_config("libs")

  File "/private/tmp/pip-install-suhqq3eh/mysqlclient/setup_posix.py", 
line 29, in mysql_config

raise EnvironmentError("%s not found" % (_mysql_config_path,))

OSError: mysql_config not found



ERROR: Command "python setup.py egg_info" failed with error code 1 in 
/private/tmp/pip-install-suhqq3eh/mysqlclient/

-- 
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/31f86e65-7e0a-49c7-b574-1670fba1ca18%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


HOW TO INTEGRATE ITUNE MUSIC API ON MY WEBSITE

2019-05-11 Thread Edward Victorhez
HOW TO INTEGRATE ITUNE MUSIC API ON MY WEBSITE



-- 
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/90ad4de5-e202-437a-b12e-22d80ced7b4b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Can not render dynamic changing string from views.py to template form page

2019-05-11 Thread Ravi Kumar
Hai
I think you have to return jsonresponse in views Inorder to do it turn it
data into json using json package and it has a method like dumps or loads
and return data

On Sat 11 May, 2019, 7:58 AM Samaresh Singh,  wrote:

> I can print the prod_name inside the views.py but cannot pass that
> prod_name to the form page of selected product text filed. Main goal is to
> throw the dropdown value received from form page to views.py and send the
> same back to the form page from views.py. Hence I will be able to see the
> changing product name when I select different value from the dropdown.
>
> I am new to Django and would appreciate if you can help me with the
> working code.
>
> Thanks,
> Samaresh
>
>
> On Fri, May 10, 2019 at 6:57 AM Najmath Ummer  wrote:
>
>> Hey,
>> Try to print the prod_name in viewsand if it is undefined or null try
>> using post instead of get.
>> Thanks and Regards,
>>
>> Najmath Ummer
>> Perleybrook Labs LLC
>> Mob:8075314478
>>
>>
>> On Fri, 10 May 2019 at 02:04, Samaresh Singh  wrote:
>>
>>> Hi All,
>>>
>>> I am working on internal django project where, i select the option from
>>> dropdown in the form page and pass that value to the views.py using AJAX.
>>> in views.py i use the text from dropdown and want to throw the text into
>>> same form pages text field but that does not work. When i try to pass some
>>> constant string from views.py to template form page that works. Below is
>>> the code snippet
>>>
>>> form.html
>>> ---
>>>
>>> New Hot Fix Request
>>>   
>>> Product * 
>>> 
>>> 
>>> Product1
>>> Product2
>>> 
>>> 
>>> $(document).ready(function(){
>>>
>>> $('#dropdown').on('change',function(e){
>>> var e = document.getElementById("dropdown");
>>> var productName = e.options[e.selectedIndex].value;
>>> console.log("Dropdown Product Name: "+productName);
>>> $.ajax({
>>> url:"",
>>> method:'GET',
>>> // send selected data to the newHPReq method which is 
>>> in views.py
>>> data : {'product' : $(this).val()}, // 'product' will 
>>> be used in request.GET.get('product') which is in views.py, $(this).val() 
>>> is selected item,
>>> success:function(data){
>>> //console.log(data);
>>> }
>>> });
>>> });
>>> });
>>> 
>>>
>>>
>>> views.py
>>> ---
>>>
>>> def newHPReq(request):
>>> # name = request.session['requestor']
>>>
>>> if request.method == 'GET':
>>> prod_name = request.GET.get('product')  # we are getting selected 
>>> item with this line. we defined 'product' in ajax file
>>> print("Product name from dropdown: %s " % prod_name)
>>>
>>> context_dict = {'product_name': prod_name}
>>>
>>> print("Product Name is:  %s " % context_dict['product_name'])
>>>
>>>
>>> return render(request, 'FormPage/form.html', (context_dict)) # 
>>> Expecting product1 to be sent to form.html but doesnt.
>>>
>>>
>>> I want to capture 'Product1' from dropdown to below text field of
>>> fom.html
>>>
>>> Selected Product
>>> >> value="">
>>> 
>>> $(document).change(function() {
>>> console.log('I am here');  // This gets printed every time when 
>>> I change the dropdown value
>>> getSelectValue();
>>> });
>>> 
>>> 
>>> function getSelectValue() {
>>> field = document.querySelector('#productName');
>>> var name = "{{product_name}}";   // This always 
>>> gives None when select product from dropdown
>>> console.log("Received name from view: " + name);
>>> field.value = name;
>>> }
>>> 
>>>
>>>
>>>
>>> I need some help, how can I propagate the dynamic change text from
>>> views.py to template form.html page.
>>>
>>> Thank you in advance
>>>
>>
>>> --
>>> 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/be482944-edeb-4fa6-a414-a1f8d2c4b290%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 

Re: How to make Django Project Mobile Compatible

2019-05-11 Thread Luqman Jr
Between Angular and React which one is the best to be used with Django?
On 11 May 2019, 10:38 +0300, Balaji Shetty , wrote:
> Hi  Nick Sarbicki
>
> Thank You very much for your reply.
> May I know which framework is to be learned for necessary implementation?.
> It should be easy to earn with help support.
>
> > On Sat, May 11, 2019 at 12:40 PM Nick Sarbicki  
> > wrote:
> > > Hi,
> > >
> > > Django is completely naive to whether a frontend is mobile friendly or 
> > > not.
> > >
> > > You can use react or angular, you can also use many other frontend 
> > > frameworks. Django can work with all frontend frameworks. The choice is 
> > > entirely up to you.
> > >
> > > > On Sat, 11 May 2019, 08:04 Balaji Shetty,  
> > > > wrote:
> > > > > Hi
> > > > >
> > > > > How can i make my Django Project view Mobile Compatible.
> > > > > Should i use Angular JS / React  . Please let me know.
> > > > >
> > > > > Thanks in Advance
> > > > >
> > > > > --
> > > > > Mr. Shetty Balaji S.
> > > > > Asst. Professor
> > > > > Department of Information Technology,
> > > > > SGGS Institute of Engineering & Technology, Vishnupuri, 
> > > > > Nanded.MH.India
> > > > > Official: bsshe...@sggs.ac.in
> > > > >   Mobile: +91-9270696267
> > > > >
> > > > > --
> > > > > 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/CAECSbOveKW_5aohHGKCJcVxPtwMg-wTBC8ttVRpPJc3YOA7dKg%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/CAGuvt92gdOmQSsZrW2BixcsFfc17DWbia0mfvv4rUYr7WZtyfw%40mail.gmail.com.
> > > For more options, visit https://groups.google.com/d/optout.
>
>
> --
> Mr. Shetty Balaji S.
> Asst. Professor
> Department of Information Technology,
> SGGS Institute of Engineering & Technology, Vishnupuri, Nanded.MH.India
> Official: bsshe...@sggs.ac.in
>   Mobile: +91-9270696267
>
> --
> 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/CAECSbOszXSWCEkEtxTmXQuK53k-A-AW_pPJVri_NWEqoovXunA%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/00348a15-c851-4117-8a26-91fd5cd21a34%40Spark.
For more options, visit https://groups.google.com/d/optout.


{ "non_field_errors": [ "No data provided" ] } error during a post method.

2019-05-11 Thread Arun Kumar Singamasetty



##from file serilaizers.py###


from rest_framework import serializers
from .models import Article

# class ArticleSerializer(serializers.Serializer):
# title = serializers.CharField(max_length=120)
# description = serializers.CharField()
# body = serializers.CharField()
# author_id = serializers.IntegerField()

class ArticleSerializer(serializers.ModelSerializer):
class Meta:
model = Article
fields = ('title', 'description', 'body', 'author_id')

def create(self, validated_data):
return Article.objects.create(**validated_data)

# class UserSerializer(serializers.HyperlinkedModelSerializer):






#from file models.py##


# from django.db import models

# Create your models here.
from django.db import models

class Author(models.Model):
  name = models.CharField(max_length=255)
  email = models.EmailField()


class Article(models.Model):
title = models.CharField(max_length=120)
description = models.TextField()
body = models.TextField()
author = models.ForeignKey('Author',on_delete=models.CASCADE,)

def __str__(self):
return self.title


-- 
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/424f69bd-4722-4269-914e-de26b978275d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Can not render dynamic changing string from views.py to template form page

2019-05-11 Thread Najmath Ummer
In views return as Jsonresponse
return JsonResponse(context_dict,safe=False)
And in template
You can log into success of ajax. And if it is still not working I will
show you an example code.

On Sat, 11 May 2019 at 7:58 AM, Samaresh Singh  wrote:

> I can print the prod_name inside the views.py but cannot pass that
> prod_name to the form page of selected product text filed. Main goal is to
> throw the dropdown value received from form page to views.py and send the
> same back to the form page from views.py. Hence I will be able to see the
> changing product name when I select different value from the dropdown.
>
> I am new to Django and would appreciate if you can help me with the
> working code.
>
> Thanks,
> Samaresh
>
>
> On Fri, May 10, 2019 at 6:57 AM Najmath Ummer  wrote:
>
>> Hey,
>> Try to print the prod_name in viewsand if it is undefined or null try
>> using post instead of get.
>> Thanks and Regards,
>>
>> Najmath Ummer
>> Perleybrook Labs LLC
>> Mob:8075314478
>>
>>
>> On Fri, 10 May 2019 at 02:04, Samaresh Singh  wrote:
>>
>>> Hi All,
>>>
>>> I am working on internal django project where, i select the option from
>>> dropdown in the form page and pass that value to the views.py using AJAX.
>>> in views.py i use the text from dropdown and want to throw the text into
>>> same form pages text field but that does not work. When i try to pass some
>>> constant string from views.py to template form page that works. Below is
>>> the code snippet
>>>
>>> form.html
>>> ---
>>>
>>> New Hot Fix Request
>>>   
>>> Product * 
>>> 
>>> 
>>> Product1
>>> Product2
>>> 
>>> 
>>> $(document).ready(function(){
>>>
>>> $('#dropdown').on('change',function(e){
>>> var e = document.getElementById("dropdown");
>>> var productName = e.options[e.selectedIndex].value;
>>> console.log("Dropdown Product Name: "+productName);
>>> $.ajax({
>>> url:"",
>>> method:'GET',
>>> // send selected data to the newHPReq method which is 
>>> in views.py
>>> data : {'product' : $(this).val()}, // 'product' will 
>>> be used in request.GET.get('product') which is in views.py, $(this).val() 
>>> is selected item,
>>> success:function(data){
>>> //console.log(data);
>>> }
>>> });
>>> });
>>> });
>>> 
>>>
>>>
>>> views.py
>>> ---
>>>
>>> def newHPReq(request):
>>> # name = request.session['requestor']
>>>
>>> if request.method == 'GET':
>>> prod_name = request.GET.get('product')  # we are getting selected 
>>> item with this line. we defined 'product' in ajax file
>>> print("Product name from dropdown: %s " % prod_name)
>>>
>>> context_dict = {'product_name': prod_name}
>>>
>>> print("Product Name is:  %s " % context_dict['product_name'])
>>>
>>>
>>> return render(request, 'FormPage/form.html', (context_dict)) # 
>>> Expecting product1 to be sent to form.html but doesnt.
>>>
>>>
>>> I want to capture 'Product1' from dropdown to below text field of
>>> fom.html
>>>
>>> Selected Product
>>> >> value="">
>>> 
>>> $(document).change(function() {
>>> console.log('I am here');  // This gets printed every time when 
>>> I change the dropdown value
>>> getSelectValue();
>>> });
>>> 
>>> 
>>> function getSelectValue() {
>>> field = document.querySelector('#productName');
>>> var name = "{{product_name}}";   // This always 
>>> gives None when select product from dropdown
>>> console.log("Received name from view: " + name);
>>> field.value = name;
>>> }
>>> 
>>>
>>>
>>>
>>> I need some help, how can I propagate the dynamic change text from
>>> views.py to template form.html page.
>>>
>>> Thank you in advance
>>>
>>
>>> --
>>> 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/be482944-edeb-4fa6-a414-a1f8d2c4b290%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
>> 

Re: How to make Django Project Mobile Compatible

2019-05-11 Thread Balaji Shetty
Hi  Nick Sarbicki

Thank You very much for your reply.
May I know which framework is to be learned for necessary implementation?.
It should be easy to earn with help support.

On Sat, May 11, 2019 at 12:40 PM Nick Sarbicki 
wrote:

> Hi,
>
> Django is completely naive to whether a frontend is mobile friendly or not.
>
> You can use react or angular, you can also use many other frontend
> frameworks. Django can work with all frontend frameworks. The choice is
> entirely up to you.
>
> On Sat, 11 May 2019, 08:04 Balaji Shetty,  wrote:
>
>> Hi
>>
>> How can i make my Django Project view Mobile Compatible.
>> Should i use Angular JS / React  . Please let me know.
>>
>> Thanks in Advance
>>
>> --
>>
>>
>> *Mr. Shetty Balaji S.Asst. ProfessorDepartment of Information Technology,*
>> *SGGS Institute of Engineering & Technology, Vishnupuri, Nanded.MH.India*
>> *Official: bsshe...@sggs.ac.in  *
>> *  Mobile: +91-9270696267*
>>
>> --
>> 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/CAECSbOveKW_5aohHGKCJcVxPtwMg-wTBC8ttVRpPJc3YOA7dKg%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/CAGuvt92gdOmQSsZrW2BixcsFfc17DWbia0mfvv4rUYr7WZtyfw%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 


*Mr. Shetty Balaji S.Asst. ProfessorDepartment of Information Technology,*
*SGGS Institute of Engineering & Technology, Vishnupuri, Nanded.MH.India*
*Official: bsshe...@sggs.ac.in  *
*  Mobile: +91-9270696267*

-- 
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/CAECSbOszXSWCEkEtxTmXQuK53k-A-AW_pPJVri_NWEqoovXunA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to make Django Project Mobile Compatible

2019-05-11 Thread Nick Sarbicki
Hi,

Django is completely naive to whether a frontend is mobile friendly or not.

You can use react or angular, you can also use many other frontend
frameworks. Django can work with all frontend frameworks. The choice is
entirely up to you.

On Sat, 11 May 2019, 08:04 Balaji Shetty,  wrote:

> Hi
>
> How can i make my Django Project view Mobile Compatible.
> Should i use Angular JS / React  . Please let me know.
>
> Thanks in Advance
>
> --
>
>
> *Mr. Shetty Balaji S.Asst. ProfessorDepartment of Information Technology,*
> *SGGS Institute of Engineering & Technology, Vishnupuri, Nanded.MH.India*
> *Official: bsshe...@sggs.ac.in  *
> *  Mobile: +91-9270696267*
>
> --
> 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/CAECSbOveKW_5aohHGKCJcVxPtwMg-wTBC8ttVRpPJc3YOA7dKg%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/CAGuvt92gdOmQSsZrW2BixcsFfc17DWbia0mfvv4rUYr7WZtyfw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


How to make Django Project Mobile Compatible

2019-05-11 Thread Balaji Shetty
Hi

How can i make my Django Project view Mobile Compatible.
Should i use Angular JS / React  . Please let me know.

Thanks in Advance

-- 


*Mr. Shetty Balaji S.Asst. ProfessorDepartment of Information Technology,*
*SGGS Institute of Engineering & Technology, Vishnupuri, Nanded.MH.India*
*Official: bsshe...@sggs.ac.in  *
*  Mobile: +91-9270696267*

-- 
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/CAECSbOveKW_5aohHGKCJcVxPtwMg-wTBC8ttVRpPJc3YOA7dKg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Static files won't match the path given

2019-05-11 Thread Rookies DJ
Dear Anirudh Jain

Thank you for reply 

Really, apprentice it

Yes we run collectstaitc command 

And we try within setting.py files

Set path static_root/url as the same

As for web server software we using apache not nigx.

I apologize for not including this information

Really appreciate if you could 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+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/efd7bdbc-4c67-4166-88f0-c6e9b245b267%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Static files won't match the path given

2019-05-11 Thread Mike Dewhirst
Have you used manage.py collectstatic?

Connected by Motorola

Rookies DJ  wrote:

>I apologise, I'm a hardware engineer, I'm not very familiar with coding; I'm 
>only on Django for the past 5 months. (under my boss order)
>
>
>I had managed to develop and establish a Django App, and manage to upload it 
>to remote server NameCheap. There on the server, the issue is unable to locate 
>the static files. Even when we directed the path to static files folder.
>
>This static files, infrequently work and load the static, that's how we 
>concluded the static error was caused by the misdirection of the path.
>
>
>But reading over the Django documentary multiple time didn't help resolve 
>
>
>Please help our team had been trying resolve this issue for past 2months 
>
>-- 
>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/e2f33470-0ad3-4387-9fbe-cd20b40eee82%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/lk6dkclesxxw66c9iw4i1a28.1557554762271%40email.android.com.
For more options, visit https://groups.google.com/d/optout.