Re: Create Mobile App from Django Template

2017-07-17 Thread Marsel Xhaxho
Hello,

Django Rest Framework  to the rescue. 
You can use this package to expose your database via a HTTP REST api and 
consume it via swift/java or any other language/platform you might think.

This actually is the way web works nowadays, even for web apps.

> On 17 Jul 2017, at 22:52, Jani Tiainen  wrote:
> 
> Hi,
> 
> There are numerous ways to do that. You could create mobile version of your 
> site or do called responsive design. That way site would be accessible with 
> virtually any device.
> 
> If you want to create native app you can write for example rest api to 
> provide data for your app.
> 
> 17.7.2017 21.54 "Megan Zhao"  > kirjoitti:
> My friend and I followed the Django tutorial to create a web blog where the 
> professors can post their office hours and students can access to search and 
> browse. We want to create a mobile app that contains the same info so that 
> when the professors post on the web, the info in the app also updates as 
> well. I think I can use Django to create a mobile app? So I am wondering if 
> there is any way I can create an IOS app through Swift and then access the 
> database that is stored in the Django so that when there is new data in the 
> database the mobile app also updates as well. 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/318f52e1-c804-47fd-8a10-4c49de6cc0e0%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/CAHn91odUopNTxB5WSdsNttqMAxOLi7KwARDoHk5Xv8j%2Bc-yvUw%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/1FE3BF0B-F606-4EAE-88E0-729DA0FA6E1B%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: I am new in this world of Python.

2017-07-17 Thread Lachlan Musicman
Adil,

If you are looking for a long list of exercises to practice on, try the
Euler project https://projecteuler.net/archives

It starts easy

cheers
L.

--
"The antidote to apocalypticism is *apocalyptic civics*. Apocalyptic civics
is the insistence that we cannot ignore the truth, nor should we panic
about it. It is a shared consciousness that our institutions have failed
and our ecosystem is collapsing, yet we are still here — and we are
creative agents who can shape our destinies. Apocalyptic civics is the
conviction that the only way out is through, and the only way through is
together. "

*Greg Bloom* @greggish
https://twitter.com/greggish/status/873177525903609857

On 18 July 2017 at 08:18, yingi keme  wrote:

> Well you just need to keep practicing. Try to write programs to solve some
> simple task.
>
> Remember, learning the syntax is just the first step. You have to practice
> more by doing some exercises. When you are very comfortable with language,
> then you can start a web app project.
>
> You always learn more by doing stuffs. I assume this is your first
> programming language, so you have to be patient enough to debug your codes.
>
> Yingi Kem
>
> On 17 Jul 2017, at 7:22 PM, Adil Balti  wrote:
>
> Hello all.
> I am a beginner in Python .Just started to learn Python .Using Python 3.6 .
> Practicing variables, strings , etc .
> Any suggestion from you seniors would be appreciated .
> Thnx in advance
> (sorry for my bad Eng grammer)
>
> --
> 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/ac4767f9-80e1-488c-be47-38e407e2368f%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/60A0F316-758B-413E-ABED-CCDF79CC4DCA%40gmail.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: I am new in this world of Python.

2017-07-17 Thread yingi keme
Well you just need to keep practicing. Try to write programs to solve some 
simple task. 

Remember, learning the syntax is just the first step. You have to practice more 
by doing some exercises. When you are very comfortable with language, then you 
can start a web app project. 

You always learn more by doing stuffs. I assume this is your first programming 
language, so you have to be patient enough to debug your codes.

Yingi Kem

> On 17 Jul 2017, at 7:22 PM, Adil Balti  wrote:
> 
> Hello all. 
> I am a beginner in Python .Just started to learn Python .Using Python 3.6 .
> Practicing variables, strings , etc .
> Any suggestion from you seniors would be appreciated .
> Thnx in advance
> (sorry for my bad Eng grammer)
> -- 
> 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/ac4767f9-80e1-488c-be47-38e407e2368f%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/60A0F316-758B-413E-ABED-CCDF79CC4DCA%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Build Mobile App from Django Web

2017-07-17 Thread Megan Zhao
My friend and I build a web blog from Django tutorial where the professors 
can post their office hours and students and search and browse them. We 
want to build a mobile app that will update when the professors post on the 
website. I don't think we can build a mobile app from Django. Is there 
anyway I can access the database of the website and then the app can use 
the database so that the website and the mobile app sync. 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/cf081eb6-1c68-4a10-a5a7-58dc6b749fa5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Create Mobile App from Django Template

2017-07-17 Thread Jani Tiainen
Hi,

There are numerous ways to do that. You could create mobile version of your
site or do called responsive design. That way site would be accessible with
virtually any device.

If you want to create native app you can write for example rest api to
provide data for your app.

17.7.2017 21.54 "Megan Zhao"  kirjoitti:

> My friend and I followed the Django tutorial to create a web blog where
> the professors can post their office hours and students can access to
> search and browse. We want to create a mobile app that contains the same
> info so that when the professors post on the web, the info in the app also
> updates as well. I think I can use Django to create a mobile app? So I am
> wondering if there is any way I can create an IOS app through Swift and
> then access the database that is stored in the Django so that when there is
> new data in the database the mobile app also updates as well. 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/318f52e1-c804-47fd-8a10-4c49de6cc0e0%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/CAHn91odUopNTxB5WSdsNttqMAxOLi7KwARDoHk5Xv8j%2Bc-yvUw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


I am new in this world of Python.

2017-07-17 Thread Adil Balti
Hello all. 
I am a beginner in Python .Just started to learn Python .Using Python 3.6 .
Practicing variables, strings , etc .
Any suggestion from you seniors would be appreciated .
Thnx in advance
(sorry for my bad Eng grammer)

-- 
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/ac4767f9-80e1-488c-be47-38e407e2368f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Create Mobile App from Django Template

2017-07-17 Thread Megan Zhao
My friend and I followed the Django tutorial to create a web blog where the 
professors can post their office hours and students can access to search 
and browse. We want to create a mobile app that contains the same info so 
that when the professors post on the web, the info in the app also updates 
as well. I think I can use Django to create a mobile app? So I am wondering 
if there is any way I can create an IOS app through Swift and then access 
the database that is stored in the Django so that when there is new data in 
the database the mobile app also updates as well. 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/318f52e1-c804-47fd-8a10-4c49de6cc0e0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


ValueError: Need 2 values to unpack in for loop; got 3 (actually num_loopvars = 2 and len_item = 3)

2017-07-17 Thread Ogi Vranesic

Michal, Thanks very much for your reply.

I guessed, that is something like in your example.
And I find it in template.

So the conclusion is that there is no more allowed in django template 
engine to use *for* loop with less elements to unpack,

and I think that is also consistent and more pythonic.

Best regards
Ogi


On 17.07.2017 16:08, Michal Petrucha wrote:

On Mon, Jul 17, 2017 at 03:46:30PM +0200, Ogi Vranesic wrote:

Hi

I have used some templates in older django versions.
But now in django 1.11 using the same templates, the error:

ValueError: Need 2 values to unpack in for loop; got 3.

will be raised on line 207 in module django.template.defaulttags
by the method render of class ForNode

Actually is by me looking at code *num_loopvars = 2* and *len_item = 3*.

After I've outcommented this part of code, some of this template as a form
is displayed and one can work on it.

So could somebody tell me what is purpose of this two variables and
comparing of them?

Thanks very much in advance and best regards
Ogi

Sounds like you are trying to loop over a list in your template,
something like this::

 {% for a, b in mylist %}
 ...
 {% endfor %}

The problem is that mylist contains triples, not pairs. It would help
a lot if you could show the actual template code, as well as the
context that you pass to the template.

Cheers,

Michal



--
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/3478a2a2-166a-df65-9ca8-35873b2aa008%40redcor.ch.
For more options, visit https://groups.google.com/d/optout.


Re: Use one correspondig database user for each application user

2017-07-17 Thread guettli


Am Donnerstag, 13. Juli 2017 10:32:26 UTC+2 schrieb Antonis Christofides:
>
> BTW,
>
> another idea for "connecting" to PostgreSQL as different users would be to 
> actually have Django connect to PostgreSQL as a superuser and then 
> (probably in some early middleware) execute SET SESSION AUTHORIZATION to 
> switch permissions. This is probably easier and more robust and it's easier 
> to reuse connections.
>
> Regards,
>
> Antonis
>

Yes, this should work. Thank you for this hint. 

-- 
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/d7e7713d-cddb-4610-931a-fef6e36c2213%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: ValueError: Need 2 values to unpack in for loop; got 3 (actually num_loopvars = 2 and len_item = 3)

2017-07-17 Thread Michal Petrucha
On Mon, Jul 17, 2017 at 03:46:30PM +0200, Ogi Vranesic wrote:
> Hi
> 
> I have used some templates in older django versions.
> But now in django 1.11 using the same templates, the error:
> 
> ValueError: Need 2 values to unpack in for loop; got 3.
> 
> will be raised on line 207 in module django.template.defaulttags
> by the method render of class ForNode
> 
> Actually is by me looking at code *num_loopvars = 2* and *len_item = 3*.
> 
> After I've outcommented this part of code, some of this template as a form
> is displayed and one can work on it.
> 
> So could somebody tell me what is purpose of this two variables and
> comparing of them?
> 
> Thanks very much in advance and best regards
> Ogi

Sounds like you are trying to loop over a list in your template,
something like this::

{% for a, b in mylist %}
...
{% endfor %}

The problem is that mylist contains triples, not pairs. It would help
a lot if you could show the actual template code, as well as the
context that you pass to the template.

Cheers,

Michal

-- 
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/20170717140802.GD23772%40konk.org.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: Digital signature


ValueError: Need 2 values to unpack in for loop; got 3 (actually num_loopvars = 2 and len_item = 3)

2017-07-17 Thread Ogi Vranesic

Hi

I have used some templates in older django versions.
But now in django 1.11 using the same templates, the error:

ValueError: Need 2 values to unpack in for loop; got 3.

will be raised on line 207 in module django.template.defaulttags
by the method render of class ForNode

Actually is by me looking at code *num_loopvars = 2* and *len_item = 3*.

After I've outcommented this part of code, some of this template as a 
form is displayed and one can work on it.


So could somebody tell me what is purpose of this two variables and 
comparing of them?


Thanks very much in advance and best regards
Ogi


--
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/2954a3e8-4590-64ce-1264-39c3e05b1dde%40redcor.ch.
For more options, visit https://groups.google.com/d/optout.