Re: Password reset to Gmail addresses fails

2017-12-04 Thread Julio Biason
Hi Alastair,

Just one question: are you using Gmail SMTP to send those messages or are you 
using your own/a third party?

Because Google could’ve marked your domain/server as spam and it is simply 
deleting all messages incoming from it (we had a similar problem a few days 
ago). If that’s the case, you need to contact the GMail team to ask what 
happened (I don’t have their contact ‘cause it was someone else here that 
solved that problem).

> On 4 Dec 2017, at 07:22, Alastair Campbell  wrote:
> 
> Hi everyone,
> 
> I have a very strange problem, I'm looking for ideas on where to debug.
> 
> Using the standard password reset in Django (v 1.10), it silently fails to 
> send to Gmail addresses.
> 
> There is no error generated by Django, and it works for non-Gmail addresses.
> 
> In /var/log/mail.log (a Debian VM on Linode), nothing gets passed to the mail 
> log (and I checked .err, .warn and .info as well), it is like it didn't 
> happen.
> 
> I can send email from that box to gmail addresses via my email client, that 
> works fine and shows up in the logs. (And the TLS cert is being used, and I 
> have done SPF.)
> 
> Is there somewhere between the mail log and django that I need to check? Any 
> clues or similar problems recently?
> 
> Thanks,
> 
> -Alastair
> 
> -- 
> 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/CAC5%2BKCFBuei5Cnue8yRwac%3Da92yr2e9AmUzuN_Q6OTf8mMV5vg%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/FE948D46-057A-4D8A-988F-7B84DB8C38E2%40azion.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django 2.0 and MySql

2017-12-18 Thread Julio Biason
Are you sure the socket is being created on /tmp? Because that's what the
error is pointing our: You said Django should communicate with MySQL though
a socket file in /tmp called "mysql.sock", but there was some problem with
it. You should probably check your MySQL config file (/etc/my.cnf) to
assure the socket is being created there.

(On my local install, the socket is in /var/lib/mysql, so you probably just
update your settings).

On Mon, Dec 18, 2017 at 4:13 PM, Alan  wrote:

> I am trying this in a VM with ubuntu 16.04:
>
> wget -c https://repo.continuum.io/miniconda/Miniconda3-latest-
> Linux-x86_64.sh
> bash Miniconda3-latest-Linux-x86_64.sh
> sudo apt-get install rabbitmq-server
> sudo systemctl start rabbitmq-server
> pip install Django celery PyMySQL
> sudo apt-get install mysql-server
> mysql_secure_installation
> mysql -u root -p
> mysql> CREATE USER 'acpype_mysql'@'localhost' IDENTIFIED BY '_bla_bla_';
> mysql> GRANT ALL PRIVILEGES ON * . * TO 'acpype_mysql'@'localhost';
> conda install -c bioconda mysqlclient
>
> And once I have copied my django project, I try:
>
> python manage.py makemigrations
>
> which will fail with:
>
> django.db.utils.OperationalError: (2002, "Can't connect to local MySQL
> server through socket '/tmp/mysql.sock' (2)")
>
> from my settings.py
>
> DATABASES = {
> 'default': {
> 'ENGINE': 'django.db.backends.mysql',
> 'NAME': 'acpype_db',
> 'USER': 'acpype_mysql',
> 'PASSWORD': '_bla_bla_',
> 'HOST': 'localhost',
> 'PORT': '',
> 'HOST': '/tmp/mysql.sock',
> }
> }
>
> Many thanks in advance,
>
> Alan
> --
> I'll cycle across Britain in 2018 for a charity, would you consider
> supporting my cause? http://uk.virginmoneygiving.com/AlanSilva
> Many thanks!
> --
> Alan Wilter SOUSA da SILVA, DSc
> Senior Bioinformatician, UniProt
> European Bioinformatics Institute (EMBL-EBI)
> European Molecular Biology Laboratory
> Wellcome Trust Genome Campus
> Hinxton
> Cambridge CB10 1SD
> United Kingdom
> Tel: +44 (0)1223 494588 <+44%201223%20494588>
>
> --
> 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/CAEznbzm7J8mq-f9n%2BqStPYSqgii1NxgiXTgdN1s56d0vL
> NaAQw%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAEznbzm7J8mq-f9n%2BqStPYSqgii1NxgiXTgdN1s56d0vLNaAQw%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
*Julio Biason*, Sofware Engineer
*AZION*  |  Deliver. Accelerate. Protect.
Office: +55 51 3083 8101   |  Mobile: +55 51
*99907 0554*

-- 
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/CAEM7gE3Hqavjr%2BV_bk-Nf3DkSZq%2Bu7gSnymt7HuG%2BvyVDSCJEQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: why is a text not displayed?

2017-12-21 Thread Julio Biason
Hello,

Did you remembered to include this urls.py in the project urls.py? This
looks like your app internal URLs, but you still need to tell the whole
project that it should include these URLs into it (with, maybe, a prefix).

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


Re: 'module' object has no attribute 'lru_cache'

2017-12-27 Thread Julio Biason
Hi Etienne,

Python 2.x will not receive any updates (security or otherwise) starting in 
2020. Many projects are dropping python 2 support right now to allow people to 
have enough time to port their codebases to python 3.

Get Outlook for iOS

From: django-users@googlegroups.com  on behalf 
of Etienne Robillard 
Sent: Wednesday, December 27, 2017 8:18:35 AM
To: django-users@googlegroups.com
Subject: Re: 'module' object has no attribute 'lru_cache'

OK, I've read the INSTALL file and noticed that Django dropped support
for Python 2.7.

Any reasons for dropping support for Python 2.7 in the first place ?

Regards,

Etienne


Le 2017-12-27 à 05:05, Etienne Robillard a écrit :
> Hi,
>
> I'm trying to upgrade my development server to Django 2.0 using
> setup.py develop command:
>
> erob@marina:~/ncvs/django$ sudo python setup.py develop
> Traceback (most recent call last):
>   File "setup.py", line 32, in 
> version = __import__('django').get_version()
>   File "/home/erob/ncvs/django/django/__init__.py", line 1, in 
> from django.utils.version import get_version
>   File "/home/erob/ncvs/django/django/utils/version.py", line 61, in
> 
> @functools.lru_cache()
> AttributeError: 'module' object has no attribute 'lru_cache'
>
> Why does the setup.py script attempt to import the django package?
>
> Is it possible to upgrade Django from source when release 1.11.6 is
> already installed in /usr/local ?
>
> Thank you in advance,
>
> Etienne
>

--
Etienne Robillard
tkad...@yandex.com
https://www.isotopesoftware.ca/

--
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/2a503d84-2c58-ecca-a8a0-aeef800f0487%40yandex.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/DM5PR18MB1419293817383D2FF8254850AE070%40DM5PR18MB1419.namprd18.prod.outlook.com.
For more options, visit https://groups.google.com/d/optout.


Re: how to install django on cpanel

2017-12-28 Thread Julio Biason
Hi Sakkhar,

Django can "run" in any directory. You need to install it somewhere on your
system (we use /usr/local/ here) and then wrap the code around a
WSGI exposer (like uwsgi or gunicorn). Then you "plug" your webserver to
the wsgi exposer via socket or http port.

It's not like any PHP-like frameworks, which you give the files directly to
the webserver and it does whatever it is needed (unless you're using
mod_wsgi, which was deprecated years ago towards the use of uwsgi/gunicorn.

On Thu, Dec 28, 2017 at 11:06 AM, sakkhar saha 
wrote:

> What directory do I need to put the files in?
> I tried public_html but when I put the files there and clicked on
> setup.py, it didn't start the script.
>
> --
> 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/dff9485d-477a-41a1-93b7-f41b6a2324f8%40googlegroups.com
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
*Julio Biason*, Sofware Engineer
*AZION*  |  Deliver. Accelerate. Protect.
Office: +55 51 3083 8101   |  Mobile: +55 51
*99907 0554*

-- 
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/CAEM7gE1wqF1RGBinJRLmWCmyUaBhGfz8Ji%3DHCSeN4Z-R%3Dg7RNw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: 'str' object has no attribute 'tzinfo'

2018-01-03 Thread Julio Biason
It looks like you're trying to localize a string, which is not a datetime
object and, thus, doesn't have a tzinfo property.

You'll have to convert your string to a datetime before trying to localize
it.

On Wed, Jan 3, 2018 at 3:42 PM, Inter Nemo  wrote:

> *Django:* 2.0.1
> *Error: *
>
>> 'str' object has no attribute 'tzinfo'
>>
>> *File:*
> ...\AppData\Local\Programs\Python\Python36\lib\site-
> packages\pytz\__init__.py in localize
> *Code:*
>
> if dt.tzinfo is not None:
>
>
> *Local vars:*
> Variable Value
> dt
>
> '-00-00 00:00:00.00'
>
> is_dst
>
> None
>
> self
>
> 
>
> --
> 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/43042199-3f20-4fef-bf30-9a4c53c32d6e%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/43042199-3f20-4fef-bf30-9a4c53c32d6e%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
*Julio Biason*, Sofware Engineer
*AZION*  |  Deliver. Accelerate. Protect.
Office: +55 51 3083 8101   |  Mobile: +55 51
*99907 0554*

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


Re: Django Admin Form clean method override only working for one exception

2018-01-04 Thread Julio Biason
Hi Dean,

You forgot to call the form clean method (the first line after your `def
clean` should be `super().clean()` as shown in the documentation:
https://docs.djangoproject.com/en/2.0/ref/forms/validation/#cleaning-and-validating-fields-that-depend-on-each-other
).

On Thu, Jan 4, 2018 at 7:06 AM, dean raemaekers 
wrote:

> Hello,
>
> I am trying to override the Forms in the Django Admin interface to have
> custom exceptions in the clean() method.
>
> This works for my first validation, but it doesn't work for a second one
> in the same form, or on another form at all. I am wondering if I have the
> syntax wrong for multiple validations.
>
> The code looks like this:
>
> class ProviderForm(forms.ModelForm):
> class Meta:
> model = Provider
> fields = '__all__'
>
> def clean(self):
> #provider start date and end date
> provider_start_date = self.cleaned_data.get('provider_start_date')
> provider_end_date = self.cleaned_data.get('provider_end_date')
> if provider_start_date > provider_end_date:
> raise forms.ValidationError("Start date can't be after end date")
>
> #etqe_id and provider_code
> provider_etqe_id = self.cleaned_data.get('provider_etqe_id')
> provider_code = self.cleaned_data.get('provider_code')
> if "HW" not in provider_code:
> raise forms.ValidationError("Invalid provider code")
>
> if "9" not in provider_etqe_id:
> raise forms.ValidationError("Invalid ETQE ID")
>
> return self.cleaned_data
>
> class ProviderAdmin(admin.ModelAdmin):
> form = ProviderForm
>
> admin.site.register(Provider, ProviderAdmin)
>
> (The first validation, the start date and end date, does work perfectly -
> the second validation does not work at all, and allows the form to be saved
> no matter what data is entered)
>
> Then I also have replicated this for another form:
>
> class PersonForm(forms.ModelForm):
> class Meta:
> model = Person
> fields = '__all__'
>
> def clean(self):
>
> person_alternate_id = self.cleaned_data.get('person_alternate_id')
> alternate_id_type_id = self.cleaned_data.get('alternate_id_type_id')
>
> if person_alternate_id is not None and alternate_id_type_id == 533:
> raise forms.ValidationError("Person Alternate ID is not blank, therefore
> Alternate ID Type ID cannot be 533")
> if person_alternate_id is None and alternate_id_type_id != 533:
> raise forms.ValidationError("Person Alternate ID is blank, therefore
> Alternate ID Type ID must be 533")
>
> return self.cleaned_data
>
> class PersonAdmin(admin.ModelAdmin):
> form = PersonForm
>
> admin.site.register(Person, PersonAdmin)
>
> This does not work at all, and also allows the form to be saved even if
> the invalid data has been entered.
>
> Thanks 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/6d1e21bc-cc16-42bd-a9b9-949a800c81b7%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/6d1e21bc-cc16-42bd-a9b9-949a800c81b7%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
*Julio Biason*, Sofware Engineer
*AZION*  |  Deliver. Accelerate. Protect.
Office: +55 51 3083 8101   |  Mobile: +55 51
*99907 0554*

-- 
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/CAEM7gE0s%2BVYVknpZ3wj%3DdCqh%2BAwM6kB%3D-9joA8xdu-4PhXqJ-g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Scope of Django

2018-01-04 Thread Julio Biason
Hi Sidharth,

What do you mean by "scope"? Django is the backend and templating engine
(in the backend, not frontend like React/Vue/Preact). You can basically
write the whole "store data" part in Django, with the presentation on top
of it and add some interaction with the user with JavaScript (manually).

About documentation, if you never used Django before, I'd suggestion going
through the project tutorials (https://docs.djangoproject.com/en/2.0/intro/)
before anything.

On Thu, Jan 4, 2018 at 9:18 AM, Sidharth Rai 
wrote:

> Hello,
>
> What is the scope of Django over JavaScript?
>
> Can anyone suggest me some good online tutorials for Django for building
> web apps?
>
> Thank 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/8eace426-82b4-4bb3-8f02-27df952aa866%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/8eace426-82b4-4bb3-8f02-27df952aa866%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
*Julio Biason*, Sofware Engineer
*AZION*  |  Deliver. Accelerate. Protect.
Office: +55 51 3083 8101   |  Mobile: +55 51
*99907 0554*

-- 
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/CAEM7gE1X74JZsXOzjkW-GVzHuA%3D8gM-L2mWNPJzkWz%2BG_cLmBA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How do you check if a template is included into another?

2018-01-05 Thread Julio Biason
Hi Luna,

Why not do something like:

Have a base template that you will use for the basic editing, let's call it
`base_content_edit.html`:

{% extends whatever-you-use-as-base-template %}

{% block editor %}

{% endblock %}


and then, when you need a rich editor, you have a new template, say
`rich_content_edit.html`:

{% extend "base_content_edit" %}

{% block editor %}

{% endblock %}


Django templates are more based on the building on top of previous content
than including bits and pieces (although you can do that with no issues).

On Fri, Jan 5, 2018 at 6:03 PM, Luna Tuna 
wrote:

> Say I have a content editing template with a simple text area and title
> field.   Then I'll need a publish button for it of course.
>
> But if I include this conten editor in a larger template, the position of
> the publish button will go to the bottom of additionally included content,
>
> so I only want to render the publish button in the first template if I
> know that content_edit.hml is not included in a larger template.
>
> How would I accomplish this?
>
> --
> 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/ddb6d351-113d-4ff7-ba12-602a9a12a6a0%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/ddb6d351-113d-4ff7-ba12-602a9a12a6a0%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
*Julio Biason*, Sofware Engineer
*AZION*  |  Deliver. Accelerate. Protect.
Office: +55 51 3083 8101   |  Mobile: +55 51
*99907 0554*

-- 
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/CAEM7gE3nNY5%3DT%3D6EvRE4RperstWwcScpsfDdTCW-ELCTOVDYvw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: urlopen error [Errno 110] Connection timed out

2018-01-08 Thread Julio Biason
Hello,

Where does this happen? Do you do urlopen somewhere? (IIRC, changing Django
settings doesn't affect internal Python objects).

urllib.request has a timeout, it's the second parameter after the data:
https://docs.python.org/3/library/urllib.request.html?highlight=urllib#urllib.request.urlopen

But you shouldn't do anything long while answering a request. You should
probalby use something like Celery to retrieve information in the
background, freeing the request (and later show the proper response).

On Mon, Jan 8, 2018 at 2:30 PM,  wrote:

>
> I use pythonanywhere. At this time, "urlopen error [Errno 110] Connection
> timed out" occurs. So I set CACHES TIMEOUT to None in Django settings.py.
> However, error 110 still occurs. Do I need to change the timeout value in
> urllib / request.py? I would really appreciate your help in this matter.
>
> --
> 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/2a798988-c7ab-4ec8-b967-e4f00af5b27b%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/2a798988-c7ab-4ec8-b967-e4f00af5b27b%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
*Julio Biason*, Sofware Engineer
*AZION*  |  Deliver. Accelerate. Protect.
Office: +55 51 3083 8101   |  Mobile: +55 51
*99907 0554*

-- 
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/CAEM7gE2w3%2BCHPhhXdpohd1Y8t5ejjvE4Q_s%3DRt4XsOhAAuRSDQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: HTML video seek problem in django

2018-01-10 Thread Julio Biason
Hi Manjunatha,

Django just serves the content, it doesn't handle how it will be played. It
could be a problem with your player, or some JS error -- in other words,
nothing to do with Django itself.

On Wed, Jan 10, 2018 at 8:03 AM, Manjunatha L Naik 
wrote:

> Hii,
>
>
>
> When load video from Django app, the video seeking(forward and backward)
> is not possible with chrome browser. It works fine with IE and Mozilla
> Firefox.. Please help me out.
>
>
>
> Thanks,
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To 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/57db425c-e1fc-406d-85df-570a512751a4%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/57db425c-e1fc-406d-85df-570a512751a4%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
*Julio Biason*, Sofware Engineer
*AZION*  |  Deliver. Accelerate. Protect.
Office: +55 51 3083 8101   |  Mobile: +55 51
*99907 0554*

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


Re: How do I exactly change from SQLite to MySQL ?

2018-01-15 Thread Julio Biason
Hi Daniel,

Well, in simple terms, all you need to do is change the DATABASE setting in
your settings (here
https://www.coderedcorp.com/blog/django-settings-for-multiple-environments/
is an example of way to keep two different configurations, so you can have
a production setting pointing to MySQL while keeping your dev setting using
SQLite). You may need to create the user and a database for it, but that's
more of a MySQL-specific question than Django.

If you want to migrate your data from SQLite to MySQL, you can use
`dumpdata` to "export" the data from your dev enviroment and `loaddata` to
load it back to the production data. Both are part of the default
manage.py: https://docs.djangoproject.com/en/2.0/ref/django-admin/#dumpdata

On Sun, Jan 14, 2018 at 12:09 PM, Daniel Cîrstea  wrote:

>  Hello. I am new to Django and I am trying to use it for my bachelor
> thesis. Thing is, I want to use MySQL insted of SQLite. How do I exactly do
> it.. I can't find a step-by-step tutorial on the internet.
> Also, I want to deploy project later on Heroku. Can I work on SQLite on
> local machine and then is possible to change to MySQL on Heroku ? In any
> case, I want to know how to do both, if possible. Thank 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/a7decab1-334e-4f04-a6e9-6ad7bc2cd78b%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/a7decab1-334e-4f04-a6e9-6ad7bc2cd78b%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
*Julio Biason*, Sofware Engineer
*AZION*  |  Deliver. Accelerate. Protect.
Office: +55 51 3083 8101   |  Mobile: +55 51
*99907 0554*

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


Re: Django escapes a string partially

2018-01-22 Thread Julio Biason
Hi,

You should wrap your  `data-content={{ v.error_msg }}` in quotes, like
this: `data-content="{{ v.error_msg }}"`.

Otherwise you'll generate the template as `data-content='NoneType' object
has not attribute "rfind"`, which is a valid HTML (data-content will have
the string 'NoneType' and the node will have a bunch of tags that it
doesn't know what to do with it, so they just sit there: "object", "has",
"not", "attribute" and ""rfind"".)

On Mon, Jan 22, 2018 at 1:47 PM, Ron Moran  wrote:

> Hi there!
>
> I have a problem with escaping an error.
> I have this unicode in python(2.7) which isn't escaped well in a span
> element:
>
> u"'NoneType' object has no attribute 'rfind'"
> The template is defined as follows:
>
>data-content={{ v.error_msg }} data-trigger="hover" rel="popover"
>   data-original-title="Error Title" {% endif %}
>   class="label extra-label label-pill label-{{ v.show_class | safe }}">
> {{ v.get_human_status }}
>
>
> where v.error_msg is the string above. It should be noted that all other 
> attributes works just fine
>
>
> I wrapped the template in
> {% autoescape on %}
> ...template content...
>
> {% endautoescape %}
>
>
> Then I tried using the escape/force_escape tag on the problematic string:
>
> {{ v.error_msg | force_escape }}
>
> Nothing works, the output is only escaped once:
>
> data-content="'NoneType'" object has not attribute 'rfind'
> Which causes the resulting popover to show only with the message 'NoneType'.
>
> What am I doing wrong? Why isn't the string properly escaped?
>
>
> I'm using Djagno 1.5.11, but this syntax was defined well before version 
> 1.5.11, so I don't think it's a version issue.
>
> It's a minor issue but it's driving me mad.
>
>
> Thanks,
>
> Ron
>
> --
> 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/94b82a29-4036-48eb-b339-e3068bac5e0d%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/94b82a29-4036-48eb-b339-e3068bac5e0d%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
*Julio Biason*, Sofware Engineer
*AZION*  |  Deliver. Accelerate. Protect.
Office: +55 51 3083 8101   |  Mobile: +55 51
*99907 0554*

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


Re: how do I make django search for male or female without needing to specify an age?

2018-01-26 Thread Julio Biason
x27;:
>> q = context['child_filter'].filter
>> (Q(age=request.POST['age']))
>>
>> # start of output using search parameters
>>
>> if q.count() > 1:
>>   search_message = "There are %s children that match your
>> selection of %s"  %  (q.count(), request.POST['gender'])
>> else:
>>   search_message = "There is 1 child that matches your
>> selection of %s"  %  (request.POST['gender'])
>>
>> if q.count() > 1:
>>search_message = ", age: %s"  %  (request.POST['age'])
>> else:
>>search_message = ", age: %s"  % (request.POST['age'])
>>
>> context['child_filter'] = q
>> context['filter_form'] = FilterForm()
>> context['activestep'] = "1"
>> context['search_message'] = search_message
>> extra_context = {"message": "Updating filter"}
>> context.update(extra_context or {})
>> return TemplateResponse(request, templates, context)
>>   else:
>>   context['filter_form'] = form
>>   extra_context = {"message":"Something went wrong"}
>>   context.update(extra_context or {})
>>   return TemplateResponse(request, templates, context)
>>
>> else:
>> context.update(extra_context or {})
>> return TemplateResponse(request, templates, context)
>>
>>
>> def child_detail(request, template="pages/sponsorship.html",
>> extra_context=None, pk=None):
>> templates = []
>> templates.append(template)
>> children = Child.objects.filter(pk=pk)
>>
>> if request.method == "GET":
>> context = {"child_filter": children, "filter_form": FilterForm(),
>> "steps": steps, "activestep": "3"}
>> else:
>> context = {"child_filter": children, "filter_form": FilterForm(),
>> "steps": steps, "activestep": "4"}
>>
>> context.update(extra_context or {})
>> return TemplateResponse(request, templates, context)
>>
>>
>> def final_order_handler(request, order_form, order):
>> """
>> Default order handler - called when the order is complete and
>> contains its final data. Implement your own and specify the path
>> to import it from via the setting ``SHOP_HANDLER_ORDER``.
>> """
>> child_id = order.items.all()[0].child_id
>> if child_id != "":
>> child = Child.objects.get(child_id=child_id)
>> current_customer = Customer.objects.get(user=request.user)
>> child.sponsor = current_customer
>> child.save()
>>
>> --
> 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/b2510159-5162-4c5b-9b57-7847f42b0a0a%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/b2510159-5162-4c5b-9b57-7847f42b0a0a%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
*Julio Biason*, Sofware Engineer
*AZION*  |  Deliver. Accelerate. Protect.
Office: +55 51 3083 8101   |  Mobile: +55 51
*99907 0554*

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


Re: chemistry character set

2018-02-06 Thread Julio Biason
Hi Mike,

One thing that occurs me is that you can override the model save() to
update another field -- one that the user doesn't have access. On that
function, you will write a new field, say `sortable_name` in which you'll
transfor the chemical name into something that will appear in the proper
order, like converting alphas to A, betas to B, etc.

When you request the list of chemicals by name order, you actually use the
`sortable_name` field, which will have all the conversions in place.

On Mon, Feb 5, 2018 at 9:55 PM, Mike Dewhirst  wrote:

> Chemical names start with both upper and lower case as well as Greek
> characters. Chemical names also exist in multiple non-western non-latin
> languages.
>
> To get lists of chemicals sorting more or less "correctly" I currently
> slugify with allow_unicode=True.
>
> This for example gets tert-Butyl... sorted nicely among names starting
> with upper-case T.
>
> Unfortunately the α-terpineol or beta this or  ε that all sink to the end
> of the list instead of sorting into the A, B or Es.
>
> My google-fu indicates I can sort on a property but that is slow. I have
> thought about tweaking slugify to include a table of equivalences between
> Greek and Western chars but that doesn't necessarily cater for non-Western
> character sets. Maybe an ever expanding table of equivalences?
>
> Thanks for any ideas ...
>
> Mike
>
> --
> 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/ms
> gid/django-users/4160ee4d-8b36-1118-1bec-2ba8ab40d891%40dewhirst.com.au.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
*Julio Biason*, Sofware Engineer
*AZION*  |  Deliver. Accelerate. Protect.
Office: +55 51 3083 8101   |  Mobile: +55 51
*99907 0554*

-- 
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/CAEM7gE1%3DDRwnaOjJhf63EPXzjKGv083M-NNwCN7%2BfhbgeZRz-Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: NoReverseMatch error raise when adding a new entry in django admin

2018-02-12 Thread Julio Biason
formation
> city = CityCodeField(verbose_name='城市', null=True, blank=False)
> org = CodeField(verbose_name='学校或组织机构代码', null=True, blank=True, db_index=
> True)
> textbookcode = LabelCodeField(verbose_name='教材(标签代码)', help_text='请填写标签代码',
> null=True, blank=True, db_index=True)
> gradecode = LabelCodeField(verbose_name='年级/级别(标签代码)', help_text='请填写标签代码',
> null=True, blank=True, db_index=True)
> #role
> role = UserRoleField(verbose_name='角色', null=False, blank=False, 
> choices=UserRole_CHOICES,
> default=UserRole.user.name)
> ### teacher specific attributes ###
> synopsis = models.TextField(verbose_name='个人简介', max_length=500, null=True,
> blank=True)
> workhistory = models.TextField(verbose_name='工作经历', max_length=500, null=
> True, blank=True)
> cert = models.TextField(verbose_name='荣誉证书', max_length=500, null=True,
> blank=True)
> labels = models.CharField(verbose_name='个人标签', max_length=100, null=True,
> blank=True)
> scope = models.CharField(verbose_name='出题范围', help_text='老师的出题范围,仅对老师角色有效',
> max_length=100, null=True, blank=True)
> title = models.PositiveIntegerField(verbose_name='头衔级别', null=False, blank
> =False, default=1, db_index=True)
> ### promotion and relation ###
> promotioncode = PromotionCodeField(verbose_name='推荐码', help_text=
> '用于推荐其他用户或者老师', null=True, blank=True)
> broker_promote = UIDField(verbose_name='推荐者用户ID', null=True, blank=True,
> db_index=True)
> broker_firstserve = UIDField(verbose_name='首服老师用户ID', null=True, blank=
> True, db_index=True)
>
> class Meta:
> verbose_name = '用户信息'
> verbose_name_plural = '用户信息'
>
> *---here is the admin class---*
> class UserProfileAdmin(admin.ModelAdmin):
> # list page
> list_display = ('date_joined', 'uid', 'user', 'tel', 'imuid', 'nickname',
> 'role', 'city', 'level', 'title', 'status', 'promotioncode',
> 'broker_promote', 'broker_firstserve', )
> list_display_links = ('uid', )
> ordering = ('uid', )
> search_fields = [
> '=uid',
> '=tel',
> 'nickname',
> 'user__username',
> ]
> list_filter = ('role', 'city', 'level', 'title', 'status', )
>
> def date_joined(self, obj):
> return obj.user.date_joined
>
> date_joined.admin_order_field = 'user__date_joined'
> date_joined.short_description = '注册日期'
>
> def save_model(self, request, obj, form, change):
> if not obj.broker_promote:
> obj.broker_promote = None
> if not obj.broker_firstserve:
> obj.broker_firstserve = None
> super(UserProfileAdmin, self).save_model(request, obj, form, change)
>
>
>
> --
> 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/76957a17-da3e-40c4-ba2b-2de780f2da4e%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/76957a17-da3e-40c4-ba2b-2de780f2da4e%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
*Julio Biason*, Sofware Engineer
*AZION*  |  Deliver. Accelerate. Protect.
Office: +55 51 3083 8101   |  Mobile: +55 51
*99907 0554*

-- 
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/CAEM7gE1Wv%3DsEQatBSTWgcv0%3DRQf0%2BFbk_kxC_YrWZi48O2%2B0oQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: When do I need a new app within the site?

2018-02-28 Thread Julio Biason
Hi Andreas,

My rule of thumb is "does this works without the other?" Do your customer
app works without the booking app? Then they are two different apps, with
the second using the first as dependency.

But, then again, I had some people suggesting this wasn't good enough (for
deployment reasons, IIRC). I still use on my personal projects, though.

On Thu, Feb 22, 2018 at 5:44 AM, Cictani  wrote:

> Hi,
>
> I'm just beginning developing a new app(s) and I'm wondering when I need
> to add a new app. if one app uses models from another app is that a hint
> that these two apps are acutally one app or is this still ok in terms of
> good design?
>
> Let's say I have a customer app (with customer models, admins etc) and a
> booking app which of course uses the customer model. Would it be good to
> have two apps or would it be actually only a booking app which includes all
> the models, logic etc from the customer app?
>
> Thanks in advance
>
> Andreas
>
> --
> 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/65aac79d-064f-4142-96e0-4f9592cd6862%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/65aac79d-064f-4142-96e0-4f9592cd6862%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
*Julio Biason*, Sofware Engineer
*AZION*  |  Deliver. Accelerate. Protect.
Office: +55 51 3083 8101   |  Mobile: +55 51
*99907 0554*

-- 
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/CAEM7gE219JrG0p8qeOtRQqL-kd19hPMFvy%3DxHfrkeVVH%2BqLGLg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Fetching next and/or prior objects given an arbitrary ordering

2018-02-28 Thread Julio Biason
Hi Bernd,

Well, the thing with `get()` is that it will return only one object. What
you're looking for is `filter()`.

Say, you want all the things that have an ID after a certain value. So you
get `list_of_things = Things.objects.filter(pk__gte=...)`. Now it'll return
the list, with all elements after the one you asked.

If you want the previous and next, you can do `list_of_previous =
Things.objects.filter(pk__lt=...).limit(1)` and `list_of_next =
Things.objects.filter(pk__gt).limit(1)`.

Or something like that ;P

On Wed, Feb 28, 2018 at 8:56 AM, Bernd Wechner 
wrote:

> I'm a bit stumped on this. Given an arbitrary ordering as specified by the
> ordering meta option:
>
> https://docs.djangoproject.com/en/2.0/ref/models/options/#ordering
>
> for example:
>
> class Thing(models.Model):
> field1 = ...
> field2 = ...
> field2 = ...
> class Meta:
> ordering = ['field1', '-field2', 'field3']
>
> given an instant of Thing:
>
> thing = Thing.objects.get(pk=...)
>
> how can I get the next Thing after that one, and/or the prior Thing before
> that one as they appear on the sorted list of Things.
>
> It's got me stumped as I can't think of an easy way to build a filter even
> with Q object for an arbitrary ordering given there can be multiple fields
> in ordering and multiple Things can have the same ordering list (i.e. there
> can be ties - that Django must resolve either arbitrarily or with an
> implicit pk tie breaker on ordering).
>
> It's got me stumped. I can solve any number of simpler problems just not
> his generic one (yet).
>
> Ideally I'd not build a list of all objects (waste of memory with large
> collections), and look for my thing in the list and then pick out the next
> or prior.
>
> I'd ideally like to fetch it in one query returning the one Thing, or if
> not possible no worse than returning all Things on side of it and picking
> off the first or last respectively (even that's kludgy IMHO).
>
> I'm using postgresql and I found a related question here:
>
> https://dba.stackexchange.com/questions/53862/select-next-
> and-previous-rows
>
> but would rather stick with the ORM and not even explore SQL (just took a
> peak to see SQL can be constructed to do it I guess, as if not, the ORM
> sure won't have a good way of doing it methinks).
>
> I'd have thought this a sufficiently common use case but am perhaps wrong
> there, with most sites exploiting simple orderings (like date_time or
> creation say). But I want to build a generic solution that works on any
> model I write, so I can walk through the objects in the order specified by
> ordering, without building a list of all of them. In short I want to solve
> this problem, not reframe the problem or work around it ;-).
>
> Regards,
>
> Bernd.
>
> --
> 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/751c367c-d5e9-e06b-8f5c-82054f11a9ab%40gmail.com
> <https://groups.google.com/d/msgid/django-users/751c367c-d5e9-e06b-8f5c-82054f11a9ab%40gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
*Julio Biason*, Sofware Engineer
*AZION*  |  Deliver. Accelerate. Protect.
Office: +55 51 3083 8101   |  Mobile: +55 51
*99907 0554*

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


Re: Why doesn't Django support managing Raw SQL changes using migration system like models

2018-02-28 Thread Julio Biason
Hi Cmp,

Well, Django has to be database agnostic for things to work with any
database. If raw sql is allowed, how do you can be sure it will work with
any database?

So far, you mentioned a bunch of PostreSQL things. But what if, tomorrow,
some higher ups decided that support is required and buy Oracle (because
higher ups usually aren't that smart). How things will work? How do you
make sure your raw SQL commands will work? (IIRC, there are differences in
SQL/DML between Oracle and MySQL).

The biggest problem I see is that you're using triggers. Django knows
nothing about them and since you're giving the database control to Django
(via its migrations and querysets), you should relegate all the things to
Django. And yes, there are drawbacks on that too, but still, everything
should be one single place -- and if you need other systems to add data to
your database, you should provide them with an API instead of letting them
add directly to the database.

The biggest problem I see on your solution, is that your giving powers over
your data to two different things -- Django and the database via triggers
-- and that's the first step into mess.

PS: 76 migrations is still nothing. I worked with databases with 150+
migrations, and nobody cared about what the migrations did, because the
models -- in their current, up-to-date form -- is the canonical
representation of the data. All those 150+ migrations were just the way to
reach the current state.

On Tue, Feb 27, 2018 at 8:53 PM, cmp  wrote:

> I have an problem that I wanted to solve recently using a Postgres Trigger
> + Procedure that I do not want to do via Signals or within Python itself.
>
> I want to make a log which when an entry is created the result is applied
> to a row. We need the log to be the source of truth and I don't want to
> write a whole async system using something like Kafka or whatever everyone
> recommends.
>
> The issue here is that I need to iterate on the procedure which updates
> the rows as features come along and make it easy for other developers to
> find/read/etc.
>
> Django only allows storing things like this as RawSql migration commands
> inside the migrations folder but this App already has 76 migrations and I
> think it's probably unreasonable for me to assume a normal django developer
> will think to read all those migrations without running in to some problem
> with my triggers. Not to mention the main block of sql will need to be copy
> and pasted between changes to new migrations... etc.
>
> This seems like something the migration system should support somehow.
>
> I found a package which seems to do this, but it appears unmaintained
> (little to no activity): https://github.com/klichukb/django-migrate-sql
>
> I think it'd be a nice feature for Django to support maintaining a set of
> Raw SQL via the migration system so more advanced features of databases can
> be used.
>
> For instance in Postgres setting up other things like full text search and
> special search indexes were difficult in 1.8. I realize it's easier since
> 1.10 to add a full text search index, but adding that feature is much more
> difficult than the RawSQL migrations we did to implement adding the index
> before.
>
> Making it easy to manage triggers and procedures via the migration system
> is very difficult, but I think supporting RawSQL items which are managed
> via migrations would be relatively easy to implement and add a lot of value.
>
> I'm posting this for two reasons: 1) I think it's a good idea and 2) to
> let others show me where I'm missing something or why this wouldn't be a
> good fit for Django.
>
> --
> 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/8043d044-3f7c-4bd2-bdc4-c504faf5120b%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/8043d044-3f7c-4bd2-bdc4-c504faf5120b%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
*Julio Biason*, Sofware Engineer
*AZION*  |  Deliver. Accelerate. Protect.
Office: +55 51 3083 8101   |  Mobile: +55 51
*99907 0554*

-- 
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

Re: How to access the key attributes of a model

2018-03-02 Thread Julio Biason
Hi Alberto,

I'm guessing `def blog(request):` is actually `blog_category_posts`, right?
Because you have `` on your URL, our view will receive it as another
parameter, after request. So it should be `def
blog_category_posts(requests, slug):` and then you can get the slug, filter
the posts and return them to the template.

On Thu, Mar 1, 2018 at 7:37 PM, Alberto Sanmartin <
albertosanmartinmarti...@gmail.com> wrote:

> This is mi code:
>
> models.py:
>
> @autoconnect
> class Category(models.Model):
> name = models.CharField(max_length=100)
> slug = models.CharField(max_length=100, blank=True)
> description = models.CharField(max_length=200)
> creation_date = models.DateTimeField(auto_now_add=True)
>
> def __unicode__(self):
> return self.name
>
> def pre_save(self):
> """metodo de la clase Category para calcular el slug de una
> categoria"""
> self.slug = self.name.replace(" ", "_").lower()
> print(self.slug)
>
>
> @autoconnect
> class Post(models.Model):
> Status = ((1, "Publicado"), (2, "Borrador"), (3, "Eliminado"))
> status = models.IntegerField(choices=Status, default=2, blank=False)
> title = models.CharField(max_length=100, blank=False)
> slug = models.CharField(max_length=100, default=' ', blank=True)
> description = models.CharField(max_length=200, blank=False)
> content = models.TextField(default=" ", blank=False)
> category = models.ForeignKey(Category, default=1, blank=False)
> creation_date = models.DateTimeField(auto_now_add=True)
> image = models.ImageField(upload_to="photos", default='/image.jpg',
> blank=False)
> author = models.ForeignKey(User, default=1)
>
> views.py:
>
> def blog(request):
> posts = models.Post.objects.filter(status=1).order_by("-creation_
> date")
> print(posts)
> categories = models.Category.objects.order_by("name")
> context = {
> "posts":posts,
> "categories":categories
> }
> return render(request, "blog.html", context)
>
> urls.py:
>
> url(r'^blog/categorias/(?P\w+)/$', views.blog_category_posts,
> name='blog_category_posts'),
>
> blog.html:
>
> {% for post in posts %}
> {{ post.title }}
> {{ post.description }}
> {{ post.category.name }}
> {{ post.author.username }}
> {{ post.creation_date }}
> {% endfor %}
>
> When I click on the link of the category in the blog.html, I want to be
> able to pass the attribute slug to url, but it does not work.
> Please help
> Thanks 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/dccfe67f-c6cc-4239-91ef-2c9a85b43099%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/dccfe67f-c6cc-4239-91ef-2c9a85b43099%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
*Julio Biason*, Sofware Engineer
*AZION*  |  Deliver. Accelerate. Protect.
Office: +55 51 3083 8101   |  Mobile: +55 51
*99907 0554*

-- 
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/CAEM7gE2O3Yq32-U1BxZJtqOtVmP%2BCdyZTdk6itk9Fz%3DShxs-Ow%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How can i use google finance client in django?

2018-03-19 Thread Julio Biason
Sorry, Rakibul, but your question is too broad — there is no way to tell you 
something because we don’t know what you’re trying to achieve.

For example:

Are you looking for a Python client for Google Finance? Did you found a library 
for that already? Do you know how to use it? What exactly it will do along with 
your Django project? How do you plan to integrate with Django? Will the user 
fill a form and then you’ll retrieve the information?

There are too many questions about your question to actually give you a proper 
answer.

> On 17 Mar 2018, at 09:42, rakibul  wrote:
> 
> I want to use google finance client in python then i want to use some 
> functionality to my django project.please 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/15466f57-4226-4ebc-8b86-4207ed9bdaa4%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/D3E5C1D7-CAFB-47E0-B881-FEBB3EBE6F77%40azion.com.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: Message signed with OpenPGP


Re: Finding a decent ordering widget ...

2018-03-21 Thread Julio Biason
Hi Bernd,

A bit of this "k anbd drag lines up and down to reposition them" is done by
jQuery UI, in its "Draggable" functionality:
https://jqueryui.com/draggable/#sortable

Not sure if that helps, though, 'cause you could provide functionality to
reorder using plain JS, just reordering divs around moving the DOM around.

On Wed, Mar 21, 2018 at 6:54 AM, Bernd Wechner 
wrote:

> Hmmm, my next problem.
>
> I envisage a widget which is kind of like a HTML textarea, but basically
> each line would hold the name of a field say, and I'd like a user to be
> able to order the lines, not change the text. Basically click anbd drag
> lines up and down to reposition them.
>
> I've poked around for HTML widgets for a bit now and find my main handicap
> is I'm not even sure how to describe this in terse search terms.
>
> I know I've seen such widgets in practice - I didn't invent the idea ;-) -
> but have till now never needed one and suddenly I'm left wondering if there
> is one out there somewhere, and/or how I'd go about finding one. No real
> desire to try and build one with javascript right now, not least given I'm
> confident it exists already and I just don't know what it's called, how to
> describe it well or find it and well, DRY, I don't like spending my time
> recreating widgets that exist already. Not a priority.
>
> Does anyone here have any experience? Places tom look, terms to use in
> searching for one?
>
> Regards,
>
> Bernd.
>
> --
> 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/5ce7a37d-c5c1-4460-84a9-cb8974a86a6a%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/5ce7a37d-c5c1-4460-84a9-cb8974a86a6a%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
*Julio Biason*, Sofware Engineer
*AZION*  |  Deliver. Accelerate. Protect.
Office: +55 51 3083 8101   |  Mobile: +55 51
*99907 0554*

-- 
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/CAEM7gE1mJauZfCt9hDV%2BeU%2B28WC-%2BCd54EK0QVw1mfd02-OA9A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django and graphs

2018-03-23 Thread Julio Biason
... and although ugly, you can render your data as a javascript object on
your template and use any graph rendering library, like jqplot.

On Fri, Mar 23, 2018 at 11:04 AM, Derek Zeng  wrote:

> What do you mean by Django extension?
> You can just use the Networkx in any django view controller and render the
> graph to svg using GraphViz. You can save the svg in database and then
> render it in a webpage.
>
> On Thursday, March 22, 2018 at 3:36:22 PM UTC-4, Mohsen wrote:
>>
>> Hi all:
>>
>> I am quite new to Django, and I am looking for Django extensions that
>> support graphs and networks. Would anybody guide me with a tutorial or some
>> hints how we may use Django together with Networkx or SNAP graph library
>> packages.
>>
>> Many thanks
>>
>> Mohsen
>>
> --
> 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/fc058693-64cf-480d-a513-0b6f35531451%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/fc058693-64cf-480d-a513-0b6f35531451%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
*Julio Biason*, Sofware Engineer
*AZION*  |  Deliver. Accelerate. Protect.
Office: +55 51 3083 8101   |  Mobile: +55 51
*99907 0554*

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


Re: Having ERROR running Django project !!!

2018-03-26 Thread Julio Biason
Hi Jamaldin,

Kinda hard to help you here, because there is a lot of information lacking.
Like, do you see any errors on your logs? Are you running in dev
environment (like in `python manage.py runserver`) or are you running with
a webserver (nginx) in front of it? Are you using
wsgi/gunicorn/any-other-wsgi-server? Do you see anything weird in their
logs?

On Mon, Mar 26, 2018 at 12:17 PM, Jamaldin Pro 
wrote:

> Hello
> I was creating a Djnago project and when I finish it, it was working
> perfectly but when I start adding ("name"/"text"/"information") to models
> from admin page, It stops working I mean after adding I can't open my home
> page. *If I will try to open it, it auto downloads unknown file*.
>
> *I NEED HELP AS SOON AS POSSIBLE* !!!
>
> Thank u.
>
> --
> 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/ff450a0d-4e9a-47b6-a132-3e216fbd98ef%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/ff450a0d-4e9a-47b6-a132-3e216fbd98ef%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
*Julio Biason*, Sofware Engineer
*AZION*  |  Deliver. Accelerate. Protect.
Office: +55 51 3083 8101   |  Mobile: +55 51
*99907 0554*

-- 
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/CAEM7gE2K-%2Bn5hjwQr_QWYDBnvpYyO4CAX%3DX-czJshX21n%2BqiHQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to upload and save excel data in database django

2018-03-29 Thread Julio Biason
Hi,

I'd export the data to CSV (which is easier to parse), create a Django
Command (
https://docs.djangoproject.com/en/2.0/howto/custom-management-commands/#module-django.core.management)
that will open the CSV and then add the records.

On Thu, Mar 29, 2018 at 7:03 AM, arvind yadav <
developer.arvind2...@gmail.com> wrote:

> this is may data format
>
>
> <https://lh3.googleusercontent.com/-7kQ1LYEV_RU/Wry5dGEAl0I/AvY/dfhNggR1zD8GlbHEIeYLmAj8L_z44dZgQCLcBGAs/s1600/data.png>
> from django.db import models
> class RegisterMember(models.Model):
> GENDER_CHOICES = (
> ('M', 'Male'),
> ('F', 'Female'),
> )
> id = models.AutoField(db_column='ID', primary_key=True)
> name = models.CharField(db_column='NAME', max_length=255)
> email = models.CharField(db_column='EMAIL', max_length=255)
> phone = models.CharField(db_column='PHONE', max_length=5000,
> blank=True, null=True)
> address = models.CharField(db_column='ADDRESS',max_length=255)
> gender = models.CharField(max_length=1, choices=GENDER_CHOICES)
>
> --
> 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/ff305a58-0bf3-4f3e-9edf-adf7db879b80%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/ff305a58-0bf3-4f3e-9edf-adf7db879b80%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
*Julio Biason*, Sofware Engineer
*AZION*  |  Deliver. Accelerate. Protect.
Office: +55 51 3083 8101   |  Mobile: +55 51
*99907 0554*

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


Re: Infinite scrolling, Ajax, Phone or PC?

2018-04-02 Thread Julio Biason
Hi Jamaldin,

Yeah, there is nothing to do with Django, except for a part in the infinite
scrolling.

For infinite scrolling, you'll keep loading more data from the server and
adding it to the DOM when the page position reaches a certain point. Both
of those can be done with jQuery, for example, but you'll need to write
both the checker for position, loading more data and appending to the DOM
using JavaScript. The only difference is that instead of loading all the
page, you'll return only your list, either as a JSON to be "templated" by
JavaScript or returning the piece of HTML you want to add (basically, your
template won't need to `{% extend "base.html" %}`, so to say.)

Going through pages without reloading is, again, a job for JavaScript. You
basically do the same thing you did above, but instead of appending more
stuff to the DOM, you replace it.

For buttons, you can check the user agent (which you can get from
`request.meta['USER-AGENT']` on your views). But you'll need a bunch of
list of browsers and it's not really reliable (people can replace the user
agent at free will, with extensions). One solution would use the viewport
size (the area available for the browser to render) and do that directly in
JS or event CSS -- check Bootstrap "hide-xs" and the likes.

But, again, your questions are more towards JavaScript than Django.

On Mon, Apr 2, 2018 at 10:44 AM, Jamaldin Pro 
wrote:

>  Hello.
>
>How can I make Infinite scrolling html? example: https://www.megacom.
> kg/hype/ru.html#instruction
>How can I go from first url to another without reloading the website?
>How can I know if the user is entering my website from phone or pc? If
> user is entering from phone it should show the Whatsapp button and If user
> is entering from PC it should hide it.
>
> " I can't find any place to ask this thing, and this place might be the
> wrong place. SORRY if it is like that. If you can answer even one of this
> answer it plz "
>
> Thank 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/16c617ca-c229-4056-b0de-8e5f1424dc00%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/16c617ca-c229-4056-b0de-8e5f1424dc00%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
*Julio Biason*, Sofware Engineer
*AZION*  |  Deliver. Accelerate. Protect.
Office: +55 51 3083 8101   |  Mobile: +55 51
*99907 0554*

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


Re: Display Many to Many Field in Django admin site

2018-04-03 Thread Julio Biason
It seems your `get_ingredients()` is expecting the Product itself and
another object (for some reason).

Have you tried to remove `obj` from the parameters and use `self` in that
function?

On Tue, Apr 3, 2018 at 12:22 PM, mansi thakkar 
wrote:

> Hello ,
>
> In my database, there is one table named Product and the other table is
> Ingredient. Both are related with ManyToMany Relationship using bridge
> entity (table) named ProductIngredient.
>
> I am trying to display Many To Many field named ingredient in my Django
> admin site.
>
> Here is the attached code and screen shot of the error.
>
> I would like to know the solution of this error and also any other way to
> display  the list of ingredients for each product.
>
> Thank 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/63c89597-39c0-4765-ab43-4df41e729f4b%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/63c89597-39c0-4765-ab43-4df41e729f4b%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
*Julio Biason*, Sofware Engineer
*AZION*  |  Deliver. Accelerate. Protect.
Office: +55 51 3083 8101   |  Mobile: +55 51
*99907 0554*

-- 
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/CAEM7gE2ufSQNgKq-jrY3WBPM9N8Jd4b%3DZL%2B%3DxvLPgC-fepCXEQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: new Feature: yay or neigh?

2018-04-07 Thread Julio Biason
My 2 cents:

1.  Django )and it's template system) runs on server. When I'll the serve not 
have a connection? If the sever doesn't have a connection, it will not sis 
anyway.

2.  What you want is probably develop a PWA with offline support. This is kinda 
built in in most browse using webworkers.

Get Outlook for iOS

From: django-users@googlegroups.com  on behalf 
of Melvyn Sopacua 
Sent: Saturday, April 7, 2018 12:46:45 AM
To: django-users@googlegroups.com
Subject: Re: new Feature: yay or neigh?

On zaterdag 7 april 2018 09:02:52 CEST Samuel Muiruri wrote:
> Hey guys,
> Think this would be a neat feature to add to django.
>
> {% if request.connection %}
> #if there's a connection to the internet returns True, by default tries
> to connect to google
> {% else %}
> #could for example load local js/css files instead of from cdn
> {% endif %}

Neigh. Think about what you're proposing here:

> {% if request.connection:"http://www.somesite/service"; %}

So on the incoming browser request object you instantiate a connection from
your server to some site. This by no means ensures that the browser can
connect to that service.
There's also no way to "tell the browser to check availability to that site",
because once the request object is created in Django the browser has already
sent the request - it's not two-way communication.

This should be handled in javascript and Django cannot do anything for you
here as it's not part of the problem.
--
Melvyn Sopacua

--
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/3237607.4kOfbIVUhA%40fritzbook.
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/DM5PR18MB14199C9664AB49D01335B563AEB90%40DM5PR18MB1419.namprd18.prod.outlook.com.
For more options, visit https://groups.google.com/d/optout.


Re: Help: 'django.utils.six.moves' is not a package

2018-04-10 Thread Julio Biason
Six is self-contained it does look anywhere, it has its own list of "how it was 
before and how it is now".

In the case of moves, it has conditions of "module urlparse is urlparse in 
python 2 and urllib.parse in python 3" and then sets its own move module to 
point to one of those, based on python version.

It's weird that it can find six, but not the "moves" module. Have you tried 
deleting your virtual end and creating it again, with the new versions?

Get Outlook for iOS

From: django-users@googlegroups.com  on behalf 
of Derek Zeng 
Sent: Tuesday, April 10, 2018 10:31:27 AM
To: django-users@googlegroups.com
Subject: Re: Help: 'django.utils.six.moves' is not a package



On Tue, Apr 10, 2018, 1:39 AM Babatunde Akinyanmi 
mailto:tundeba...@gmail.com>> wrote:


On Tue, 10 Apr 2018, 02:47 Derek Zeng, 
mailto:zen1...@gmail.com>> wrote:
I'm using django 2.0.
What exactly is the purpose of django.utils.six.moves module?
Allowing a code base to be able to run on both python 2 and python 3

yeah, but what role does moves module play here? if an old module is not found 
here, where does it look for it?


I have read the source but don't quite understand. Seems like a poly-fill of 
pre-existing libraries like urllib


On Mon, Apr 9, 2018 at 3:47 PM, Avraham Serour 
mailto:tovm...@gmail.com>> wrote:
sounds like django 2 removed six and some library you are using still hopes it 
exists.

what django version are you using?

On Mon, Apr 9, 2018 at 3:39 AM, Derek Zeng 
mailto:zen1...@gmail.com>> wrote:
I got the following error when running pytest in django. Help is appreciated.

This is the test I run

import pytest
from .factories import *

@pytest.mark.django_db
def test_with_client(client):
  PostFactory.create() # if commented out, the error is gone
  response = client.get('/')

  body = str(response.content)
  assert 'Mysite' in body

PostFactory creates a Post object in the database


apps/blog/tests/test_post.py:5 (test_with_client)
client = 
@pytest.mark.django_db
def test_with_client(client):
p = PostFactory.create()

> response = client.get('/')
blog/tests/test_post.py:10:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../../../.virtualenvs/django/lib/python3.6/site-packages/django/test/client.py:517:
 in get
response = super().get(path, data=data, secure=secure, **extra)
../../../../.virtualenvs/django/lib/python3.6/site-packages/django/test/client.py:332:
 in get
return self.generic('GET', path, secure=secure, **r)
../../../../.virtualenvs/django/lib/python3.6/site-packages/django/test/client.py:404:
 in generic
return self.request(**r)
../../../../.virtualenvs/django/lib/python3.6/site-packages/django/test/client.py:467:
 in request
response = self.handler(environ)
../../../../.virtualenvs/django/lib/python3.6/site-packages/django/test/client.py:125:
 in __call__
self.load_middleware()
../../../../.virtualenvs/django/lib/python3.6/site-packages/django/core/handlers/base.py:37:
 in load_middleware
middleware = import_string(middleware_path)
../../../../.virtualenvs/django/lib/python3.6/site-packages/django/utils/module_loading.py:17:
 in import_string
module = import_module(module_path)
../../../../.virtualenvs/django/lib/python3.6/importlib/__init__.py:126: in 
import_module
return _bootstrap._gcd_import(name[level:], package, level)
:994: in _gcd_import
???
:971: in _find_and_load
???
:955: in _find_and_load_unlocked
???
:665: in _load_unlocked
???
:678: in exec_module
???
:219: in _call_with_frames_removed
???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
from __future__ import absolute_import

import re

from django import http
from django.apps import apps
from django.utils.cache import patch_vary_headers
> from django.utils.six.moves.urllib.parse import urlparse
E ModuleNotFoundError: No module named 'django.utils.six.moves.urllib'; 
'django.utils.six.moves' is not a package
../../../../.virtualenvs/django/lib/python3.6/site-packages/corsheaders/middleware.py:8:
 ModuleNotFoundError


--
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/23957c7e-9aca-4494-a06a-20cbf0fc857b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to a topic in the Google 
Groups "Django users" group.

Re: if statement for development/production mode in templates?

2018-04-23 Thread Julio Biason
You could, on your views, get the DEBUG setting (using django.conf) and pass it 
to the templates, as you do with all other variable.


From: django-users@googlegroups.com  on behalf 
of Alexander Joseph 
Sent: Monday, April 23, 2018 10:55:52 AM
To: Django users
Subject: Re: if statement for development/production mode in templates?

I dont know what that means

On Monday, April 23, 2018 at 7:49:25 AM UTC-6, larry@gmail.com wrote:
On Mon, Apr 23, 2018 at 9:34 AM, Alexander Joseph
 wrote:
> Hello, is there a way to make an if statement that is based on whether you
> are running in development mode or production mode? Or based on which
> settings file you are using?
>
> My app allows users to login with their office365 account instead of with
> django allauth and I'd like to only give them that option, however I do need
> to login with allauth while developing because the settings for logging in
> to Office365 dont work with a development server. So I'd like to display the
> allauth login form and allow the user to login if it is in development mode,
> otherwise I'd only like to display the Office365 login.

Just pass in something in the context from the server to the template
and test that.

--
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/5aae6def-df66-40a1-90cc-733b2afa22b1%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/DM5PR18MB14191215E1DA33E55F88F380AE890%40DM5PR18MB1419.namprd18.prod.outlook.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django performances issue

2018-05-02 Thread Julio Biason
Hi Prakash,

Do you need to answer the PDF directly? I mean, can't you just use the API
to async-ly create the PDFs (using Celery, for example) and just return a
jobId of sorts? The use will, then, make calls to check the jobid status;
when the PDF is done, the job is changed to complete and you let the user
use another URL to download said PDF.

On Wed, May 2, 2018 at 9:59 AM, prakash sharma 
wrote:

> I have developed the API using DRF but facing the major performances issue.
>
> Here is what the scenario is: I am using DRF. Our API call is growing
> towards 5k per day. Each API call is taking 3 to 10 minutes of time while
> responding ( as It creates upto 300 pdf label unique format)
>
> I am using uwsgi( many worker) now with the Apache.
>
> We have implemented the caching but not able improve very much
> performances level.
>
> Primary query:
>
> Shall we use gunicorn instead of uwsgi? What about message/ job queue? Is
> this work.
>
> My current server RAM is only 32 GB. Shall I have to increase this if yes
> how much ( we personal don't want to go for vertical scaling)
>
> Please suggest the approach, first time I am handling such level of
> performance issue.
>
> I am very optimistic about message/ job queue and gunicorn.
>
> --
> 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/86e487d8-6dfe-4049-89a6-5e90a9175d48%40googlegroups.com
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
*Julio Biason*, Sofware Engineer
*AZION*  |  Deliver. Accelerate. Protect.
Office: +55 51 3083 8101   |  Mobile: +55 51
*99907 0554*

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


Re:

2018-05-07 Thread Julio Biason
Hey Aayush,

Can you past the full error? It's kinda hard to see what's wrong with just
that description.

Aside from that, you can:

- Make sure you have your virtualenv up.
- Check the library is really installed (you can run `pip freeze` to see
which libraries you have installed in the virtualenv)
- Check the name; sometimes, the library name does not reflect the import
names.

On Sun, May 6, 2018 at 11:44 AM, Aayush Khandelwal <
aayushkhandelw...@gmail.com> wrote:

> Having error import name patterns ,I even downloaded it but still getting
> error what to do to sort it out
>
> --
> 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/CACVE4Jk%3DN%3DObdHLxt2Vj6avkywL-QxRya%
> 2BC0Bo6CHS3jTE6MiA%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CACVE4Jk%3DN%3DObdHLxt2Vj6avkywL-QxRya%2BC0Bo6CHS3jTE6MiA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
*Julio Biason*, Sofware Engineer
*AZION*  |  Deliver. Accelerate. Protect.
Office: +55 51 3083 8101   |  Mobile: +55 51
*99907 0554*

-- 
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/CAEM7gE0ijM%3DAAQZ7EzSFW9efDjLRh0m-%2Be8hSxtPp%3Dzn64J96A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: While going through Django tutorial i commited an error because of which i am not able to execute python manage.py runserver. The exceptions and codes are mentioned below: In exception it is menti

2018-05-08 Thread Julio Biason
ssage': "you didn't select a choice.",
> })
> else:
> selected_choice.votes +=1
> selected_choice.save()
> #...
> #...
> #...
> return HttpResponseRedirect(reverse('polls:results', args=(question.id,)))
>
> index.html:
>
> {% if latest_question_list %}
>   
>   {% for question in latest_question_list %}
>   {{
> question.question_text }}
>   {% endfor %}
>   
> {% else %}
>   No polls are available.
> {% endif %}
>
>
> --
> 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/1681bb6e-226e-4792-ab5c-1cadcf836eff%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/1681bb6e-226e-4792-ab5c-1cadcf836eff%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
*Julio Biason*, Sofware Engineer
*AZION*  |  Deliver. Accelerate. Protect.
Office: +55 51 3083 8101   |  Mobile: +55 51
*99907 0554*

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


Re: Error at login page of Django Admin

2018-05-16 Thread Julio Biason
Hi Stephen,

How are you deploying? Are you using uwsgi and nginx? 'Cause there is an
option on the nginx document configuration that you an point to drop a
prefix -- in this case, the "mysite/" prefix. If you don't use it, Django
will receive the whole path, "/mysite/admin/login" and won't find it in its
routes.

I'm 60% sure it is something like this :p

On Wed, May 16, 2018 at 12:02 PM, Stephen Farry 
wrote:

> Hi All,
>
> I have a peculiar issue with the admin on Django. Using the Django
> development server, I can use the admin without any issues at all. However,
> when I deploy it on the server, I still get the admin page, but when I try
> to log in I get a 404 error. I reduced this back to the tutorial, but I
> still get this with any username/password (with DEBUG is True)
> Page not found (404)
> Request Method: POST
> Request URL: https://themovieroom.co.uk/mysite/admin/login/?next=/
> mysite/admin/
>
> Using the URLconf defined in mysite.urls, Django tried these URL
> patterns, in this order:
>
>1. ^admin/
>2. polls/
>
> The current path, login/, didn't match any of these.
>
> You're seeing this error because you have DEBUG = True in your Django
> settings file. Change that to False, and Django will display a standard
> 404 page.
>
>
> This seems to be the same whatever sql database I get, and I suspect is a
> server side problem, but I'm not sure where to look. Let me know any
> further information would help. Thanks for any help you can provide.
>
> Cheers,
> Stephen
>
> --
> 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/a5170810-329f-440b-bc30-64a89d15a8aa%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/a5170810-329f-440b-bc30-64a89d15a8aa%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
*Julio Biason*, Sofware Engineer
*AZION*  |  Deliver. Accelerate. Protect.
Office: +55 51 3083 8101   |  Mobile: +55 51
*99907 0554*

-- 
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/CAEM7gE0NhEEr0YiWSi70%3D5_Vn_Gpq%2BXNmui_ap2mcTCJvdsBdQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django

2018-05-22 Thread Julio Biason
Hey Uobodomavin,

You could, in theory, use one Python, but with pure Django, you'll, at some
point, use HTML. MDN has a series of articles about HTML, which you'll see
is not that hard: https://developer.mozilla.org/en-US/docs/Web/HTML

When I mentioned pure Django, I meant that you could build a pure API,
returning JSON instead of HTML and avoiding the whole thing. It would
require someone else to write some application (or HTML page with
JavaScript) to make use of this API. If you plan to go this way, I'd
suggest getting a look at DjangoRestFramework, which is a framework on top
of Django to help build APIs: http://www.django-rest-framework.org/

On Tue, May 22, 2018 at 7:29 AM,  wrote:

> please, I need information on if Django can be used only with the
> knowledge of python.or if it requires a combined knowledge of HTML and
> Python programming and please advice me on how to acquire quick knowledge
> on HTML if its compulsory in the understanding Django.
>
> --
> 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/76015dc8-28ae-4bdf-bed4-6195273b9a3d%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/76015dc8-28ae-4bdf-bed4-6195273b9a3d%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
*Julio Biason*, Sofware Engineer
*AZION*  |  Deliver. Accelerate. Protect.
Office: +55 51 3083 8101   |  Mobile: +55 51
*99907 0554*

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


Re: main page have stopped work after creating poll app

2018-05-28 Thread Julio Biason
Hi Dmitry,

Define "the main address stop working"? Do you mean it won't accept any
other requests?

You should probably check the command line where you started "manage.py
runserver". It should display a backtrace pointing to anything that went
wrong.

On Sat, May 26, 2018 at 5:43 AM, Dmitry Sobolev 
wrote:

> Hello guys!
> I am doing 1st steps in Django.
> Started 1st tutorial page 3 times from there and getting the same case
> each time.
> After that, I created a working "poll app" that works under
> 127.0.0.1:8000/polls/
> the main address stop working
> where should I see the problem of this problem and make main page work
> both with "poll app"?
> Thanks!
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To 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/02e80ca1-a53c-4668-beb9-1f21a31bae70%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/02e80ca1-a53c-4668-beb9-1f21a31bae70%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
*Julio Biason*, Sofware Engineer
*AZION*  |  Deliver. Accelerate. Protect.
Office: +55 51 3083 8101   |  Mobile: +55 51
*99907 0554*

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


Re: ValueError at /polls/1/vote/

2018-05-29 Thread Julio Biason
View require that you return an HttpResponse object. Your function does not
(it probably even lacks a "return").

You need to return the response back in the view.

On Tue, May 29, 2018 at 8:48 AM, Caleb Bryson  wrote:

> Hey i am getting this error now can anyone help me fix this? and what code
> do you need to see to help out?
>
> --
> 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/a3a72079-74a0-404f-aedd-828597090663%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/a3a72079-74a0-404f-aedd-828597090663%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
*Julio Biason*, Sofware Engineer
*AZION*  |  Deliver. Accelerate. Protect.
Office: +55 51 3083 8101   |  Mobile: +55 51
*99907 0554*

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


Re: Good afternoon, I need help to generate a PDF of my models in DJANGO

2018-05-29 Thread Julio Biason
"pruebapdf() missing 1 required positional argument: 'DesdeJango'"

Your view have an additional parameter, which is not used by views; views
always receive the "request" and then the list of parameters in your URL
definition (which does not have any parameters). So you need to remove it
from the function and actually import the class from your models.

On Tue, May 29, 2018 at 4:49 PM, ALDO JAVIER VIGUERAS <
aldojvigue...@gmail.com> wrote:

> Hallo, I want to do a view to retur me a PDF with my models tah I have in
> models.py , I habe python 3 Django 2.11 and the models are in POSTGRESQL .
> The next is my code that a I have, but gived TypeError: pruebapdf()
> missing 1 required positional argument: 'DesdeJango'
> 'DesdeJango'= is  model name.
>
> VIEW.PY
>
>
> def pruebapdf(request,DesdeJango):
> response=HttpResponse(content_type='application/pdf')
> response['Content-Disposition']='attachment; filename=PDF_CON
> _MODELO.pdf'
> buffer=BytesIO()
> c=canvas.Canvas(response,pagesize=A4)
> #Estilo
> styles = getSampleStyleSheet()
> styleBH=styles["Normal"]
> styleBH.alignment = TA_CENTER
> styleBH.fontSize=10
> #parametros
> folio=Paragraph('folio',styleBH)
> nombre=Paragraph('nombre',styleBH)
> sexo=Paragraph('sexo',styleBH)
> edad=Paragraph('edad',styleBH)
> gecha=Paragraph('gecha',styleBH)
> formato=[]
> formato.append(['folio','nombre','sexo','edad','gecha'])
> #Estilo de la tabla
> styleN=styles['BodyText']
> styleN.alignment=TA_CENTER
> styleN.fontSize=7
> #ALTURA
> high=650
> #ModeloPrueba(request.POST,instance=mascota)
>
> #ciclo for para poner la base de datos
>
> for dato in DesdeJango.objects.all():
> dato=[dato['folio'], dato['nombre'],dato['sexo'],
> dato['edad'],dato['gecha']]
> formato.append(dato)
> #ponemos el grosor del la fila
> high=high-18
>
> #AÑADIMOS DATOS DE PAGINACION
> width, height=A4
> table=Table(formato,colWidths=[1.9*cm,9.5*cm,1.9*cm,1.9*cm,1.9*cm])
> table.setStyle(TableStyle([('INNERGRID',(0,0),(-1,-1),0.25,
> colors.black), ]))
> table.wrapOn(c, width, height)
> table.drawOn(c,30,high)
> c.showPage()
> c.save()
> pdf=buffer.getvalue()
>
> c.showPage()
> c.save()
> pdf = buffer.getvalue()
> buffer.close()
> response.write(pdf)
>
>
> return response
>
>
> URL.PY
>
> path(r'html',pruebapdf , name='PDF'),
>
>
> NOTE : AttributeError: 'WSGIRequest' object has no attribute 'objects'
>
>
> I thank you in advance for your support
>
>
>
>
> --
> 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/2a6ef8f4-5153-4845-87dc-0fbe92e66469%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/2a6ef8f4-5153-4845-87dc-0fbe92e66469%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
*Julio Biason*, Sofware Engineer
*AZION*  |  Deliver. Accelerate. Protect.
Office: +55 51 3083 8101   |  Mobile: +55 51
*99907 0554*

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


Re: Django Model

2018-05-30 Thread Julio Biason
Hi,

If I got this right, what you want to do is save the "domainwhois" with the
expiration date of the result of the whois.whois function.

Unfortunately, things don't work in class level like this, because things
are static here: whois.whois will be run one single time, not on every
object. For that, you'll need to change something in the instance.
Fortunately, Django allows access to things in the instance with ``save``:

def save(self, *args, **kwargs):
   details = whois.whois(self.domainname)
   self.domainwhois = details.expiration_date
   super().save(*args, **kwargs)

("details" and "w" can be removed from the model itself, as they are
variables used only for retriving this information). Have a look how models
work here: https://docs.djangoproject.com/en/2.0/topics/db/models/

On Wed, May 30, 2018 at 11:12 AM, Максим С  wrote:

> Hello all.
>
> I'm beginer. Sorry. Can anyone help me with this model. It did't 
> work(TypeError:
> expected string or bytes-like object
>
> ):
>
> import whois
>
>
> class Domains(models.Model):
> domainname = models.CharField(max_length=200, blank=True)
> domainuser = models.ForeignKey(User, on_delete=models.CASCADE)
> details = whois.whois(domainname)
> w = str(details.expiration_date)
> domainwhois = models.DateField(default=w)
>
> def __str__(self):
> return self.domainname
>
> Domains.save()
>
> --
> 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/53525a55-0d68-4a8c-9031-5d7c3baa7064%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/53525a55-0d68-4a8c-9031-5d7c3baa7064%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
*Julio Biason*, Sofware Engineer
*AZION*  |  Deliver. Accelerate. Protect.
Office: +55 51 3083 8101   |  Mobile: +55 51
*99907 0554*

-- 
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/CAEM7gE2N1hVwL-W0z%2BssYsvmmBrnnJxOUT_ZaV7NxY_jH8V%2BNg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Call to method that takes in a request

2018-06-01 Thread Julio Biason
Hi Yufenyuy,

You just instantiate the object and call the function. Something like

created_object = MyModel(field='some_value')
view = MyView()
view.get(request, created_object.pk)

If you want to create a request object, you can use RequestFactory:
https://docs.djangoproject.com/en/2.0/topics/testing/advanced/#the-request-factory


On Fri, Jun 1, 2018 at 8:02 AM, Yufenyuy Veyeh Didier 
wrote:

> Hello,
> I wish to know  how I can call a method that takes in a request as one of
> its parameters such as
>
> def get(self, request, pk):
>
> #I am writing a test method to test the above method too.
>
> --
> 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/8740fe0d-e6b3-4caf-b35e-a442ee05e209%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/8740fe0d-e6b3-4caf-b35e-a442ee05e209%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
*Julio Biason*, Sofware Engineer
*AZION*  |  Deliver. Accelerate. Protect.
Office: +55 51 3083 8101   |  Mobile: +55 51
*99907 0554*

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


Re: Some problems with running django

2018-06-06 Thread Julio Biason
Hi,

UnicodeDecodeErrors are quite common in Python 2, when you add an UTF8
character and the system is not set up for it (usually, you need to start
your code with `# encoding: utf-8`).

But the fact that this seems to affect socket is weird as heck. I'd check
anything in mytestsite/settings.py to make sure there isn't an UTF8 string
in anything related to server name (things like DATABASE, in which you
define the host for your database and the like).

On Wed, Jun 6, 2018 at 3:50 AM, 曹逍遙  wrote:

> Hello
>
> I run => python manage.py runserver
>
> get result
> 
> ---
> C:\mydjango\mytestsite>python manage.py runserver
> Performing system checks...
>
> System check identified no issues (0 silenced).
>
> You have 14 unapplied migration(s). Your project may not work properly
> until you apply the migrations for app(s): admin, auth, contenttypes,
> sessions.
> Run 'python manage.py migrate' to apply them.
> June 06, 2018 - 14:25:25
> Django version 2.0.6, using settings 'mytestsite.settings'
> Starting development server at http://127.0.0.1:8000/
> Quit the server with CTRL-BREAK.
> Unhandled exception in thread started by  check_errors..wrapper at 0x046A6540>
> Traceback (most recent call last):
>   File "C:\Program Files 
> (x86)\Python36-32\lib\site-packages\django\utils\autoreload.py",
> line 225, in wrapper
> fn(*args, **kwargs)
>   File "C:\Program Files (x86)\Python36-32\lib\site-packages\django\core\
> management\commands\runserver.py", line 142, in inner_run
> ipv6=self.use_ipv6, threading=threading, server_cls=self.server_cls)
>   File "C:\Program Files (x86)\Python36-32\lib\site-
> packages\django\core\servers\basehttp.py", line 163, in run
> httpd = httpd_cls(server_address, WSGIRequestHandler, ipv6=ipv6)
>   File "C:\Program Files (x86)\Python36-32\lib\site-
> packages\django\core\servers\basehttp.py", line 66, in __init__
> super().__init__(*args, **kwargs)
>   File "C:\Program Files (x86)\Python36-32\lib\socketserver.py", line
> 453, in __init__
> self.server_bind()
>   File "C:\Program Files (x86)\Python36-32\lib\wsgiref\simple_server.py",
> line 50, in server_bind
> HTTPServer.server_bind(self)
>   File "C:\Program Files (x86)\Python36-32\lib\http\server.py", line 138,
> in server_bind
> self.server_name = socket.getfqdn(host)
>   File "C:\Program Files (x86)\Python36-32\lib\socket.py", line 673, in
> getfqdn
> hostname, aliases, ipaddrs = gethostbyaddr(name)
> UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb1 in position 0:
> invalid start byte
> 
> 
> --
>
> Don't know what to do?
>
> django --V 2.0.6
> win10
>
>
>
>
>
>
>
> --
> 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/c7031dac-392a-46ed-9fdc-f202f6e8a9f1%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/c7031dac-392a-46ed-9fdc-f202f6e8a9f1%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
*Julio Biason*, Sofware Engineer
*AZION*  |  Deliver. Accelerate. Protect.
Office: +55 51 3083 8101   |  Mobile: +55 51
*99907 0554*

-- 
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/CAEM7gE3p-5qcZmMC_VvLVSt2dBBgKrK-EaFoUYmL-Rfc0_vUGg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Upload video with automatically created thumbnail in Django 2

2018-06-06 Thread Julio Biason
Hello,

Another solution is to use `ffmpeg`. There is an option to extract (even
multiple) screencaps from a video (sorry, can't remember the proper option
for this).

And, as Daniel pointed, this is very heavy operation, so either you'll need
a heck of a server (with plenty CPU and fast disks) OR use something to
process things asynchronously, like Celery.

On Wed, Jun 6, 2018 at 9:44 AM, Daniel Germano Travieso <
danielgtravi...@gmail.com> wrote:

> Hello!
>
> This type of video rendering and processing should be done by a python
> module that can handle this workload.
>
> For example, you can use OpenCV, a C++ computer vision module that has a
> python hooks version, so you can upload your video via django the usual way
> an use the OpenCV to process the video and extract a frame for the
> thumbnail (a function like cv2.VideoCapture) on the view that handles the
> upload.
>
> Please beware of a possible overhead on your server's processing power as
> video rendering tools are always CPU bound.
>
> Hope it helps.
>
> On Wed, Jun 6, 2018, 06:35 Pravin Yadav  wrote:
>
>> Hi Sir,
>>
>> is it possible to create only one thumbs image. If any one know kindly
>> help me. I'm not getting any solutions. Plz help..
>> .
>>
>>
>> Thanks,
>> Pravin Yadav
>>
>>
>> On Tuesday, June 5, 2018 at 6:54:15 PM UTC+5:30, HaatBhaar Developer
>> wrote:
>>>
>>> Hello dude,
>>> I wish I could solved your problem. But right now I don't have that
>>> idea. Hope fully I will find that for you and will give the solution.
>>> May your next problem I can solve.
>>>
>>> On 5 June 2018 at 17:40, Pravin Yadav  wrote:
>>>
>>>> I want to upload .mp4 and .mov videos in my django website with
>>>> automatic thumbnail generation. Thumbnails should be created in .jpg or
>>>> .png that will be saved in ImageField and also video in FileField.
>>>>
>>>> I'm using Python 3.6.1 and Django 2.0.
>>>>
>>>> Please advise me how to create a video similar to youtube.
>>>>
>>>> Is there any opensource modules/plugins available for this this ?
>>>>
>>>> Kindly, Help me.
>>>>
>>>>
>>>> Thanks,
>>>>
>>>>
>>>> Pravin Yadav
>>>>
>>>>
>>>>
>>>> --
>>>> 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 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/1713df71-5a64-48dd-9951-e65bf8367cd0%
>>>> 40googlegroups.com
>>>> <https://groups.google.com/d/msgid/django-users/1713df71-5a64-48dd-9951-e65bf8367cd0%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>>
>>>
>>> --
>>> Hello,
>>>
>>> Thanks and Warm Regards
>>> ---
>>> HaatBhaar Team | +91-906-708-0040
>>> --
>>> Sabka *HaatBhaar*, Sabka *Udhaar*!
>>>
>> --
>> 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/ba80e00a-0ea1-4bae-bb15-3f98c39a8f77%
>> 40googlegroups.com
>> <https://groups.google.com/d/msgid/django-users/ba80e00a-0ea1-4bae-bb15-3f98c39a8f77%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

Re: Some problems with running django

2018-06-07 Thread Julio Biason
Hi,

I took a longer look at the error and it seems the error raised when the
server was starting up. The code tries to figure out your machine name -- a
thing that's stored, on Linux systems, on /etc/hostname and on OS X on
Settings -> Sharing -- and *that* name has special characters (I'd guess it
could be something like "曹逍遙's computer").

I don't have enough knowledge about Windows to know where you could change
that.

On Thu, Jun 7, 2018 at 2:02 AM, 曹逍遙  wrote:

> Julio Biason 您好
>
> Thank you
>
> I am a beginner
>
> mytestsite/settings.py
> I don't know where to change
> I did not change him
>
> too difficult
>
> I do not know what to do
>
>
>
>
>
> [image: Mailtrack]
> <https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality5&;>
>  Sender
> notified by
> Mailtrack
> <https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality5&;>
>  18/06/07
> 下午1:01:38
>
> 2018-06-06 20:42 GMT+08:00 Julio Biason :
>
>> Hi,
>>
>> UnicodeDecodeErrors are quite common in Python 2, when you add an UTF8
>> character and the system is not set up for it (usually, you need to start
>> your code with `# encoding: utf-8`).
>>
>> But the fact that this seems to affect socket is weird as heck. I'd check
>> anything in mytestsite/settings.py to make sure there isn't an UTF8 string
>> in anything related to server name (things like DATABASE, in which you
>> define the host for your database and the like).
>>
>> On Wed, Jun 6, 2018 at 3:50 AM, 曹逍遙  wrote:
>>
>>> Hello
>>>
>>> I run => python manage.py runserver
>>>
>>> get result
>>> 
>>> ---
>>> C:\mydjango\mytestsite>python manage.py runserver
>>> Performing system checks...
>>>
>>> System check identified no issues (0 silenced).
>>>
>>> You have 14 unapplied migration(s). Your project may not work properly
>>> until you apply the migrations for app(s): admin, auth, contenttypes,
>>> sessions.
>>> Run 'python manage.py migrate' to apply them.
>>> June 06, 2018 - 14:25:25
>>> Django version 2.0.6, using settings 'mytestsite.settings'
>>> Starting development server at http://127.0.0.1:8000/
>>> Quit the server with CTRL-BREAK.
>>> Unhandled exception in thread started by >> check_errors..wrapper at 0x046A6540>
>>> Traceback (most recent call last):
>>>   File "C:\Program Files (x86)\Python36-32\lib\site-pac
>>> kages\django\utils\autoreload.py", line 225, in wrapper
>>> fn(*args, **kwargs)
>>>   File "C:\Program Files (x86)\Python36-32\lib\site-pac
>>> kages\django\core\management\commands\runserver.py", line 142, in
>>> inner_run
>>> ipv6=self.use_ipv6, threading=threading, server_cls=self.server_cls)
>>>   File "C:\Program Files (x86)\Python36-32\lib\site-pac
>>> kages\django\core\servers\basehttp.py", line 163, in run
>>> httpd = httpd_cls(server_address, WSGIRequestHandler, ipv6=ipv6)
>>>   File "C:\Program Files (x86)\Python36-32\lib\site-pac
>>> kages\django\core\servers\basehttp.py", line 66, in __init__
>>> super().__init__(*args, **kwargs)
>>>   File "C:\Program Files (x86)\Python36-32\lib\socketserver.py", line
>>> 453, in __init__
>>> self.server_bind()
>>>   File "C:\Program Files (x86)\Python36-32\lib\wsgiref\simple_server.py",
>>> line 50, in server_bind
>>> HTTPServer.server_bind(self)
>>>   File "C:\Program Files (x86)\Python36-32\lib\http\server.py", line
>>> 138, in server_bind
>>> self.server_name = socket.getfqdn(host)
>>>   File "C:\Program Files (x86)\Python36-32\lib\socket.py", line 673, in
>>> getfqdn
>>> hostname, aliases, ipaddrs = gethostbyaddr(name)
>>> UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb1 in position 0:
>>> invalid start byte
>>> 
>>> 
>>> --
>>>
>>> Don't know what to do?
>>>
>>> django --V 2.0.6
>>> win10
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> --
>>&

Re: How to execute a python(selenium) script on clicking run button in the template view. Django

2018-06-11 Thread Julio Biason
Hi Dimple,

Your `url` is invalid. Views are exposed to the world via urls; in that,
you define which URL will call which view.

If you're running Django on your machine, your URL should probably start
with 'http://localhost:8000/the/url/for/your/view' -- although the `http`
can be omitted, in which case the browser will use the current schema and
`://localhost` can also be omitted, in which case the browser will request
from the current server.

On Mon, Jun 11, 2018 at 6:43 AM, Dimple Mathew 
wrote:

> *Once i select options in the drop-down, the scripts should be executed.*
> *Index.html*
>
>  
> 
> US BANK
> BOKF
> COMMERCE BANK
> MICHIAS
> TD BANK
> WELSFARGO
> BOA
> 
> 
> 
>
>
>  

Re: button not responding when click but when press return key than works

2018-06-13 Thread Julio Biason
Hi Asif,

Are you sure you don't have any JS capturing the submit press and doing
`preventDefault()`? That would prevent the button from sending the form.

On Firefox, if you inspect the button, if it shows an "EV" near it, it
means there is something capturing the button events -- and `click` could
be one of those events, with the preventDefault().

On Wed, Jun 13, 2018 at 6:14 PM, Asif Khan  wrote:

> I am having amazing problem in my django template. Button does not respond
> on pressing click on it. It works when I press return key. code is
> following.
> {% extends 'vtapp/baseapp_layout.html' %}
>
> {% block head %}
> Vehicle Vegilince - Customer Search
> {% endblock %}
>
> {% block content %}
> Enter Customer information
> 
> {% csrf_token %}
> 
> 
> 
> 
> 
> Search
> 
> 
> 
>
> --
> 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/ea697019-42b8-4f66-8658-36f26ba3493a%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/ea697019-42b8-4f66-8658-36f26ba3493a%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
*Julio Biason*, Sofware Engineer
*AZION*  |  Deliver. Accelerate. Protect.
Office: +55 51 3083 8101   |  Mobile: +55 51
*99907 0554*

-- 
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/CAEM7gE2nBPU4C34996RBrPAmOYvjkEC-8RhL4GeJWX5p%2Bq1G3A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django 1.11 Serving Large files for download ??

2018-06-20 Thread Julio Biason
Hi Gokul,

Well, since this is for intranet, you may be lucky.

For large downloads, you can put your facing server (nginx, apache) to
point directly to the media directory. For example, if your media files are
being stored on `/srv/myserver/media`, and have an URL of `/media`, you
could add a location of `/media` pointing directly to the file system (your
`/srv/myserver/media`). This way, Django won't get in the way and the whole
process of sending a large file will be the facing server problem -- and
they are better optimized for this.

The same thing goes for simultaneous requests: usually, the facing server
will launch more than one socket to the underlying service to retrieve the
information, so you end up with more "Djangos" running. One example is
that, if you use uwsgi with nginx, you can set up the number of threads
directly on uwsgi and it and nginx will take care of answering multiple
requests.

On Wed, Jun 20, 2018 at 12:07 AM, Gokul Swaminathan 
wrote:

> How to serve large file for download. Also it should handle simultaneous
> requests. I have to serve the web application in Intranet environment.
>
>
> --
> 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/32ed1909-da16-4254-92e6-35359db576eb%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/32ed1909-da16-4254-92e6-35359db576eb%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
*Julio Biason*, Sofware Engineer
*AZION*  |  Deliver. Accelerate. Protect.
Office: +55 51 3083 8101   |  Mobile: +55 51
*99907 0554*

-- 
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/CAEM7gE17ei%2B5q2UoipGokh4vgQk1D6JQGuA38fJNfMhKdv%3DFgg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Regarding an issue

2018-06-20 Thread Julio Biason
Hi Mayank,

You tried to access "/"; there is no url associated with this path, so it's
a 404. The only valid URLs are `/admin` and `/music`.

If you want to see something when accessing `/`, you need to create a view
for it and associate it in your `urls.py`.

On Wed, Jun 20, 2018 at 9:39 AM, Mayank Bhatia  wrote:

> hi all
>
> I am getting an error while creating the views when i try to run the
> server this Page not found (404) error is being generated. but the admin
> section works fine. i am attaching the image.i have also tried making
> migrations but nothing happened. kindly help to solve this asap.
>
> --
> 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/CANeih2fWAJZEkD0%2BVey_Hj2cd4Cp7OEMY3qw%3DNk41eQGbi-
> vtA%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CANeih2fWAJZEkD0%2BVey_Hj2cd4Cp7OEMY3qw%3DNk41eQGbi-vtA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
*Julio Biason*, Sofware Engineer
*AZION*  |  Deliver. Accelerate. Protect.
Office: +55 51 3083 8101   |  Mobile: +55 51
*99907 0554*

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


Re: How to fill latitude and longitude values from an existing location field in Django+Python?

2018-06-21 Thread Julio Biason
Hi Prateek.

You're using Google Maps for the lat/long, right?

In this case, I'd suggest that, on the function you receive the data and
update the field, you also make a request to some URL to update the
lat/long of the current displayed object.

On Thu, Jun 21, 2018 at 9:29 AM, prateek gupta  wrote:

> Got it Jason, I will not post anymore now.
>
> On Thursday, June 21, 2018 at 5:31:13 PM UTC+5:30, Jason wrote:
>>
>> You've been posting here about this regularly (at least four times) with
>> no responses.  I don't think anyone here knows how to solve your problem.
>> what else have you looked at?  eg, have you asked on stack overflow or
>> other places?
>>
> --
> 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/2c6cc9f6-1455-439c-ad78-459fcc1828ab%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/2c6cc9f6-1455-439c-ad78-459fcc1828ab%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
*Julio Biason*, Sofware Engineer
*AZION*  |  Deliver. Accelerate. Protect.
Office: +55 51 3083 8101   |  Mobile: +55 51
*99907 0554*

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


Re: How to run python script by clicking a HTML button?

2018-06-22 Thread Julio Biason
Hi Subhendu,

To make this all work, you'll need to do this:

1. Create a Django app
2. Add some URL to a view (any view)
3. Inside the view, run your script.
4. Change the for on the "action" to point to the URL in point 2.

You may want to read the Django Tutorial[1] to grasp who those things are
implemented and connect to each other.

[1] https://docs.djangoproject.com/en/2.0/

On Thu, Jun 21, 2018 at 1:43 PM, SUBHENDU PANDA 
wrote:

> Below is my HTML code...
>
> 
> 
> 
>
> HTML Forms
>
> 
>   First name:
>   
>   
>   
>   
> 
>
> I want is : If you I the "Submit" button, the form-data will be sent to
> a page called "/myscript.py and will perform the operation".
>
> 
> 
>
>
>
>
>
>
> myscript.py:
>
> import os
>
> def  f1():
>print ("Below are the files present in your Directory { }"
> .format(os.listdir("C:\MyDir "))
>
> --
> 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/a4fd2aa4-b28a-465f-aaab-dc279c4647d3%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/a4fd2aa4-b28a-465f-aaab-dc279c4647d3%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
*Julio Biason*, Sofware Engineer
*AZION*  |  Deliver. Accelerate. Protect.
Office: +55 51 3083 8101   |  Mobile: +55 51
*99907 0554*

-- 
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/CAEM7gE0CuGO2g%3DUTZsn7Hc9cC%2BzUreqCMTE8HiYzrB0r0SyCMw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Newbie : Object copy - weird error :-)

2018-06-27 Thread Julio Biason
Hi Mikael,

The problem is happening because of this: __init__() takes from 1 to 2
positional arguments but 11 were given

On your new __init__(), you added just 2 parameters: `self` and `source`.
But you overwrote the default `models.Model` init, which receives way more
parameters (the original signature for this function is `__init__(self,
*args, **kwargs)`).

What are you actually trying to achieve with this?

On Tue, Jun 26, 2018 at 1:17 PM,  wrote:

> Hi all :-)
>
> I'd like to archive some data.
>
> I did that :
>
> class AbstractDataModel(models.Model):
>
> xxx
>
>
> class Meta:
> abstract = True
>
>
> def __iter__(self):
>
> return iter([self.xxx, self.yyy, self.zzz, self.aaa,
> self.qqq, self.mode_bbb])
>
>
> class DataModel(AbstractDataModel):
>
>
> pass
>
>
> class DataModelArchive(AbstractDataModel):
> # https://stackoverflow.com/questions/21699707/python-how-
> to-copy-all-attibutes-from-base-class-to-derived-one
> def __init__(self, source=None):
> if source is not None:
> self.__dict__.update(source.__dict__)
>
>
>
> But when I want to access data in DataModelArchive, like
> DataModelArchive.objects.all() for example,
> I get
>
>
> Traceback (most recent call last):
>   File "/home/.../tests.py", line 1090, in test_archive
> print(DataModelArchive.objects.all())
>   File "/home/.../venv/lib/python3.6/site-packages/django/db/
> models/query.py", line 248, in __repr__
> data = list(self[:REPR_OUTPUT_SIZE + 1])
>   File "/home/.../venv/lib/python3.6/site-packages/django/db/
> models/query.py", line 272, in __iter__
> self._fetch_all()
>   File "/home/.../venv/lib/python3.6/site-packages/django/db/
> models/query.py", line 1179, in _fetch_all
> self._result_cache = list(self._iterable_class(self))
>   File "/home/.../venv/lib/python3.6/site-packages/django/db/
> models/query.py", line 63, in __iter__
> obj = model_cls.from_db(db, init_list, row[model_fields_start:model_
> fields_end])
>   File "/home/.../lib/python3.6/site-packages/django/db/models/base.py",
> line 507, in from_db
> new = cls(*values)
> TypeError: __init__() takes from 1 to 2 positional arguments but 11 were
> given
>
>
>
> What am I doing wrong ?
>
> Thx
> ;-)
>
> --
> 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/ac3a7a8f-f878-48b3-943a-eb47f6b03e7e%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/ac3a7a8f-f878-48b3-943a-eb47f6b03e7e%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
*Julio Biason*, Sofware Engineer
*AZION*  |  Deliver. Accelerate. Protect.
Office: +55 51 3083 8101   |  Mobile: +55 51
*99907 0554*

-- 
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/CAEM7gE2y%3DQHEJdbwUMbhmxDnY8%2BEHSVdUKUJtgbGTX2UgoWKSA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: django

2018-06-29 Thread Julio Biason
Hi Musonda,

Django, yes; React, not so much.

Your question was a bit too vague and seemed more focused on the second.
Surely, when you get a better grasp of what Django is and what React is and
how they work together and have a question about the first, you can feel
free to send the question here :)

On Fri, Jun 29, 2018 at 10:19 AM, musonda makena 
wrote:

> sorry i thought i was in right place. was redirected here when i was
> researching on Django and react
>
> --
> 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/89fa6201-5306-4a2c-891c-fe326c431be8%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/89fa6201-5306-4a2c-891c-fe326c431be8%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
*Julio Biason*, Sofware Engineer
*AZION*  |  Deliver. Accelerate. Protect.
Office: +55 51 3083 8101   |  Mobile: +55 51
*99907 0554*

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


Re: Django split screen

2018-06-29 Thread Julio Biason
Hi Gerald,

You can't "split" the screen because Django is simply a way to retrieve
data from a database and send HTML to the browser.

You can, however, load the history and create a form and send both to the
template, which will display both side by side (or one on to the top of the
other, or whatever).

All you have to do is create a view that loads the history and create a
form object and send both to a template that knows how to display both.

On Fri, Jun 29, 2018 at 10:36 AM, Gerald Brown  wrote:

> Has anyone ever heard of a way to split a screen in Django?
>
> What my client wants to do is to view a screen with the customers previous
> history (scrollable but NOT editable) while entering new data for that
> customer.
>
> I think I will need a form for the data entery but I am not sure what I
> would use to display the history data.
>
> Any ideas or suggestions?
>
> Thanks.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To 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/e61f1617-e8ae-46b5-ac82-22275c600d2a%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/e61f1617-e8ae-46b5-ac82-22275c600d2a%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
*Julio Biason*, Sofware Engineer
*AZION*  |  Deliver. Accelerate. Protect.
Office: +55 51 3083 8101   |  Mobile: +55 51
*99907 0554*

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


Re: I can't see my models in MySQL db

2018-07-05 Thread Julio Biason
t; makemigrations django_sb_admin*
>>>> No changes detected in app 'django_sb_admin'
>>>>
>>>> 
>>>> =
>>>> *root@kali:~/PycharmProjects/django/azim_projs# python3 manage.py
>>>> migrate django_sb_admin*
>>>> Operations to perform:
>>>>   Apply all migrations: django_sb_admin
>>>> Running migrations:
>>>>   Applying django_sb_admin.0001_initial... OK
>>>>
>>>> 
>>>> =
>>>> *root@kali:~/PycharmProjects/django/azim_projs# python3 manage.py
>>>> migrate*
>>>> Operations to perform:
>>>>   Apply all migrations: admin, auth, contenttypes, django_sb_admin,
>>>> sessions
>>>> Running migrations:
>>>>   Applying contenttypes.0001_initial... OK
>>>>   Applying auth.0001_initial... OK
>>>>   Applying admin.0001_initial... OK
>>>>   Applying admin.0002_logentry_remove_auto_add... OK
>>>>   Applying contenttypes.0002_remove_content_type_name... OK
>>>>   Applying auth.0002_alter_permission_name_max_length... OK
>>>>   Applying auth.0003_alter_user_email_max_length... OK
>>>>   Applying auth.0004_alter_user_username_opts... OK
>>>>   Applying auth.0005_alter_user_last_login_null... OK
>>>>   Applying auth.0006_require_contenttypes_0002... OK
>>>>   Applying auth.0007_alter_validators_add_error_messages... OK
>>>>   Applying auth.0008_alter_user_username_max_length... OK
>>>>   Applying auth.0009_alter_user_last_name_max_length... OK
>>>>   Applying sessions.0001_initial... OK
>>>>
>>>> 
>>>> =
>>>> *root@kali:~/PycharmProjects/django/azim_projs# python3 manage.py
>>>> sqlmigrate django_sb_admin 0001*
>>>> BEGIN;
>>>> --
>>>> -- Create model Appp
>>>> --
>>>> --
>>>> -- Create model ApTT
>>>> --
>>>> --
>>>> -- Create model CCnn
>>>> --
>>>> --
>>>> -- Create model CCtt
>>>> --
>>>> --
>>>> -- Create model Lact
>>>> --
>>>> -- Create model Lapt
>>>> --
>>>> --
>>>> -- Create model Laccte
>>>> --
>>>> --
>>>> -- Create model Urmng
>>>> --
>>>> COMMIT;
>>>>
>>>> 
>>>> =
>>>> *Note:* see attached picture, I haven't my models as tables in
>>>> *djangoDB* database.
>>>>
>>>> What's the problem !?
>>>> Why I haven't tables in DB !??!
>>>>
>>>>
>>>> --
>>> 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/a8f1fb38-8be7-40ee-b1a4-05db133ecfa2%
>>> 40googlegroups.com
>>> <https://groups.google.com/d/msgid/django-users/a8f1fb38-8be7-40ee-b1a4-05db133ecfa2%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/CAMsG8mi-XBuk-dLZgcgVt8%3DsoW3xryxSZ-5%
> 2BX6T758eeg8ArNA%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAMsG8mi-XBuk-dLZgcgVt8%3DsoW3xryxSZ-5%2BX6T758eeg8ArNA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
*Julio Biason*, Sofware Engineer
*AZION*  |  Deliver. Accelerate. Protect.
Office: +55 51 3083 8101   |  Mobile: +55 51
*99907 0554*

-- 
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/CAEM7gE0EZT%3DUDgwEAX9OjFEK79nd-pRvR%2BfmyUNQG2VQoDH2BA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: custom command

2018-07-20 Thread Julio Biason
Hi Dp,

Basically, you'll have to:

1. Add the command; the documentation explains quite well how to make a new
command:
https://docs.djangoproject.com/en/2.0/howto/custom-management-commands/

2. In that command, you'll have to read a directory. That's pure python and
you could use something like walk
https://docs.python.org/3/library/os.html?highlight=os#os.walk, although
there are other commands. Check the `os` and `os.path` modules.

3. Reading a JSON is easy peasy with the JSON module:
https://docs.python.org/3/library/json.html?highlight=json#module-json

4. And to add the values in PostgreSQL, you'll need to have your model
defined (https://docs.djangoproject.com/en/2.0/topics/db/models/) and, with
that, you just create records and `.save()` them.



On Fri, Jul 20, 2018 at 1:24 AM, dp Audiovisual  wrote:

> Hello, I need to create a "custom command" that uploads all the Json files
> of a folder within the project to the postgres database. Help, I'm learning.
>
> --
> 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/6f2c4d6a-8f05-44b9-967c-c3fe0f7f5e72%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/6f2c4d6a-8f05-44b9-967c-c3fe0f7f5e72%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
*Julio Biason*, Sofware Engineer
*AZION*  |  Deliver. Accelerate. Protect.
Office: +55 51 3083 8101   |  Mobile: +55 51
*99907 0554*

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


Re: Django with Celery

2018-07-20 Thread Julio Biason
Hi Satyam,

Well, Celery is used for background tasks, like running requests to other
services out of the response loop and such. Your question is confusing
'cause forms are used to validate user input and, well, there is no user in
a background task.

What you can do is have a normal form attached to a view and, if the form
`.is_valid()`, you call the celery function to do the whole processing of
the registration form. Just be sure that, if your registration takes less
than a second, it is not worth running in a background task.

On Fri, Jul 20, 2018 at 1:53 AM, Satyam Mishra 
wrote:

> Hello,
>
> i want to integrate my django application with the celery ,i follow the
> official documentation and some other blogs of celery but i'm not able to
> find out that how to connect it with my django application for eg. i have a
> user registration form then how i assign it to celery
>
> Thanks
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To 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/873e9ec3-6eb8-4118-81cd-ee8373d3b1de%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/873e9ec3-6eb8-4118-81cd-ee8373d3b1de%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
*Julio Biason*, Sofware Engineer
*AZION*  |  Deliver. Accelerate. Protect.
Office: +55 51 3083 8101   |  Mobile: +55 51
*99907 0554*

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


Re: error in coding

2018-07-25 Thread Julio Biason
Hi Rohit,

The problem is that you have `urlpatterns = ` (an assignment without value)
which is invalid Python code. Either you need to finish the line (add the
value that should be assigned to urlpatterns) or add a "\" to mark that the
line continues in the line below. (As a last resort, you can remove the
file _if you're not using it_, so Django won't try to import it and
generate the error).

On Wed, Jul 25, 2018 at 9:10 AM, Rohit Sharma 
wrote:

> I am very new to Django. I have started a project and created my first app
> but whenever i start editing the app i always get this error. i have
> attached the screenshot of the error.
> please help me out in a simple way.
>
>
>
> --
> 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/9004ed7c-6b33-4b06-8a2a-d733e3b14e0f%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/9004ed7c-6b33-4b06-8a2a-d733e3b14e0f%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
*Julio Biason*, Sofware Engineer
*AZION*  |  Deliver. Accelerate. Protect.
Office: +55 51 3083 8101   |  Mobile: +55 51
*99907 0554*

-- 
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/CAEM7gE3a2PiU59ARKBtSgOE54jhXAv9bNMuOP6mq8JNi%2BF%3DmhA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Oracle Connection Problem

2018-07-25 Thread Julio Biason
Hi Razibul,

Have you tried to add the host and port? IIRC, the default port is 1521 and
you need to fill the host value, otherwise the driver won't know where to
connect to.

Also, are you getting any specific errors?

On Wed, Jul 25, 2018 at 10:50 AM, Md. Razibul Hasan Mithu <
rhmith...@gmail.com> wrote:

> DATABASES = {
> 'default': {
> 'ENGINE': 'django.db.backends.oracle',
> 'NAME': 'orcl',  # my sid is orcl. is this sid or something else??
> 'USER': 'hr',   # my instalation user is hr
> 'PASSWORD': 'hr',  # Instalation Pass also hr
> 'HOST': '',
> 'PORT': '',
> }}
>
>
>
> I can't connect oracle in my project. For last 2 days i tried to solve this 
> issue. But still same problem. I can't able to migrate.I am using Oracle 11g.
>
>
> --
> 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/03a2ca2e-1ace-4e71-aa13-3f03d32aeb5b%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/03a2ca2e-1ace-4e71-aa13-3f03d32aeb5b%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
*Julio Biason*, Sofware Engineer
*AZION*  |  Deliver. Accelerate. Protect.
Office: +55 51 3083 8101   |  Mobile: +55 51
*99907 0554*

-- 
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/CAEM7gE3-prUj1QEHH3Sx6x2Nz_3-8daHyBuycBUsMbmhv-i6Bg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: how to find activities dues for today and tommorow

2018-07-25 Thread Julio Biason
Hi Deepak,

You could set up another model to track when something should be done to
the tree; something like this:

class Tree(models.Model):
...
planted_date = models.DateField()

class Reminder(models.Model):
tree = models.ForeignKey(tree)
when = models.DateField()
what = models.CharField()
done = models.BooleanField()

So, when you create a tree, you get the current date and create the entries
on the Reminder model. Somewhere, you can get the list of reminders with
something like

to_do = Reminder.object.filter(Q(tree=tree_in_view) &
Q(when_lte=datetime.datetime.today()) & Q(done_ne=True))

And throw this in the view -- it basically says "give me all the reminders
for the tree I'm looking at in this point (say, you have a page for each
tree, so this is the tree id), in which the reminder is from a date equal
or before today (in case you don't want to show reminders for dates in the
future) and which are not done (which you should also provide a way so the
user can mark the reminder as "done" and not be bothered with it again).

You can find more information about the Q here:
https://docs.djangoproject.com/en/2.0/topics/db/queries/#complex-lookups-with-q-objects

On Wed, Jul 25, 2018 at 3:07 PM, deepak madan 
wrote:

> suppose a model for the tree which is planted on some days. The second
> model has activities dues to be done after some regular interval like 1)
> giving fertilizer A after 5 days 2) giving fertilizer B after 15 days.
> My question is when this 5th or 15th days arrives, to design a reminder
> page to show activities dues today and tomorrow.
>
> Please help
> Whats logic in views.py
>
> --
> 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/dab4e417-4f94-4712-83d9-8c447bafc922%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/dab4e417-4f94-4712-83d9-8c447bafc922%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
*Julio Biason*, Sofware Engineer
*AZION*  |  Deliver. Accelerate. Protect.
Office: +55 51 3083 8101   |  Mobile: +55 51
*99907 0554*

-- 
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/CAEM7gE2TpCpVB8MKb6Yu_uiKSpNc%3DZRxYk5vs-q6aKaG-c8zZA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: avoiding import-time queries

2018-07-26 Thread Julio Biason
Hi Clarvierplayer,

Dunno if that's a best practice, but I'd add a module in the same app with
functions to retrieve the information and use cache (
https://docs.djangoproject.com/en/2.0/topics/cache/#basic-usage) copiously.
So, instead of loading the values at start up time, the values would be
filled only after the first time it was requested.

On Thu, Jul 26, 2018 at 3:21 PM,  wrote:

> I'm looking for some best-practice (or at least workable) suggestions for
> avoiding import-time queries. I have some database records that are
> constant, and these constants are used all over the application. Is there
> any way to get those constants out of the database once at startup?
>
> At present, I am working on a set of apps with a single underlying
> database. And they wouldn't build at all when I tried to migrate a new test
> database because of import-time queries, because it wants to validate the
> references to those constants at build time (and can't, because in this
> case my new test database has no tables yet). Is there any way to store
> these model records in something that will persist between builds (kind of
> like test fixtures)? A StackOverflow discussion
> <https://stackoverflow.com/questions/43326132/how-to-avoid-import-time-database-access-in-django>
>  suggested
> the Python Lazy Object Proxy, but that project appears to have been
> abandoned. The Django docs themselves simply recommend avoiding
> query-at-import behaviors--I can definitely see it causes all kinds of
> problems that are not easy to circumvent--but they make no recommendations
> for alternatives. Is it indeed necessary to keep querying for these all
> over the app? Is there a third-party solution that I've overlooked?
>
> Django 2.0. Thank 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/9510552d-9afe-47b0-842e-6f80e9a28bbe%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/9510552d-9afe-47b0-842e-6f80e9a28bbe%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
*Julio Biason*, Sofware Engineer
*AZION*  |  Deliver. Accelerate. Protect.
Office: +55 51 3083 8101   |  Mobile: +55 51
*99907 0554*

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


Re: JSON serializable error

2018-08-03 Thread Julio Biason
Hi Anusha,

It seems you're trying to generate a JSON of some object/dictionary with a
Datetime in it. Datetimes are not serializable 'cause there is no date/time
representation in JSON (maybe epoch, but that's not the default).

On Fri, Aug 3, 2018 at 11:18 AM, Anusha Kommineni <
anushakommineni...@gmail.com> wrote:

> Hi,
> I am getting below error.Can anyone help me?
>
>
> TypeError: datetime.datetime(2018, 2, 12, 0, 0, tzinfo=) is not JSON
> serializable
>
> --
> 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/CACBpiKjjH6WhtHfc%3DqLzQ7v5Dc7jDNuAmkRnzB4kb9rzE
> _Rr1Q%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CACBpiKjjH6WhtHfc%3DqLzQ7v5Dc7jDNuAmkRnzB4kb9rzE_Rr1Q%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
*Julio Biason*, Sofware Engineer
*AZION*  |  Deliver. Accelerate. Protect.
Office: +55 51 3083 8101   |  Mobile: +55 51
*99907 0554*

-- 
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/CAEM7gE0KV4kLbOnb2Eeinohpa%3D_F3MmF7cuo%2BH0N_gYKxG_78g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: New member: Germano Carella. I need help with django, limit_choices_to and admin interface

2018-08-09 Thread Julio Biason
Hi Germano,

When you use "ManyToMany", you're saying "any book can have any chapter and
vice versa". That's obviously what you don't want. What you want is "A book
has a closed set of chapters". This is done by thinking a bit on the other
way with Django: Instead of saying "There is a list of chapters of this
book", you say "The chapter belongs to a single book" with a foreign key:

class Book(models.Model):
   title = models.CharField(max_length=250)

class Chapters(models.Model):
   title = models.CharField(max_length=250)
   text = models.TextField()
   book = models.ForeignKey(Book)

Now a chapter can belong only to a book.

On Thu, Aug 9, 2018 at 4:34 PM, Germano Carella 
wrote:

> Hi,
> I'm Germano from Italy. I'm new of django.
> Probably this discussion has many many examples, but I can't find
> my situation.
> I have two models, Book and Chapters.
> These are simple models, I need them only for educational purpose.
>
> class Book(models.Model):
> title=models.CharField(max_length=250)
> chapters = models.ManyToManyField('Chapters')
>
> class Chapters(models.Model):
> title_of_chapter = models.CharField(max_length=250)
> text=models.TextField()
>
> Now, in admin interface I can add chapters on a new book and it works fine.
> So, whdn I try to add a second book I can see chapters of book I added
> previously.
>
> When I add a new book I want see only chapter of this book. List must be
> empty if I'm adding a new book.
> It's very simple, but I can't find a way to make it working.
>
> I tried somethings, such as
> chapters= models.ManyToManyField('Chapters',limit_choices_to=Q('
> book__title'=title))
> But this not works.
> I know Chapters has book_set, that is the set of references for a chapter.
>
> There is a way to make it working?
>
> --
> 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/2f104d64-50f4-433b-a764-be29d9a77f0c%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/2f104d64-50f4-433b-a764-be29d9a77f0c%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
*Julio Biason*, Sofware Engineer
*AZION*  |  Deliver. Accelerate. Protect.
Office: +55 51 3083 8101   |  Mobile: +55 51
*99907 0554*

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


Re: django

2018-08-09 Thread Julio Biason
Hi Vasu,

manage.py should be created when you run "django-admin startproject
". It should also create a directory called "" where
manage.py exists. That's where you should run the runserver command.

On Thu, Aug 9, 2018 at 4:39 PM, vasu  wrote:

> while running python manage.py runserver 8080 this in cmd ...i am getting
> cant open file 'manage.py' .But i followed the documentation
> properly.help me with this
>
> --
> 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/399c812e-887c-4b2f-919a-d11e5c0e2709%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/399c812e-887c-4b2f-919a-d11e5c0e2709%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
*Julio Biason*, Sofware Engineer
*AZION*  |  Deliver. Accelerate. Protect.
Office: +55 51 3083 8101   |  Mobile: +55 51
*99907 0554*

-- 
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/CAEM7gE2egO5uivcb64CLtzD%3D30mYCWF5JaeW902FK0%2BNRh2xoA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Error binding parameter 0 - probably unsupported type

2018-08-13 Thread Julio Biason
Hi Ruban,

Well, what's the type of `name`? That's what the error is saying: You're
passing a type that SQLite doesn't understand properly.

Also, why are you not using models to do that for you?

On Mon, Aug 13, 2018 at 9:42 AM, ruban bharath 
wrote:

> how to resolve from this error  *Error binding parameter 0 - probably
> unsupported type*
>
>
> db = sqlite3.connect('db.sqlite3')
> cursor = db.cursor()
> cursor.execute('insert into music_final(username,meaning) values(?,?)', 
> (name, meaning))
> db.commit()
>
> --
> 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/5bb72467-21c0-426e-9699-1c654d4511b4%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/5bb72467-21c0-426e-9699-1c654d4511b4%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
*Julio Biason*, Sofware Engineer
*AZION*  |  Deliver. Accelerate. Protect.
Office: +55 51 3083 8101   |  Mobile: +55 51
*99907 0554*

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


Re: Error binding parameter 0 - probably unsupported type

2018-08-13 Thread Julio Biason
Hey Ruban,

I'd suggest taking a look at the second part of the Django Tutorial:
https://docs.djangoproject.com/en/2.1/intro/tutorial02/

It explains how models work and how they interact with the database --
which is basically what you're trying to do.

On Mon, Aug 13, 2018 at 9:57 AM, ruban bharath 
wrote:

> Thank you sir,
>  The datatype of the name is text and i am new to django sir so i dint
> have clear knowledge  about it that's my problem sir
> and now what should i do to overcome this issue sir
>
>
> On Monday, August 13, 2018 at 6:17:12 PM UTC+5:30, Julio Biason wrote:
>>
>> Hi Ruban,
>>
>> Well, what's the type of `name`? That's what the error is saying: You're
>> passing a type that SQLite doesn't understand properly.
>>
>> Also, why are you not using models to do that for you?
>>
>> On Mon, Aug 13, 2018 at 9:42 AM, ruban bharath 
>> wrote:
>>
>>> how to resolve from this error  *Error binding parameter 0 - probably
>>> unsupported type*
>>>
>>>
>>> db = sqlite3.connect('db.sqlite3')
>>> cursor = db.cursor()
>>> cursor.execute('insert into music_final(username,meaning) values(?,?)', 
>>> (name, meaning))
>>> db.commit()
>>>
>>> --
>>> 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 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/ms
>>> gid/django-users/5bb72467-21c0-426e-9699-1c654d4511b4%40googlegroups.com
>>> <https://groups.google.com/d/msgid/django-users/5bb72467-21c0-426e-9699-1c654d4511b4%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> --
>> *Julio Biason*, Sofware Engineer
>> *AZION*  |  Deliver. Accelerate. Protect.
>> Office: +55 51 3083 8101  |  Mobile: +55 51 *99907 0554*
>>
> --
> 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/a6950b99-c31a-494e-b24e-affe4e78a299%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/a6950b99-c31a-494e-b24e-affe4e78a299%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
*Julio Biason*, Sofware Engineer
*AZION*  |  Deliver. Accelerate. Protect.
Office: +55 51 3083 8101   |  Mobile: +55 51
*99907 0554*

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


Re: App Registeries not ready

2018-08-15 Thread Julio Biason
Hi Vikrant,

Is that the code of your models.py? 'Cause you have mixed the model
definition with model usage in the same file and that won't work -- you'll
get the message you're getting, about the models not being loaded yet,
'cause Django just read the model definition, but hasn't set up the
database yet.

If that's the case, you need to mode the `newartist` and everything else to
a view to actually do that or call it in the shell.

On Wed, Aug 15, 2018 at 9:48 AM, Vikrant Gupta 
wrote:

> I'm trying to get a name from a column. the code is as following...
> but got an error by using get(id=1) as shown in screenshot.
> I'm using Django 2.1 and Python version 3.7 on Pycharm.
>
> from django.db import models
> # Create your models here.
>
>
> class Artist(models.Model):
> name=models.CharField('artist',max_length=50,primary_key=True)
> year_formed=models.PositiveIntegerField()
>
> class Album(models.Model):
> name=models.CharField('album',max_length=50)
> artist=models.ForeignKey(Artist,on_delete=models.PROTECT)
>
> from polls.models import Artist
>
> newartist=Artist(name='Vikrant',year_formed=1985)
> newartist.save()
>
> artist=Artist.objects.all()
> for i in artist:
> print(i.name)
> print(i.year_formed)
>
> ind=Artist.objects.get(id=1)
> print(ind.name)
>
> --
> 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/65548402-a106-46a1-a40d-ab8bd91348a1%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/65548402-a106-46a1-a40d-ab8bd91348a1%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
*Julio Biason*, Sofware Engineer
*AZION*  |  Deliver. Accelerate. Protect.
Office: +55 51 3083 8101   |  Mobile: +55 51
*99907 0554*

-- 
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/CAEM7gE2u6aWWa-9pK6cqP-wFyHYKQzUtr%2B%2B%3D0ua9MM2LkQFKDA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: DEBUG=False but still "Starting development server" ?!

2018-08-15 Thread Julio Biason
Hi Richard,

No, that just suppresses the DEBUG messages, either in logs as in views.

To have a production server, you need to deploy with wsgi:
https://docs.djangoproject.com/en/2.1/howto/deployment/wsgi/ .

On Wed, Aug 15, 2018 at 3:48 PM, Richard Belew  wrote:

> following https://docs.djangoproject.com/en/2.1/ref/settings/#debug
> i believe changing `settings.DEBUG` to `False` should make it a production
> server?
>
> On Wednesday, August 15, 2018 at 11:39:54 AM UTC-7, ireoluwa fakeye wrote:
>>
>> I'm confused on what the problem is  .as long as it's a development
>> server it  will still show the above  configuration
>>
>>
>> --
> 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/80665516-4686-4c42-a6e0-de2f612088d4%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/80665516-4686-4c42-a6e0-de2f612088d4%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
*Julio Biason*, Sofware Engineer
*AZION*  |  Deliver. Accelerate. Protect.
Office: +55 51 3083 8101   |  Mobile: +55 51
*99907 0554*

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


Re: Trouble installing Django

2018-09-03 Thread Julio Biason
Hi Phil,

This happens because you're trying to install Django system-wide and that
operation requires root (superuser) access.

The best way to install Django is to first create a virtualenv. That will
isolate the install directory from the system, so you can freely install
and uninstall any libraries without interfering with the system.

You can find more information here:
https://docs.python.org/3/library/venv.html

On Mon, Sep 3, 2018 at 2:35 PM, Phil Campaigne 
wrote:

> I have successfully installed python 3.7 and virtualenv. on my MACBook Pro
> with MAC High Sierra  10.6
> Now I am having trouble installing Django
> I don't understand the error message I am getting...especially teh last
> line.
>
>
> Owners-MacBook-Pro:realityBB owner$ pip install Django
> Collecting Django
>   Downloading 
> https://files.pythonhosted.org/packages/f8/1c/31112c778b7a56ce18e3fff5e8915719fbe1cd3476c1eef557dddacfac8b/Django-1.11.15-py2.py3-none-any.whl
>  (6.9MB)
> 100% || 7.0MB 2.2MB/s
> Requirement already satisfied: pytz in 
> /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python 
> (from Django) (2013.7)
> Installing collected packages: Django
> Could not install packages due to an EnvironmentError: [Errno 13] Permission 
> denied: '/Library/Python/2.7/site-packages/Django-1.11.15.dist-info'
> Consider using the `--user` option or check the permissions.
>
> --
> 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/2d82fa91-1cd0-4a16-9ebd-568e7aeb8b2e%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/2d82fa91-1cd0-4a16-9ebd-568e7aeb8b2e%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
*Julio Biason*, Sofware Engineer
*AZION*  |  Deliver. Accelerate. Protect.
Office: +55 51 3083 8101   |  Mobile: +55 51
*99907 0554*

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


Re: saleor error NoReverseMatch at /en/

2018-09-04 Thread Julio Biason
Hey Tim,

Are you sure your view is defined with spaces in the urls.py? Shouldn't it
be {% url 'manifest' %} instead, with no spaces around the name?

On Tue, Sep 4, 2018 at 6:28 AM, Tim Vogt (Tim Vogt) 
wrote:

> I have made saleor local
>
> after restart I get this error
>
> Tried to change the “ “ into ‘ ‘ bout before it worked.
>
> Any tips how to solve this?
>
> Tim
>
> NoReverseMatch at /en/
>
> Reverse for ' manifest ' not found. ' manifest ' is not a valid view function 
> or pattern name.
>
> Request Method: GET
> Request URL: http://localhost:8000/en/
> Django Version: 2.0.8
> Exception Type: NoReverseMatch
> Exception Value:
>
> Reverse for ' manifest ' not found. ' manifest ' is not a valid view function 
> or pattern name.
>
> Exception Location: /Users/timvogt/virtualenvs/saleor/lib/python3.6/site-
> packages/django/urls/resolvers.py in _reverse_with_prefix, line 634
> Python Executable: /Users/timvogt/virtualenvs/saleor/bin/python3
> Python Version: 3.6.5
> Python Path:
>
> ['/Users/timvogt/Software_projects/saleor',
>  '/Users/timvogt/virtualenvs/saleor/lib/python36.zip',
>  '/Users/timvogt/virtualenvs/saleor/lib/python3.6',
>  '/Users/timvogt/virtualenvs/saleor/lib/python3.6/lib-dynload',
>  '/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6',
>  '/Users/timvogt/virtualenvs/saleor/lib/python3.6/site-packages',
>  '/Users/timvogt/Software_projects/saleor']
>
> Server time: Tue, 4 Sep 2018 04:26:23 -0500
> Error during template rendering
> In template /Users/timvogt/Software_projects/saleor/templates/base.html,
> error at line *24*
> Reverse for ' manifest ' not found. ' manifest ' is not a valid view
> function or pattern name.
> 14 
> 15 
> 16  {% get_available_languages as
> LANGUAGES %} {% for lang_code, language_name in LANGUAGES %}
> 17  {% endfor %} {%
> endblock meta %} {% include 'favicon.html' %} {% render_bundle 'storefront'
> 'css' attrs='async' %} {% block stylesheet %}{% endblock stylesheet %} {%
> block meta_tags %}
> 18 
> 19 
> 20 
> 21 
> 22  %}"> {% endblock meta_tags %}
> 23
> 24 
> 25
> 26 
> 27 
> 30 
> 31
> 32 
> 33 {% block header %}
> 34 
>
> --
> 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/F33E62F9-637C-4EB0-A1E0-CA36735500DF%40gmail.com
> <https://groups.google.com/d/msgid/django-users/F33E62F9-637C-4EB0-A1E0-CA36735500DF%40gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
*Julio Biason*, Sofware Engineer
*AZION*  |  Deliver. Accelerate. Protect.
Office: +55 51 3083 8101   |  Mobile: +55 51
*99907 0554*

-- 
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/CAEM7gE0mf7EAUnHPKA%3DSp%2BruKZSdpAZBv%2BrPtjXacUZQBeBkXQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Trying to build a cart using django cart. "" error unhashable type dict ""

2018-09-04 Thread Julio Biason
Hi Carl,

The problem seems to be the use of `get_template`:
https://docs.djangoproject.com/en/2.1/topics/templates/#usage

The second parameter (the one you're using a dict) is not the values to
pass to the template, but the name of the template engine to be used.

I'd suggest using `render` (
https://docs.djangoproject.com/en/2.1/topics/http/shortcuts/#render)
instead, which is more common than trying to get a template from a specific
loader.

On Tue, Sep 4, 2018 at 2:37 AM, carl collins 
wrote:

> Here is the code for view.py in my cart app  please help(also see the
> screenshot):
>
>
> from django.template import loader
> from django.http import HttpResponse
> from django.template.loader import render_to_string
> import django.template.loader
>
>
> from cart.cart import Cart
> from .models import Product
> '''from cart.models import Category, Product'''
>
>
> #gallerydefault view
> def index(request):
> #prepare the models
> #empty
> #prepare the template
> template = loader.get_template('templates/cart.html',
> dict(cart=Cart(request))  )
> #prepare the context
> context = {'request':request}
> return HttpResponse(template.render(context, request))
>
> def add_to_cart(request, product_id, quantity):
> product = Product.objects.get(id=product_id)
> cart = Cart(request)
> cart.add(product, product.unit_price, quantity)
>
> def remove_from_cart(request, product_id):
> product = Product.objects.get(id=product_id)
> cart = Cart(request)
> cart.remove(product)
>
>
> def get_cart(request):
>
> template = loader.get_template('templates/cart.html', dict(cart =
> Cart(request)))
>
> #prepare the context
> context = {'request':request}
> return HttpResponse(template.render(context, request))
> return HttpResponse(template.render(context, request))
>
> --
> 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/a78552f7-9973-456d-b0d5-79602f4bbf5c%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/a78552f7-9973-456d-b0d5-79602f4bbf5c%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
*Julio Biason*, Sofware Engineer
*AZION*  |  Deliver. Accelerate. Protect.
Office: +55 51 3083 8101   |  Mobile: +55 51
*99907 0554*

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


Re: Django Admin Multiple Models and Dropdown list

2018-09-18 Thread Julio Biason
Hey Mab,

You probably need to replace you `__init__` to `__str__`. They are two
different things.

On Tue, Sep 18, 2018 at 12:18 PM,  wrote:

> I have the following models and admin files and I would like to be able to
> show the text representation of the ExpenseCategory category field in the
> dropdown list on the Admin page. However, the dropdown list is displaying
> "ExpenseCategory Object(n)" instead of the actual text category such as
> "Utilities", "Office Supplies" etc.
>
> I need to insert the ExpenseCategory pk in the Expenses table but want a
> human readable drop down list to show the category text instead.
>
> Any guidance would be appreciated. Thanks in advance..
>
>
> MAIN/MODELS>PY
>
> class ExpenseCategory(models.Model):
> category = models.CharField(max_length=200)
> deductible = models.TextField(choices=BOOLEAN_CHOICE)
>
> def __int__(self):
>return self.category
>
> class Expenses(models.Model):
> expense = models.CharField(max_length=200)
> category = models.ForeignKey(ExpenseCategory,
> on_delete=models.PROTECT)
> expense_amount = models.DecimalField(max_digits=8, decimal_places=2)
> expense_date = models.DateField(auto_now_add=False)
> expense_type = models.TextField(choices=SOURCE)
> description = models.CharField(max_length=200)
> source = models.CharField(max_length=200)
>
> def __int__(self):
>return self.expense
> 
> MAIN/ADMIN.PY
>
> class ExpenseCategoryAdmin(admin.ModelAdmin):
>list_display = ['category','deductible']
>list_filter = ['deductible']
>
> admin.site.register(models.ExpenseCategory, ExpenseCategoryAdmin)
>
> class ExpensesAdmin(admin.ModelAdmin):
>list_display = ['expense','expense_amount','expense_date','category','
> expense_type']
>list_filter = ['expense_date','category','expense_type']
>
> admin.site.register(models.Expenses, ExpensesAdmin)
>
>
>
> --
> 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/b0d5e22e-2d20-4e11-ac22-00fb1eb9794f%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/b0d5e22e-2d20-4e11-ac22-00fb1eb9794f%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
*Julio Biason*, Sofware Engineer
*AZION*  |  Deliver. Accelerate. Protect.
Office: +55 51 3083 8101   |  Mobile: +55 51
*99907 0554*

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