Re: Wich OS for develop?

2018-01-02 Thread Mario Gudelj
Mac or Linux with PyCharm. Windows can be used but you may struggle with
some Python packages which work well and are easily setup on nix.

On Wed, 3 Jan 2018 at 8:40 am, Mike Morris  wrote:

> I've been linux only for many years - the last Windows I used was 2000
> Professional so you can guess my recommendation on OS :-)
>
> As for IDE, I found "Eric 6" (https://eric-ide.python-projects.org/),
> which is pretty great, and free. Installation was bumpy since it has some
> pre-requisites, but it's easy enough if you're PC savvy.
>
> Fully integrated w/ Django via  plugin; can run the dev server directly,
> etc.
>
>
> Good luck...
>
>
>
> On 01/02/2018 01:29 PM, Avraham Serour wrote:
>
> In my opinion ubuntu
> no, but I wouldn't say good either
> yes
> pycharm
> good luck
>
> On Tue, Jan 2, 2018 at 11:23 PM, Julián Melero Hidalgo <
> jul...@melerohidalgo.es> wrote:
>
>> Hi all.
>> I don't have experience with django, so I have so much questions.
>> The questions are:
>> Wich OS is better to develop with django?
>> Windows is a bad option?
>> Can I use Win for develop and GNU/Linux as a server?
>> What IDE (atom, VS Code, vim,etc..)you use?
>> 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/2be2cccf-461a-40f7-a7d6-0ba65c1c5acd%40email.android.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/CAFWa6tLdWo6iRgXO0kcgwtkNtV0tF03DY-ZJMm2pbuaM%3Dwabug%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/4f698f78-7367-62fa-9e54-4aeac4f4d40a%40musicplace.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/CAHqTbjncg6YaXfh1P16p3M7d0OKQ6pwAYFHyvCU-_cY6-mZJ6w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: authentication by ldap server

2017-12-01 Thread Mario Gudelj
You should use django-auth-ldap. It will give you the ability to bind ldap
attributes with the attributes from your user model using a dict inside
settings. It’ll also get the users’ groups and create those groups inside
Django. So try plugging that in and come back if you get stuck. All you
really need to define is the server IP or URL, bind username and password
if required, a common DN and those aforementioned attributes and groups.
Then once you specify the ldap middleware you can use Django’s
authentication mechanism.

Cheers,

M

On Fri, 1 Dec 2017 at 11:20 pm, pacopyc pacopyc  wrote:

> Hi, I am a beginner django programmer.
>
>
> I would like to authenticate users of my web application to an ldap server
> (which has about 1000 users defined).
>
>
> Not all users of the ldap server must be able to access the web
> application (only 50 ldap users must have access to the web application).
>
>
> First problem: I can not authenticate users on ldap server. I referred to
> https://django-auth-ldap.readthedocs.io/en/latest/ and some articles on
> the Internet. Do you have any simple examples? I just want to check
> username and password
>
>
> Second issue: Once the user has been authenticated on the ldap server, I
> must verify that he can access the web application. How can I do? Do I have
> to define it on Django too? How?
>
>
> Third issue: Web application users must have different permissions in
> using the application. Permissions are defined on Django. How can I link 50
> ldap users to these permissions?
>
>
> Thanks
>
> pacopyc
>
> --
> 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/ceb285c5-1d7b-4412-ad77-7425ae499dfa%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/CAHqTbjkWkKzf5Bm-91ptezKo3VUzmkKSX6Bpnm2jQguqjE2WaA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How do I customize registration form HTML?

2017-12-01 Thread Mario Gudelj
I’d recommend you to look at crispy forms as well.

On Sat, 2 Dec 2017 at 1:29 am, yingi keme  wrote:

> Hey, i made a mistake in the previous reply. Its widget and not widgets.
> The correct code is:
>
>
> Intead of rendering it with the as_p. You can render them individually.
> ie
>
> {{form.name}}
> {{form.username}}
>
>  In the forms.py, in each of the fields, add widget attributes.
>
> def MyForm(forms.ModelForm):
> name = forms.CharField(label='name',
> widget=forms.TextInput(attrs={'placeholder':'Name',
> 'class':'yourInputFieldClassName'}))
>
>
> Yingi Kem
>
> On 1 Dec 2017, at 1:50 AM, Tom Tanner 
> wrote:
>
> The HTML for the user registration form looks like this:
> 
>  {% csrf_token %}
>  {{ registration_form.as_p }}
>  Register
> 
>
> I understand that the `registration_form.as_p` line automatically gives me
> the form's HTML. But I'd like to customize that HTML. For instance, I'd
> like the label text to be placeholders instead. How do I do this?
>
> If it helps, `registration_form` is `UserCreationForm()`
>
> --
> 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/12490918-6d56-4079-ab53-9b8cb6f9fd9b%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/67032251-4A45-46B5-95F3-EC7B552A273E%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/CAHqTbjkGORT6FDZBpMDfT-EDEezvGirsbpWEo_EyOjWOnYHuJw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Supervisor FATAl Exited too quickly (process log may have details(About inet_http_server and unix_http_server)

2017-09-09 Thread Mario Gudelj
Does that Guniorn command run directly from the command line? What's
gunicorn.pod? Make sure you can start gunicorn outside of supervisor and
then stick that command into conf file.

Cheers,

M

On Sun, 10 Sep 2017 at 2:28 am, Jonathan Cheng 
wrote:

> I wrote a Django project and I use supervisor with gunicorn
>
>
> /etc/supervisor/conf.d/weather.conf
>
>
>
> [group:weather_station]
> programs=site
>
> [program:site]
> directory=$PROJECT
> command=/home/nhcc/.local/bin/gunicorn -c /$PROJECT/weather_station/
> gunicorn.conf.py -p gunicorn.pod weather_station.wsgi
> autostart=true
> autorestart=true
> stdout_logfile=/var/log/supervisor.log
> environment=my-environment-variable
> ~
>
>
>
>
> `sudo supervisorctl reread`
>
>
> `sudo supervisorctl reload`
>
>
> `sudo supervisorctl status`
>
>
> It showed up the error
>
> > weather_station:site FATAL Exited too quickly (process
> log may have details)
>
>
> So I checked out the log file :
>
> `/var/log/supervisor/supervisord.log`
>
>
> > 2017-09-08 17:15:25,000 CRIT Supervisor running as root (no user in
>> config file)
>> > 2017-09-08 17:15:25,000 WARN Included extra file
>> "/etc/supervisor/conf.d/weather.conf" during parsing
>> >2017-09-08 17:15:25,007 INFO RPC interface 'supervisor' initialized
>> >2017-09-08 17:15:25,008 CRIT Server 'inet_http_server' running without
>> any HTTP
>> > authentication checking
>> > 2017-09-08 17:15:25,008 INFO RPC interface
>> > 'supervisor' initialized
>> > 2017-09-08 17:15:25,008 CRIT Server 'unix_http_server' running without
>> any HTTP authentication checking
>> > 2017-09-08 17:15:25,008 INFO supervisord started with pid 32371
>> > 2017-09-08 17:15:26,013 INFO spawned: 'site' with pid 32447
>> > 2017-09-08 17:15:26,018 INFO exited: site (exit status 127; not
>> expected)
>> > 2017-09-08 17:15:27,022 INFO spawned: 'site' with pid 32448
>> > 2017-09-08 17:15:27,026 INFO exited: site (exit status 127; not
>> expected)
>> > 2017-09-08 17:15:29,032 INFO spawned: 'site' with pid 32449
>> > 2017-09-08 17:15:29,038 INFO exited: site (exit status 127; not
>> expected)
>> > 2017-09-08 17:15:32,043 INFO spawned: 'site' with pid 32451
>> > 2017-09-08 17:15:32,059 INFO exited: site (exit status 127; not
>> expected)
>> > 2017-09-08 17:15:33,060 INFO gave up: site entered FATAL state, too
>> > many start retries too quickly
>>
>>
>>
>
>
>
>
> According to `Included extra file`[the solution](
> https://github.com/Supervisor/supervisor/issues/272)
>
> According to `Server 'unix_http_server' running without any HTTP
> authentication checking`[the solution](
> https://github.com/Supervisor/supervisor/issues/717)
>
> I added two section [unix_http_server] and [inet_http_server]
>
>
>
>[unix_http_server]
> file=/var/run/supervisor.sock   ; (the path to the socket file)
> chmod=0766 ; socket file mode (default 0700)
> ;chown=nobody:nogroup   ; socket file uid:gid owner
> ;username=user  ; (default is no username (open server))
> ;password=123   ; (default is no password (open server))
>
> [inet_http_server] ; inet (TCP) server disabled by default
> port=*:9001; (ip_address:port specifier, *:port for all iface,
> ;username=user  ; (default is no username (open server))
> ;password=123   ; (default is no password (open server))
>
>
>
>
> This is the current  supervisor.conf
>
>
>
> [unix_http_server]
> file=/var/run/supervisor.sock   ; (the path to the socket file)
> chmod=0766 ; socket file mode (default 0700)
>
> [supervisord]
> logfile=/var/log/supervisor/supervisord.log ; (main log file;default
> $CWD/supervisord.log)
> pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default
> supervisord.pid)
> childlogdir=/var/log/supervisor; ('AUTO' child log dir,
> default $TEMP)
>
> [rpcinterface:supervisor]
> supervisor.rpcinterface_factory = supervisor.rpcinterface:
> make_main_rpcinterface
>
> [supervisorctl]
> serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL  for a
> unix socket
>
> [inet_http_server] ; inet (TCP) server disabled by default
> port=*:9001;
>
> [include]
> files = /etc/supervisor/*.conf
> files = /etc/supervisor/conf.d/*.conf
>
>
>
>
>
>
>
>
>
> Then I ran
>
>
>sudo supervisord -c /etc/supervisor/supervisord.conf
> sudo supervisorctl -c /etc/supervisor/supervisord.conf
>
>
>
>
> And I checked the log again
>
> The error is completely be same
>
> Does anyone know why??
>
> --
> 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 

Re: facing an error from many hours

2017-06-23 Thread Mario Gudelj
Or kill all python processes or try a different port in your config

On Fri, 23 Jun 2017 at 11:41 pm, Matthew Pava  wrote:

> I’ve had this problem a few times.  First, try updating PyCharm.  I find
> when I click on my runserver icon, I just keep clicking it until it works.
> Not much of a fix, but it has worked for me.
>
>
>
> *From:* django-users@googlegroups.com [mailto:
> django-users@googlegroups.com] *On Behalf Of *khaleeq rehman
> *Sent:* Friday, June 23, 2017 8:35 AM
> *To:* Django users
> *Subject:* facing an error from many hours
>
>
>
>
> 
>
>
>
> --
> 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/75dee6b8-4451-47ef-b797-0f087d8bf4d0%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/347221b2dc8d4359a460b85127639404%40ISS1.ISS.LOCAL
> 
> .
> 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/CAHqTbjn3PtnXCOWbpQg%3D6-p%2Bo3yhD_E7y_ZwTOsoi6Q3rkj8QQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: database update after paypal payment

2017-03-01 Thread Mario Gudelj
You should use Django-PayPal app. It has views for IPN and PDT, stores
transaction details in DB, does TX verification and it fires of a signal
when when a successful transaction comes in to your webhook.

All you have to do is specify some URLs and settings. It'll even render
that front end form for you using a Django form. It really is a bomb.

Cheers,

M



On Wed, 1 Mar 2017 at 11:10 pm, Melvyn Sopacua 
wrote:

> On Tuesday 28 February 2017 21:13:39 agoulouzego...@gmail.com wrote:
>
> > hello! I am trying to update my database after paypal has received
>
> > the payment from customer. The problem is that I don't really know to
>
> > do it. This is what I am doing now
>
>
>
> This code is all irrelevant. This is the important URL:
>
> > 
> > name="return" type="hidden" value="http://www.example.com/thank-you;>
>
>
>
> Wouldn't name it "thank-you" either. That would be the final page, but the
> flow is:
>
>
>
> - Submit to PayPal
>
> - At above return_url, receive data from PayPal:
>
> - Check for success / failure
>
> - If success:
>
> set paid to True, redirect to /thank-you
>
> - else:
>
> display error and cart
>
>
>
> --
>
> 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/3452662.H3dCPjKHmD%40devstation
> 
> .
> 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/CAHqTbjmeT%3D8U0wPqLTPBcb6FxSPnECiaFR0Y99-%2B0ooZhKQK6Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Minify HTML in Django

2016-11-01 Thread Mario Gudelj
Take a look at Django Compressor.

On Tuesday, 1 November 2016, Web Architect  wrote:

> Hi,
>
> Is there an optimal and efficient way to minify HTML in Django?
>
> I tried using django-htmlmin but it's affecting the performance.
>
> 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/f7886579-ff7f-4be2-8f25-c12e3e010899%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/CAHqTbjkyCEk%2BH%2BpYV6ef_xLuouJk3fb-o%2BG0rn2J8mrK%2BQtO1Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How make Django sites look as professional as WordPress just as easily as WordPress is easy?

2016-08-15 Thread Mario Gudelj
It all depends what you want to do, Chris. I suggest you to find a html
template on sites like template monster or theme forest, split it into base
and extract page from it, make Django serve the static pages and then make
those features that should be driven by database dynamic by creating models
for them, plug in forms etc. Use Mezzanine if you want your clients to edit
the content but you may not need CMS. It all depends on the type of end
user. You can also try Wagtail CMS.

Good luck.

M

On Monday, 15 August 2016, Chris Seberino  wrote:

> I love Django.  It is a beautiful system for developers.  You seem to
> start at a lower level with Django than with WordPress which gives you more
> power and flexibility.
>
> Nevertheless, I also like how WordPress STARTS with a very professional
> looking sites and almost locks you into a nice looking style.
>
> Because I'm not the best visual artist in the world, is there a way to
> make Django "force" your site to look professional for us "graphically
> challenged'
> engineers? ;)
>
> I'm aware of the Mezzanine CMS but wasn't so excited about learning yet
> another tool.  Nevertheless, if that is the answer I'll consider it.
>
> Is that the magic bullet I'm looking for or is there something else?
>
> Thanks!
>
> Chris
>
>
>
>
>
>
> --
> 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/33c39198-8760-473a-8c8d-24601fa638c0%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/CAHqTbj%3DhQOaiVmPsE8kmEXMOeggmDpXusnMB9Svy%2B2pRAzoFWA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Help me!!! django

2016-06-30 Thread Mario Gudelj
There's a nice LDAP app for Django at
https://pypi.python.org/pypi/django-auth-ldap/1.2.8 but I'm not sure if
it's suitable for what you need to do. I think you need a Python LDAP
module to create a connection, bind, perform a simple search and then parse
the results to get those email addresses.

Here are some examples of Python LDAP search operations
https://www.packtpub.com/books/content/configuring-and-securing-python-ldap-applications-part-2

Cheers,

M

On Fri, 1 Jul 2016 at 07:53 Цибарт Сергей  wrote:

> urgently need to fasten on the portal, which is on Django, a form
> https://postimg.org/image/8myn5jqnb/, but I'm new to this. Help, who than
> can please
>
> --
> 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/b858661e-30a9-433a-9d05-b7b199247cab%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/CAHqTbjnT2V2PVAa%3D9UgGmbMa8q5DTEp1an9OM6B_g2LZ57gCsw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Disappearing desktop icons

2016-04-21 Thread Mario Gudelj
I think you're posting this to a wrong list Gary. This od django list.

On Friday, 22 April 2016, Gary Roach  wrote:

> Debian Stretch system
> amd64 system
>
> A couple of weeks  ago I updated my system and all of my desktop icons
> start looking as shown in attachment.
>
> Anyone have an idea what could cause this. I have looked thru the log
> files and have found nothing. Rebooting doesn't help.
>
> Gary R.
>
> --
> 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/57198E16.6000606%40verizon.net
> .
> 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/CAHqTbj%3DLoA8GdQjohk9Tyfaah0Ek_70LfKQ4ubPzpOhKVADNAg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Fabric - Someone has a fabfile to build a Sentry server?

2016-04-05 Thread Mario Gudelj
Look for fabulous on GitHub. It sets up all of that on ec2.

On Wednesday, 6 April 2016, Neto  wrote:

> I need a fabric to install Sentry, Redis, and configure the server with
> nginx template, supervisor etc.
> I have a Amazon Instance, and I want with a command install everything.
> I have following the docs, but I had problem with sentry-worker
> (supervisor).
> My server also was too slow
>
> Em terça-feira, 5 de abril de 2016 15:54:07 UTC-3, Neto escreveu:
>>
>> I need to build a server using nginx to run sentry, I needed a routine to
>> install all the necessary packages, and configure the server.
>> I am using Ubuntu, Nginx, 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/a6b376d4-2c3d-49ae-a71d-aab60069ffde%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/CAHqTbjmXzRh2r91a08n7YOayoWuKWNyFqZkJ%3DvTh94sn15HtCA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django's search

2016-03-28 Thread Mario Gudelj
http://stackoverflow.com/questions/3538999/django-admin-search-how-to-override-the-default-handler

On Monday, 28 March 2016,  wrote:

> I need know how change the search that come with Django's Admins.
>
> --
> 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/82788600-1519-4347-8634-6420b166ca93%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/CAHqTbjmig0LsoyCj7kH4%3D1TsY5Gwiu3d4FgfewfTaKb9r9nG8A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Alternative Amazon S3?

2016-02-25 Thread Mario Gudelj
Give cloudinary a go. It's really good especially for images and pdf

On Friday, 26 February 2016, Andrew Pinkham  wrote:

> Heroku should be treated as the stateless portion of an app - do not store
> long term data there! (Same goes with services like EC2 and Digital Ocean.)
>
> Rackspace and Microsoft have cloud alternatives to Amazon that may suit
> your purposes.
>
> Hosting on a shared host like Dreamhost or A Small Orange are
> possibilities, but I wouldn't advise it; if you do decide on that route, I
> recommend looking into CDN services for distribution at that point.
>
> Why does S3 not suit your purposes? Without knowing your goals, it's a
> little hard to advise.
>
> Andrew
>
> --
> 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/56E84256-64D6-481E-A917-98433340B30E%40andrewsforge.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/CAHqTbj%3D6PFaO%3D_BFDsYru-6JXtiW9E87ruHKZv309LA%2BN1eQgg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: django css: general query on CDNs and crispy forms

2016-02-23 Thread Mario Gudelj
You're missing a comma after my app inside installed_apps.

You can load bootstrap from cdn inside head, before your custom style
sheet. Not a problem there.

Pip install crispy forms. They'll end up in your site-packages folder. No
need to download it and put it inside your project.

Run collectstatic command to collect any css or js files that package has
and put them inside your static folder




On Wednesday, 24 February 2016,  wrote:

> I have set up a page and have implemented bootstrap using the CDN code
> that is recommended to access the online bootstrap server:
>
> for the CSS:
>
>  href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css; 
> integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7"
>  crossorigin="anonymous"> href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css;
>  
> integrity="sha384-fLW2N01lMqjakBkx3l/M9EahuwpSfeNvV63J5ezn3uZzapT0u7EYsXMjQV+0En5r"
>  crossorigin="anonymous">
>
> Javascript:
>
>  src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"; 
> integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS"
>  crossorigin="anonymous">
>
> However eventually my site will have to go live and I'm not certain that
> this code will suffice when that happens and I feel I should download the
> actual bootstrap code.
>
> Furthermore if I download the bootstrap code properly and put it in a
> hypothetical media folder called "css2" such that it won't interfere with
> my own custom css files, where do I then put crispy_forms.
>
> As of now I am holding them in the downloaded crispy forms files within
> "media"- on the same level as "myproject" but the "{ load crispy_forms}"
> tag doesn't look in the media folder because the "CRISPY_TEMPLATE_PACK =
> 'bootstrap3'" does not specify a path to look for the crispy forms
> content... the crispy forms website tells to look up the django
> documentation for how to organise my media folder but searching the website
> under "cripy forms" returns nothing.
>
> Finally, I have added crispy forms to my installed apps:
>
> INSTALLED_APPS = 
> ('django.contrib.admin','django.contrib.auth','django.contrib.contenttypes','django.contrib.sessions','django.contrib.messages','django.contrib.staticfiles','myproject.myapp''crispy_forms',
>###Registered
>  )
>
> However when i migrate and run the server I get an error:
>
>  ImportError: No module named myappcrispy_forms
>
> so I rearranged the order of the modules and then got this error:
>
>  ImportError: No module named crispy_forms
>
>
>1. Should i download bootstrap properly or do the CDNs suffice?
>2. Where do I store the bootstrap code and how will it affect my own
>CSS code?
>3. How do register the module crispy_forms? and where do I store the
>crispy forms folder there is little documentation on 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/7605da4a-e6e9-446a-9016-cce4e6e9071e%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/CAHqTbjm3r%3DjSYqdD2vqBEooZTd86ZvkzejCrTkF%3Dm_fdF-XftQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Trouble with Django Tutorial Part 2

2015-12-09 Thread Mario Gudelj
Did you mix up https://docs.djangoproject.com/en/1.8/intro/tutorial01/ and
https://docs.djangoproject.com/en/1.9/intro/tutorial01/? 1.9 has apps.py
inside polls directory and 1.8 tutorial doesn't. So, I think you have
INSTALLED_APPS setting from 1.9 tutorial inside 1.8.7 project...

On Thu, 10 Dec 2015 at 15:04 Ana Ng  wrote:

> I'm new to programming in general and am learning Django 1.8.7 for a new
> job. The polls tutorial on the official site was recommended, and
> everything goes smoothly until I attempt to migrate the new classes created
> in part 1.
>
> When asked to migrate the classes with *python manage.py makemigrations
> polls*, I get "ImportError: No module named polls.apps".
>
> I am fairly certain that I am following the tutorial properly, has anyone
> else had this issue?
>
> --
> 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/6670d9c2-76ec-4163-b180-fa977a985834%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHqTbjmdTbq-ofq41dQi8AnpVuWJkAnZHM2Jx-cAeTE7xCo0Tw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django deployment

2015-09-18 Thread Mario Gudelj
Try this guide
http://michal.karzynski.pl/blog/2013/06/09/django-nginx-gunicorn-virtualenv-supervisor/
On 18 Sep 2015 6:55 am, "Hugo Kitano"  wrote:

> What is the nginx config? And where do I find it?
>
> On Tuesday, September 15, 2015 at 12:46:40 PM UTC-7, Shawn Milochik wrote:
>>
>> It's very simple. Just follow these instructions:
>>
>> http://milocast.com/flasknginx.html
>>
>> Instead of the final line (gunicorn filename:appname -b 127.0.0.1:),
>> use this:
>>
>> ./manage.py run_gunicorn -b 127.0.0.1:
>>
>> --
> 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/6060640a-2e4f-4806-b9ed-872008c58053%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHqTbjkyMTgZXNxQi_bkisNEXUiQ1B7caTGpyJPi%3DuSDKs1Wyw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: What frontend-tools to use for a new CRM project? Shall I use Django OR switch to Meteor.js?

2015-09-10 Thread Mario Gudelj
+1 angular. Stack overflow is your friend and there's a lot of angular on
it. You can do a lot with it with basic knowledge as well. And template
syntax will make sense going to it from django
On 10 Sep 2015 3:53 pm, "Gergely Polonkai"  wrote:

> Hello,
>
> this is a bit off topic here, and highly opinion based, but here are my
> two cents: I got along very well with both Bootstrap and Angular, but never
> tried React before. However, a quick Google search shows that React is
> barely supported yet (in terms of available Django apps).
>
> Best,
> Gergely
> On 10 Sep 2015 00:29, "ThomasTheDjangoFan" <
> stefan.eichholz.ber...@googlemail.com> wrote:
>
>> Yeah, I definetly hate to write Javascript and I really do NOT want to
>> write server code in it.
>>
>>
>> *The parts where I really need a javascript framework in my app are
>> complex forms:A page might consist of multiple forms bundled with formsets,
>> inline-forms and so on.*
>>
>>
>> *The question is:*Which js-framework has the best form support for
>> django? It would be cool if I would just have to write server-side
>> model-variation and the client would adopt it.
>> Which js-framework has the best tutorial to get myself started?
>>
>> *I checked out *
>> *www.djangopackages.com  - it seems like I
>> have the following options:*Angular.js: made by Google (6 django-pakets
>> on www.djangopackages.com)
>> JQuery.js: (4 django-pakets on www.djangopackages.com)
>> Ember.js: (3 django-pakets on www.djangopackages.com)
>> React.js: made by facebook (0 django-pakets on www.djangopackages.com)
>> riot.js: (0 django-pakets on www.djangopackages.com)
>>
>> Any suggestions?
>>
>> Kind regards
>> Thomas
>>
>> --
>> 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 http://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/13e79d83-a4e5-4e6f-a372-47320791d9cd%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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CACczBUKWf6knewigf6ax6bheKje2jXUNs5uJ3%3DZ0KgiL2UxAXg%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHqTbj%3Doas7sNhwK6YbV%3DHGL-j0ELkAwO94eCrUd00Esg_5BhQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Try Django 1.8 Tutorial 37 on Youtube - Bootstrap Design Falls Apart In Production

2015-07-19 Thread Mario Gudelj
Your static assets aren't loading. Normally in production you'd setup nginx
or apache to do this job. Have you done that?
On 17 Jul 2015 7:24 am, "Chris Nowak"  wrote:

> I'm following this Youtube tutorial as I'm learning Django, and around the
> 11 minute mark, after the author sets DEBUG = False and ALLOWED_HOSTS =
> ['*'], when he runs the server again, the web app shows up perfectly with
> its nice design for him. However, when I ran the server again on my end,
> the website design fell apart and lost its bootstrap-like design. The
> images are not showing up either. I have a suspicion that this has
> something to do with the 'static_in_pro' and 'static_in_env' folders and
> maybe if they're applied differently for production vs. development, but
> I'm not sure at all, just a beginner. I have attached screen shots of how
> the website design is falling apart for me when I switch production.
>
> Any help or advice on how to fix this is greatly appreciated. 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/4ad40956-58bf-4bc5-ab51-938e8582dbfb%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHqTbj%3Ddo54iJNU789uQhSR_GQf18SMqFPNU6CovCUWGOdLHhQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: DateField(blank=True), null?

2015-06-25 Thread Mario Gudelj
Did you migrate? You don't have to manually edit your schema. Use
migrations or south if you're using 1.6 or below.
On 26 Jun 2015 8:41 am, "Sidh Tanna"  wrote:

> Its not work dear, ou have any other solution?
>
> On Monday, August 14, 2006 at 12:09:53 PM UTC+5:30, Bryan Chow wrote:
>>
>> Hi Ray,
>>
>> You can set null=True on your DateField to allow null values in the
>> database. Foe example:
>>
>> thedate = models.DateField(null=True, blank=True)
>>
>> Cheers,
>> Bryan
>>
>>
>> On 8/13/06, Rares Vernica  wrote:
>> > Hi,
>> >
>> > I have a DateField with blank=True and after I complete and submit the
>> > form I get a Django error saying that DateField cannot be null?
>> >
>> > How can I set the DateField so that it can be empty, and eventually null
>> > in the DB?
>> >
>> > I don't like the idea of manually going and changing the DB schema.
>> >
>> > Thanks,
>> > Ray
>>
>>  --
> 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/639bee6b-be77-403d-ad12-5bb9bb00f259%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHqTbjk1g2Sn397Vgj%3DiPUoEFwZyP6irD%3DH3Mk86J6ntAJ7-%2Bg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django plugin

2015-06-15 Thread Mario Gudelj
You can use celery and periodic tasks to scan for new orders every 5
minutes and send email notification of the new order is there.
On 12 Jun 2015 6:59 pm, "'Tom Evans' via Django users" <
django-users@googlegroups.com> wrote:

> On Thu, Jun 11, 2015 at 8:02 PM, Andreas Kuhne
>  wrote:
> > Hi all,
> >
> > I was wondering if there is a plugin application for Django. What I want
> to
> > accomplish is react to different kinds of events on my models and then
> > create plugins on the fly for them.
> >
> > The system I am working on has for example an Order model. When a new
> Order
> > is created, I want to send a notification to the person who created the
> > order. I know that I can do this with signals, but I don't want it to
> > specifically be tied to a Django application.
> >
> > I was thinking something along the lines of using RabbitMQ for example to
> > post all events there and then be able to react on them later. Has anyone
> > done anything like this?
> >
> > I have seen Celery, but as I understand that, it takes some method to run
> > like a delayed job?
> >
> > Regards,
> >
> > Andréas
> >
>
> Celery is (usually) built on top of an AMQP broker. AMQP was developed
> to support High Frequency Trading (HFT) and is ideal for publishing
> events and taking actions based upon them. I'd suggest reading this
> blog post:
>
> http://blogs.digitar.com/jjww/2009/01/rabbits-and-warrens/
>
> and then the docs for Kombu, which is an excellent messaging library for
> python.
>
> http://kombu.readthedocs.org/en/latest/
>
> AMQP is not the only message bus, but we've had great results with it
> (using rabbitmq).
>
> Cheers
>
> Tom
>
> --
> 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAFHbX1JEb08O0PMdzEBC0%3Dq8LRVZcHz11PPg067aSby7YhaLjQ%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHqTbjnJL1SzdPYjZmTL2-TVyJTW9Lv_9vo%3DfgjUyHT876M_3w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


RE: new to Django having models/views/templates question

2015-06-03 Thread Mario Gudelj
By creating a foreign key to it.
On 3 Jun 2015 8:07 pm, "Chris Strasser"  wrote:

> Hi James, Thanks again for responding.
>
> I didn’t post my actual models as they are quite large and my problem is
> more about understanding proper technique than anything.  Self.name did fix
> my immediate problem thanks, however I am really curious about your last
> paragraph … how can I tie the customer directly to the service order ? .. I
> have no idea how I might do it in Django.
>
>
>
> C.
>
>
>
> *From:* django-users@googlegroups.com [mailto:
> django-users@googlegroups.com] *On Behalf Of *James Schneider
> *Sent:* Tuesday, June 02, 2015 6:01 PM
> *To:* django-users@googlegroups.com
> *Subject:* Re: new to Django having models/views/templates question
>
>
>
> Posting the actual model code will probably help.
>
> Your template has this:
>
> item.customer_location.name
>
> But you specified the issue later as this:
>
> item.customer_location.customer
>
> The former won't work per your summarized model definitions. The Location
> model has no attribute called 'name'.
>
> The latter will work only if your __str__() function is encoding the data
> correctly. The reason you are getting a recursion error is because of the
> 'unicode(self)' (which I'm assuming is part of your model's __str__()
> definition). You need to change that to something like unicode(self.name).
> I'm not even sure if the unicode() call is even necessary (haven't done a
> ton of Python 3 yet).
>
> As far as referring to the Customer name, you can do {{
> item.customer_location.customer.name }}
>
> Have you thought about tying in the customer directly to the service
> order? It shouldn't be an issue to have a customer tied to both the
> location and the service order. While it'll work the way you have it, your
> lookups will become more complicated (and expensive from a processing
> perspective) since you are forcing a lookup across multiple tables. It may
> not agree with your business process, though. Just a thought.
>
> -James
>
>
>
> On Jun 2, 2015 11:57 AM, "Chris Strasser"  wrote:
>
> Hi James thanks for the response...
>
>
> this line: {{item.customer_location.customer}}
>
> . worked this morning and all last week  now gives this error:
> RuntimeError at /sto/
>
> maximum recursion depth exceeded while calling a Python object
>
> *Request Method:*
>
> GET
>
> *Request URL:*
>
> http://10.0.0.102:8080/sto/
>
> *Django Version:*
>
> 1.8
>
> *Exception Type:*
>
> RuntimeError
>
>
>
>
>
> *Exception Value*
>
> maximum recursion depth exceeded while calling a Python object
>
>
>
> I can reproduce the encoding error but i forget how to get there at the 
> moment ...
>
>
>
>
>
> On Tuesday, June 2, 2015 at 2:00:22 PM UTC-4, Chris Strasser wrote:
>
> Hi am plugging away at learning Django and have done well so far (thanks
> to great documentation and Stackoverflow) but I have run into a problem
> that i cant seem to figure out.
>
>
> I have a model that refers to another model that refers to another model.
>
> example :
>
> Class ServiceOrder
> id -integer
>customer location = foreign key to location
>
> def __str__(self):
> return self.stid
>
> class Location:
>id -integer
>address -char
>customer- foreign key to customer
>
> q= '%s %s %s %s ' %(self.addr1, self.addr2, self.city,
> self.country)
> return unicode(q).encode('utf-8')
>
> Class Customer
> id=int
> name- char
> return unicode(self).encode('utf-8')
>
> I have a template that lists the service orders view is below:
>
>
> def serviceorder_list(request, status = 'Closed'):
> ist = ServiceOrder.objects.filter(status = status,
> stid__lte=20239).select_related('customer_location__customer')
> #stid__lte 20239 to fix database error ... i have existing data that has
> its own issues...
> count = order_list.count()
> context ={'list': sto_list, 'count': count}
>
> return render(request, 'order/listview.html', context)
>
>
> in my listview.html
>
> {% for item  in list %}
> {% if item.project %}
> {{item.stid}}
> {{item.project}}
> {{item.customer_location.name}}
> -- 2 questions here  1) it throws an error on customer
> names that have accents etc ...
>
> {{item.notes}}
> 2) i am confused about how to properly referenece the
> customer name or anything else that is not in the Service order  model.
>
> {{item.person_responsible}}
> {{item.entrydate|date:'M-d-y'}}
>   {{item.status}}
>   {{item.billing}}
>   
>
>
> I have read the docs many times and the more i read the more i know that i
> don't know ... any help would be appreciated
>
>
> 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
> 

Re: django-allauth without username, login with facebook doesn't work

2015-05-13 Thread Mario Gudelj
Sorry man. My mistake.

So are you saying that you have a link with onclick or something? Do you
get the JS error? Is it logged inside your browser's console? It's a bit
hard to tell without more code or the URL...

On 14 May 2015 at 03:12, Fellipe Henrique <felli...@gmail.com> wrote:

> Hi Mario,
>
> I`m not using python-social-auth... I choose to use all-auth[1] because
> it's given to me more the social login, like: password reset, email
> validation etc.
>
> My problem is: in template when I click on a button, nothing happen.. the
> link (javascript) is correct, but nothing happen...
>
>
> [1] - http://www.intenct.nl/projects/django-allauth/
>
> T.·.F.·.A.·. S+F
> *Fellipe Henrique P. Soares*
>
> e-mail: > echo "lkrrovknFmsgor4ius" | perl -pe \
> 's/(.)/chr(ord($1)-2*3)/ge'
> *Blog: http://fhbash.wordpress.com/ <http://fhbash.wordpress.com/>*
> *GitHub: https://github.com/fellipeh <https://github.com/fellipeh>*
> *Twitter: @fh_bash*
>
> On Wed, May 13, 2015 at 12:26 AM, Mario Gudelj <mario.gud...@gmail.com>
> wrote:
>
>> What do you mean by nothing happens? Do you get taken to FB?
>>
>> Here's what I have in my setup which may help:
>>
>> The template link looks like this:
>>
>> Facebook
>>
>> Make sure you have the following line in your urls.py:
>>
>> url('', include('social.apps.django_app.urls', namespace='social'))
>>
>> settings.py:
>>
>> SOCIAL_AUTH_USER_FIELDS = ['email']
>> SOCIAL_AUTH_USERNAME_IS_FULL_EMAIL = True
>> SOCIAL_AUTH_FACEBOOK_KEY = 'your_key'
>> SOCIAL_AUTH_FACEBOOK_SECRET = 'your_secret'
>> SOCIAL_AUTH_FACEBOOK_SCOPE = ['email']
>> SOCIAL_AUTH_ENABLED_BACKENDS=('facebook', 'google')
>> SOCIAL_AUTH_PROTECTED_FIELDS = ['email']
>> SOCIAL_AUTH_ADMIN_USER_SEARCH_FIELDS = ['first_name', 'last_name',
>> 'email']
>>
>> AUTHENTICATION_BACKENDS = (
>> 'social.backends.facebook.FacebookOAuth2',
>> 'social.backends.google.GoogleOAuth2',
>> 'social.backends.twitter.TwitterOAuth',
>> 'django.contrib.auth.backends.ModelBackend',
>> )
>>
>> Add 'social.apps.django_app.default', to INSTALLED_APPS
>>
>> Use https://github.com/omab/python-social-auth and follow installation
>> instructions from it. You'll need to setup your FB app as well.
>>
>> I think that's all you need.
>>
>> Good luck man.
>>
>>
>>
>> On 13 May 2015 at 04:13, Fellipe Henrique <felli...@gmail.com> wrote:
>>
>>> Just  to complement the previous mail,  normal user (django user) like
>>> super-user create using syncdb, works fine!
>>>
>>> I'm using django 1.8.
>>>
>>> T.·.F.·.A.·. S+F
>>> *Fellipe Henrique P. Soares*
>>>
>>> e-mail: > echo "lkrrovknFmsgor4ius" | perl -pe \
>>> 's/(.)/chr(ord($1)-2*3)/ge'
>>> *Blog: http://fhbash.wordpress.com/ <http://fhbash.wordpress.com/>*
>>> *GitHub: https://github.com/fellipeh <https://github.com/fellipeh>*
>>> *Twitter: @fh_bash*
>>>
>>> On Tue, May 12, 2015 at 3:09 PM, Fellipe Henrique <felli...@gmail.com>
>>> wrote:
>>>
>>>> Hello,
>>>>
>>>> I'm trying to use Django-AllAuth social login...
>>>>
>>>> I have a custom user profile and custom usermanage [1]
>>>>
>>>> But, when I click on html template facebook link, anything happen!
>>>>  with username, works fine.
>>>>
>>>> Here is my settings [2]
>>>>
>>>> My settings is wrong? any idea why this problem happens?
>>>>
>>>> Thanks,
>>>> regards
>>>>
>>>>
>>>> [1] - https://gist.github.com/fellipeh/fe2deae4854072b0cb3d
>>>> [2] - https://gist.github.com/fellipeh/033fcde17c9771dfb1b2
>>>>
>>>> T.·.F.·.A.·. S+F
>>>> *Fellipe Henrique P. Soares*
>>>>
>>>> e-mail: > echo "lkrrovknFmsgor4ius" | perl -pe \
>>>> 's/(.)/chr(ord($1)-2*3)/ge'
>>>> *Blog: http://fhbash.wordpress.com/ <http://fhbash.wordpress.com/>*
>>>> *GitHub: https://github.com/fellipeh <https://github.com/fellipeh>*
>>>> *Twitter: @fh_bash*
>>>>
>>>
>>>  --
>>> 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+unsubs

Re: Django model inheritance: create sub-instance of existing instance (downcast)?

2015-05-12 Thread Mario Gudelj
Have you had a look at
http://django-model-utils.readthedocs.org/en/latest/managers.html#inheritancemanager?
I'm not sure if it will help but it's kind of related to what you've posted.

On 12 May 2015 at 23:10, guettli  wrote:

> Hi,
>
> this ticket is seven years old
>
> https://code.djangoproject.com/ticket/7623
>
> {{{
>
> As it exists now, multi-table inheritance does not allow for the creation
> of a child model instance that inherits from an existing parent model
> instance. For example:
>
> Parent Class-
>
> class Place(models.Model):
> name = models.CharField(max_length=50)
> address = models.TextField(max_length=150)
>
> Child Classes-
>
> class Restaurant(Place):
> place = models.OneToOneField(Place, parent_link=True)
> cuisine = models.CharField(max_length=75)
> rating = models.IntegerField()
>
> class Bar(Place):
> parent = models.OneToOneField(Place, parent_link=True)
> happy_hour = models.BooleanField()
> beers_on_tap = models.ManyToManyField("Beers", null=True, blank=True)
>
> Sample Use-case-
>
> When the system is first deployed, a restaurant instance is created.
> Later, the restaurant adds a bar to increase revenue, and we now want to
> create a Bar model instance for the parent Place for the restaurant. I
> would propose the following interface for doing so:
>
> parentPlace = Restaurant.objects.get(name__iexact="Bob's Place").parent
> barInstance = Bar(parent=parentPlace, happy_hour=True)
>
> However, if you attempt to create an instance in this manner now, you
> receive a DatabaseIntegrityError, saying that a Place object with that id
> already exists.
>
> }}}
>
> How to get this solved?
>
> There are work arounds:
>
>
> http://stackoverflow.com/questions/4064808/django-model-inheritance-create-sub-instance-of-existing-instance-downcast
>
> {{{
> extended_user = ExtendedUser(user_ptr_id=auth_user.pk)
> extended_user.__dict__.update(auth_user.__dict__)
> extended_user.save()
> }}}
>
> Or is there a better solution in current django versions?
>
>
>
>
>
>
>
>
> --
> 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/d4273754-670e-4697-b0b4-9626c42a5aaf%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHqTbjnRG5iYVHhabR_6YytCRgRpxyYayj-aOSuFFrom5wi%3Duw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: django-allauth without username, login with facebook doesn't work

2015-05-12 Thread Mario Gudelj
What do you mean by nothing happens? Do you get taken to FB?

Here's what I have in my setup which may help:

The template link looks like this:

Facebook

Make sure you have the following line in your urls.py:

url('', include('social.apps.django_app.urls', namespace='social'))

settings.py:

SOCIAL_AUTH_USER_FIELDS = ['email']
SOCIAL_AUTH_USERNAME_IS_FULL_EMAIL = True
SOCIAL_AUTH_FACEBOOK_KEY = 'your_key'
SOCIAL_AUTH_FACEBOOK_SECRET = 'your_secret'
SOCIAL_AUTH_FACEBOOK_SCOPE = ['email']
SOCIAL_AUTH_ENABLED_BACKENDS=('facebook', 'google')
SOCIAL_AUTH_PROTECTED_FIELDS = ['email']
SOCIAL_AUTH_ADMIN_USER_SEARCH_FIELDS = ['first_name', 'last_name', 'email']

AUTHENTICATION_BACKENDS = (
'social.backends.facebook.FacebookOAuth2',
'social.backends.google.GoogleOAuth2',
'social.backends.twitter.TwitterOAuth',
'django.contrib.auth.backends.ModelBackend',
)

Add 'social.apps.django_app.default', to INSTALLED_APPS

Use https://github.com/omab/python-social-auth and follow installation
instructions from it. You'll need to setup your FB app as well.

I think that's all you need.

Good luck man.



On 13 May 2015 at 04:13, Fellipe Henrique  wrote:

> Just  to complement the previous mail,  normal user (django user) like
> super-user create using syncdb, works fine!
>
> I'm using django 1.8.
>
> T.·.F.·.A.·. S+F
> *Fellipe Henrique P. Soares*
>
> e-mail: > echo "lkrrovknFmsgor4ius" | perl -pe \
> 's/(.)/chr(ord($1)-2*3)/ge'
> *Blog: http://fhbash.wordpress.com/ *
> *GitHub: https://github.com/fellipeh *
> *Twitter: @fh_bash*
>
> On Tue, May 12, 2015 at 3:09 PM, Fellipe Henrique 
> wrote:
>
>> Hello,
>>
>> I'm trying to use Django-AllAuth social login...
>>
>> I have a custom user profile and custom usermanage [1]
>>
>> But, when I click on html template facebook link, anything happen!  with
>> username, works fine.
>>
>> Here is my settings [2]
>>
>> My settings is wrong? any idea why this problem happens?
>>
>> Thanks,
>> regards
>>
>>
>> [1] - https://gist.github.com/fellipeh/fe2deae4854072b0cb3d
>> [2] - https://gist.github.com/fellipeh/033fcde17c9771dfb1b2
>>
>> T.·.F.·.A.·. S+F
>> *Fellipe Henrique P. Soares*
>>
>> e-mail: > echo "lkrrovknFmsgor4ius" | perl -pe \
>> 's/(.)/chr(ord($1)-2*3)/ge'
>> *Blog: http://fhbash.wordpress.com/ *
>> *GitHub: https://github.com/fellipeh *
>> *Twitter: @fh_bash*
>>
>
>  --
> 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAF1jwZHCBfJsu8dCHk%3DeoPuTCPC9Jskxk16fbGR_W7DNyC8QRQ%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHqTbjn%2B1F-fRqx4qhD-X5%3Dm%3D-KWcumJkr2JNgU5pi7negDt8A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to go about building complicated web apps with django?

2015-05-12 Thread Mario Gudelj
"Should I start building a basic web app and then iteratively" <<< This.

Then buy this book https://highperformancedjango.com/ after you've done
things like these
http://www.revsys.com/blog/2015/may/06/django-performance-simple-things/

On 13 May 2015 at 11:04, akshat  wrote:

> I am new to django. I have till now built tutorial apps and read almost
> 25% of the source code of django. Right now I guess I have decent know-how
> of django but since I have not built large-scale app on django hence the
> question.
> I am building a web app which I know will involve various complexities
> when I will scale it. But right now user base will be pretty low on the web
> app. So should I take care of topics such as -
> 1) Scaling Python/Django Application with Apache and mod_wsgi
> 2) Scaling database with Django and HAProxy
> 3) Scheduling asynchronous tasks with Celery.
>
> from the very starting or Should I start building a basic web app and then
> iteratively add various modules to the app?
> I mean what is the right way to build a Django app which I know will have
> to be scaled in the future?
>
>  --
> 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/0474ff5f-0a7a-4475-bb38-1faeb2d12001%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHqTbjnw0DM26Ju6CXxQdxaPcUwWLCcdWLWRAH_%2BW%3D5ZndLVpQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: What is the ideal web server to use with Django?

2015-05-12 Thread Mario Gudelj
The most common setups I came across are Nginx + Gunicorn and Nginx +
uWSGI. Nginx + Gunicorn is really easy to setup and it will probably be
sufficient. You just need to have enough Gunicorn workers running for your
amount of traffic. I really like this setup
http://michal.karzynski.pl/blog/2013/06/09/django-nginx-gunicorn-virtualenv-supervisor/
.

On 13 May 2015 at 11:12, akshat  wrote:

> I am new to Django. I am building a app which will have to handle several
> concurrent requests. Which web server is suitable for this? I have read
> that Apache's performance degrades on high load.
>
> --
> 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/4b0d96b1-76b8-4068-92e2-cbdbdc55e609%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHqTbjm%2BcjgHqHpACTnR3mUgYHg6g8Twc6weE%3DQ9FoDntKaHKw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Use 3rd party django package in my own project (PYTHONPATH)

2015-05-11 Thread Mario Gudelj
Have you looked at
https://django-model-report.readthedocs.org/en/latest/installation.html ?

After you add it to "INSTALLED_APPS" (I guess that's what you meant by
adding it to 'Installed_Packages') you need to create reports.py etc. The
instructions on RTD are pretty good...

On 12 May 2015 at 05:21, Kasra Khosravi  wrote:

> i am creating a susbcription management system and I want to use a third
> party django package for reporting :
>
> https://github.com/juanpex/django-model-report
>
> Since I am new to django, I'm not sure how to use it, First I install it
> using pip (I have also tried installing it using setup.py), after that I
> think I have to add this package to my PYTHONPATH but I have no idea how to
> do it.
>
> After doing this, when I put that package under "Installed_Packages" in
> django settings.py, Nothing happends.
>
> i was wondering if anybody can 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/ac50f0ad-ea9a-4e61-90ad-6d8ef281f329%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHqTbjk4A-wmeYrhRPUqQBvvkAM5ybnLMnnshv%2B6RamTBVZXqQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Fields outside Aggregation functions

2015-05-04 Thread Mario Gudelj
Can you perhaps order by price and get first and last items?
On 4 May 2015 8:48 pm, "Alex-droid AD"  wrote:

>
>
> There is example in Django documentation about using Aggregate and
> Annotate clauses
>
> The same rules apply to the aggregate() clause. If you wanted to know the
> lowest and highest price of any book that is available for sale in a store,
> you could use the aggregate:
>
> Store.objects.annotate(min_price=Min('books__price'), 
> max_price=Max('books__price'))
>
> Store.objects.aggregate(min_price=Min('books__price'), 
> max_price=Max('books__price'))
>
>
> By this string of code I'll get min/max price each of book in each store
> But I won't see name or id of book, which was selected during use of
> aggregation (max or min)
> So the question... How can I get records
>
> storemin/max price*book ???*
>
>
>
>
>
>  --
> 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/814ef5a3-6e2b-4054-9a1c-6ca127c2d527%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHqTbjm0jTf26vezq485U4YDQAJq0udfPjg2EoL%3D7NAQeTd7sg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: importing csv data into database

2015-04-26 Thread Mario Gudelj
Remove comma from each line inside the for loop.
On 27/04/2015 10:44 am, "sum abiut"  wrote:

> Hi Andrew,
> Thanks heaps. do you mine explaining how to fix that.
>
> cheers,
>
> On Mon, Apr 27, 2015 at 4:26 AM, Andrew Farrell 
> wrote:
>
>> What I'm saying that you are defining data.LastName as a tuple and when
>> it gets turned into a string. So if a row is
>>
>> 44, Barack, Obama, 1600 Pennsylvania Avenue
>>
>> Then data.FirstName is going to be
>>
>> ('Barack',)
>>
>> Which is a single-element tuple. When it gets turned into a string, it
>> becomes ('Barack',)
>>
>> On Sun, Apr 26, 2015 at 4:25 AM, sum abiut  wrote:
>>
>>> i am importing data from csv file to the model test, so i am taking data
>>> as an instance of test(). are you saying  i should define data as a
>>> string?? and have the parameters as personid, firstname,lastname,address.
>>> Please advise
>>>
>>>
>>> Cheers
>>>
>>> On Sun, Apr 26, 2015 at 2:36 AM, Andrew Farrell 
>>> wrote:
>>>
 Ah, I suppose that bit didn't get sent. Google groups only lets mail
 from my old gmail address through and bounces mail from the MIT address I
 use by default.

 I noticed something else about your code: you are assigning 2-tuples to
 all of your data types rather than strings when you do
data.PersonID=row[0],
data.FirstName=row[1],
data.LastName=row[2],
data.Address=row[3],

 You might actually be aware of this, but I once spent 4 hours debugging
 before I realized this on a previous project.
 weapons = ('fear', 'surprise', 'fanatical devotion to the pope',) n

 clearly creates a 3-item tuple. But so does
 weapons = 'fear', 'surprise', 'fanatical devotion to the pope',
 and in fact
 weapons = 'fear',
 creates a 1-item tuple.


 On Sat, Apr 25, 2015 at 7:27 AM, sum abiut  wrote:

> Ok , i manage to figure out where the error was coming from in my
> view.py on line  readata=csv.reader(csvfile,delimiter=';', quotechar='|').
> The* delimiter =';'* i change the semicolon to  a comma The*
> delimiter =','* and it works.
>
> However when the data are imported from the csv file to the model it
> also write some funny character to the model as shown on the image below.
> How to import data to model without writing this funny characters?  i want
> the data to be clean
>
>
> [image: Inline image 1]
>
>
>
> view.py
> def readcsvfile(request):
> with open('/var/www/html/webapp/csvupload/data.csv','rb') as
> csvfile:
> readata=csv.reader(csvfile,delimiter=';', quotechar='|')
> #readata=csv.reader(csvfile)
> for row in readata:
> data=test()
> data.PersonID=row[0],
> data.FirstName=row[1],
> data.LastName=row[2],
> data.Address=row[3],
> data.save()
> return render_to_response('csv_test.html',locals())
>
>
>
>
> On Fri, Apr 24, 2015 at 4:36 PM, Andrew Farrell <
> armorsmit...@gmail.com> wrote:
>
>> You might have to make sure that my indentation there is correct.
>>
>> Also, I noticed something else about your code: you are assigning
>> 2-tuples to all of your data types rather than strings when you do
>>data.PersonID=row[0],
>>data.FirstName=row[1],
>>data.LastName=row[2],
>>data.Address=row[3],
>>
>> You might actually be aware of this, but I once spent 4 hours
>> debugging before I realized this on a previous project.
>> weapons = ('fear', 'surprise', 'fanatical devotion to the pope',)
>> clearly creates a 3-item tuple. But so does
>> weapons = 'fear', 'surprise', 'fanatical devotion to the pope',
>> and in fact
>> weapons = 'fear',
>> creates a 1-item tuple.
>>
>> On Fri, Apr 24, 2015 at 12:33 AM, Andrew Farrell <
>> armorsmit...@gmail.com> wrote:
>>
>>> could you replace your function with
>>> def readcsvfile(request):
>>> with open('/var/www/html/webapp/csvupload/data.csv','rb') as
>>> csvfile:
>>> readata=csv.reader(csvfile,delimiter=';', quotechar='|')
>>> #readata=csv.reader(csvfile)
>>> for i, row in enumerate(readata):
>>> try:
>>> data=test()
>>> data.PersonID=row[0],
>>> data.FirstName=row[1],
>>> data.LastName=row[2],
>>> data.Address=row[3],
>>> data.save()
>>> except Exception, e:
>>> import pdb;pdb.set_trace()
>>> print i
>>> print row
>>> print row[1]
>>> raise e
>>> return 

Re: Best practice for passing JSON objects to a template

2015-04-22 Thread Mario Gudelj
I often use method 2. I don't see a problem with it.

On 10 April 2015 at 02:08, Eric Plumb  wrote:

> Hi Djangoers!
>
> Sometimes in the course of human events it becomes necessary to encode a
> JSON object directly into a template.  We all prefer AJAX and REST APIs and
> the rest of the TOFLAs, but in the cases where it has to be part of the
> template, I'm wondering if there's an accepted canonical best-practice way
> to do so and remain safe from XSS attacks and other nastiness.
>
> I'm aware of the following two methods:
>
> 1. HTML attribute loaded by jQuery's $.data()
>
> # view
> return { ... {'my_obj': mark_safe(escape(json.dumps(obj))) } ... }
>
> # template
> ...
>
> # JS
> var myObj = $('div').data('my-object');  // implicitly calls JSON.parse()
> on the encoded object
>
> 2. Explicitly parsed JS object
>
> # view
> return { ... {'my_obj': mark_safe(escapejs(json.dumps(obj))) } ... }
>
> # template
> 
>   var myObj = JSON.parse('{{ my_obj }}')
> 
>
> Are there better methods?  It seems like this ought to come up often in
> building safe websites, but I don't see a consensus out there on the Web.
> Thanks in advance for your consideration!
>
> Eric
>
> --
> 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/9de1-d8c9-41a3-b86e-64e675c1eddf%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHqTbjnNzHF%3DDDFW4pLBApzdtnvwJLR8uConTUjmrSLVDSENbA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Host a web application

2015-04-22 Thread Mario Gudelj
Sign up for AWS, fire up a free micro instance and host on that. You can
have it up there in no time with something like
https://github.com/gcollazo/Fabulous

On 23 April 2015 at 00:52, Mario R. Osorio  wrote:

>
>
> www.pythonanywhere.com made it easier for me to deploy than heroku
>
> On Wednesday, April 22, 2015 at 2:25:56 AM UTC-4, Kishan Mehta wrote:
>>
>> Hi ,
>>
>> I have to show my web application project work to a potential employer.
>> Is it possible to host the demo somewhere? Any guide on this?
>>
>> Thanks for help,
>> Kishankumar Mehta
>>
>  --
> 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/109e5f89-bc99-48a4-a0cd-02ab86f79545%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHqTbjkui6fk1B01LDviPMKCBMz0FTgKN3UmXywmnAH1ZqScfQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Import error - No module named http

2015-03-18 Thread Mario Gudelj
And you should probably use suds for soap based apis.
On 19/03/2015 4:24 am, "Andrew Farrell"  wrote:

> Actually, please listen to Guilherme over me; He seems to have correctly
> spotted the omission.
>
> On Wed, Mar 18, 2015 at 11:45 AM, Andrew Farrell 
> wrote:
>
>> So it seems like the problem is that you are doing `import http` on line
>> 24 of /home/akhil/Documents/NIVIN/NIVIN/svn/CrossFraudet/
>> branches/V2.1.0/crossfraudet/cdrimport/views/fraud_summary_view.py rather
>> than `import httplib`. Python2 doesn't have a module in the standard
>> library named `http`, only `httplib`.
>>
>>
>> As an aside, if you are connecting to a SOAP service, you might consider
>> using requests.py or SUDS
>> .
>>
>>
>> On Wed, Mar 18, 2015 at 11:35 AM, Nivin Paul 
>> wrote:
>>
>>> ImportError at /cdrimport/settings/fraudsummary/disconnect/
>>>
>>> No module named http
>>>
>>>  Request Method: GET  Request URL:
>>> http://192.168.12.59:8080/cdrimport/settings/fraudsummary/disconnect/?id=3  
>>> Django
>>> Version: 1.6.4  Exception Type: ImportError  Exception Value:
>>>
>>> No module named http
>>>
>>>  Exception Location: 
>>> /home/akhil/Documents/NIVIN/NIVIN/svn/CrossFraudet/branches/V2.1.0/crossfraudet/cdrimport/views/fraud_summary_view.py
>>> in , line 24  Python Executable: /usr/bin/python  Python
>>> Version: 2.7.6  Python Path:
>>>
>>> ['/home/akhil/Documents/NIVIN/NIVIN/svn/CrossFraudet/branches/V2.1.0/crossfraudet',
>>>  
>>> '/usr/local/lib/python2.7/dist-packages/gevent-1.0.1-py2.7-linux-x86_64.egg',
>>>  
>>> '/usr/local/lib/python2.7/dist-packages/greenlet-0.4.2-py2.7-linux-x86_64.egg',
>>>  '/usr/lib/python2.7',
>>>  '/usr/lib/python2.7/plat-x86_64-linux-gnu',
>>>  '/usr/lib/python2.7/lib-tk',
>>>  '/usr/lib/python2.7/lib-old',
>>>  '/usr/lib/python2.7/lib-dynload',
>>>  '/usr/local/lib/python2.7/dist-packages',
>>>  '/usr/lib/python2.7/dist-packages',
>>>  '/usr/lib/python2.7/dist-packages/PILcompat',
>>>  '/usr/lib/python2.7/dist-packages/gtk-2.0',
>>>  '/usr/lib/pymodules/python2.7',
>>>  '/usr/lib/python2.7/dist-packages/ubuntu-sso-client',
>>>  '/usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode']
>>>
>>>  Server time: Wed, 18 Mar 2015 16:32:22 +
>>>  Traceback Switch to copy-and-paste view
>>> 
>>>
>>>- /usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py
>>>in get_response
>>>1.
>>>
>>>   resolver_match = resolver.resolve(request.path_info)
>>>
>>>   ...
>>> ▶ Local vars
>>>
>>> 
>>> - /usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py
>>>in resolve
>>>1.
>>>
>>>   for pattern in self.url_patterns:
>>>
>>>   ...
>>> ▶ Local vars
>>>
>>> 
>>> - /usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py
>>>in url_patterns
>>>1.
>>>
>>>   patterns = getattr(self.urlconf_module, "urlpatterns", 
>>> self.urlconf_module)
>>>
>>>   ...
>>> ▶ Local vars
>>>
>>> 
>>> - /usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py
>>>in urlconf_module
>>>1.
>>>
>>>   self._urlconf_module = import_module(self.urlconf_name)
>>>
>>>   ...
>>> ▶ Local vars
>>>
>>> 
>>> - /usr/local/lib/python2.7/dist-packages/django/utils/importlib.py
>>>in import_module
>>>1.
>>>
>>>   __import__(name)
>>>
>>>   ...
>>> ▶ Local vars
>>>
>>> 
>>> -
>>>
>>> /home/akhil/Documents/NIVIN/NIVIN/svn/CrossFraudet/branches/V2.1.0/crossfraudet/crossfraudet/urls.py
>>>in 
>>>1.
>>>
>>>   url( r'^cdrimport/', include( 'cdrimport.urls' ) ),
>>>
>>>   ...
>>> ▶ Local vars
>>>
>>> 
>>> -
>>>/usr/local/lib/python2.7/dist-packages/django/conf/urls/__init__.py
>>>in include
>>>1.
>>>
>>>   urlconf_module = import_module(urlconf_module)
>>>
>>>   ...
>>> ▶ Local vars
>>>
>>> 
>>> - /usr/local/lib/python2.7/dist-packages/django/utils/importlib.py
>>>in import_module
>>>1.
>>>
>>>   __import__(name)
>>>
>>>   ...
>>> ▶ Local vars
>>>
>>> 
>>> -
>>>
>>> 

Re: Edx LDAP Auth setting

2015-02-24 Thread Mario Gudelj
To check the version go to shell and run this:

>>> import django_auth_ldap

>>> django_auth_ldap.version

(1, 1, 2)

>>>

As for virtualenv, it's a good practice but it's not necessary.

By the way, have you tried performing a simple search on the LDAP server? I
think that your best bet is to start with python-ldap (forget about
django_auth_ldap), try to connect to the server, perform a bind and get a
feel for it.

I normally open the shell and run something like this in it
https://bpaste.net/show/d4348eb1b3dd

You have to know the following:

- protocol (secure or not)

- IP or domain name of the LDAP server

- port

- A full DN of one of the users would be useful but once you establish the
connection you can figure this out.

I remember that I was using Django 1.5.x and django_auth_ldap was still
using User model by default. Not sure if that's still the case but you may
have to patch it.

Good luck!

M









On 24 February 2015 at 17:37, 'Yip Terence' via Django users <
django-users@googlegroups.com> wrote:

> Hi L,
>
>
>
> Thanks for your reply.
>
>
>
> I’m through pip to install the django-auth-ldap already.  But there are
> two question here.
>
> 1.   How can I check the django-auth-ldap version?
>
> 2.   What do you mean of install via virt env? I’m follow the edX
> Ubuntu 12.04 +64 bit installation guide to install the edX, is that virt
> env?
>
>
> *https://github.com/edx/configuration/wiki/edX-Ubuntu-12.04-64-bit-Installation*
> 
>
>
>
>
> -
>
> root@ethiopia:/edx/app/edxapp/edx-platform/lms/envs# pip install
> django-auth-ldap
>
> Requirement already satisfied (use --upgrade to upgrade): django-auth-ldap
> in /usr/local/lib/python2.7/dist-packages
>
> Requirement already satisfied (use --upgrade to upgrade): django in
> /usr/local/lib/python2.7/dist-packages (from django-auth-ldap)
>
> Requirement already satisfied (use --upgrade to upgrade): python-ldap>=2.0
> in /usr/local/lib/python2.7/dist-packages (from django-auth-ldap)
>
> Requirement already satisfied (use --upgrade to upgrade): setuptools in
> /usr/local/lib/python2.7/dist-packages (from
> python-ldap>=2.0->django-auth-ldap)
>
> Cleaning up...
>
>
>
> Thanks and Regards,
>
> Terence Yip
>
> Lachlan Musicman於 2015年2月24日星期二 UTC+8上午7時15分46秒寫道:
>
>> Sorry, I've been organising a conference and have been awol. I'll be
>> able to take a look next week. But quickly:
>>
>> I don't understand why you have two versions of Django, I would
>> suggest that is an issue.
>>
>> You should be using django-auth-ldap, and that's got Django > 1.3 as a
>> requirement.
>>
>> You shouldn't need to create the %user - that is done automatically by
>> the django-auth-ldap
>>
>> Finally, please please please use a virtual environment. It makes all
>> of this significantly easier - like finding django-auth-ldap is as
>> easy as "pip install django-auth-ldap".
>>
>> It's recommended you don't install via apt-get. While apt-get is easy
>> and centralised, in the case of web apps, I would install via virt env
>> and pip every time.
>>
>> cheers
>> L.
>> --
>> "This is a profound psychological violence here. How can one even
>> begin to speak of dignity in labor when one secretly feels one's job
>> should not exist?"
>>
>> On the Phenomenon of Bullshit Jobs, David Graeber
>> http://strikemag.org/bullshit-jobs/
>>
>>
>> On 23 February 2015 at 19:09, 'Yip Terence' via Django users
>>  wrote:
>> > Hi L,
>> >
>> > Actually, I has been input the LDAP string in
>> > /edx/app/edxapp/edx-platform/lms/envs/common.py.  But there a two
>> problems
>> > after the configuration. Firstly, the script can't get the %user value
>> I
>> > need to hardcode the username / email in the connection string than I
>> can
>> > login to edx.  Secondly, can't to create an user profile when first
>> login.
>> >
>> > Is it need to modify the views.py and urls.py file for collect the
>> %user
>> > value and create the user profile?
>> >
>> >
>> > I have 2 version django in edx.
>> > ./edx/app/edxapp/venvs/edxapp/src/lettuce/tests/integration/
>> lib/Django-1.3/django/bin/django-admin.py
>> > ./edx/app/edxapp/venvs/edxapp/src/lettuce/tests/integration/
>> lib/Django-1.2.5/django/bin/django-admin.py
>> >
>> >
>> > ldap_auth_ldap:
>> > How can I find the version?  I using the apt-get to install the
>> package.
>> >
>> > The search settings.py result.
>> > ---Setttings.py---
>> > ./edx/app/xqueue/xqueue/xqueue/settings.py
>> > ./edx/app/xqueue/venvs/xqueue/lib/python2.7/site-packages/
>> django/conf/project_template/project_name/settings.py
>> > ./edx/app/xqueue/venvs/xqueue/lib/python2.7/site-packages/
>> newrelic-2.18.1.15/newrelic/api/settings.py
>> > ./edx/app/edxapp/edx-platform/common/test/acceptance/pages/studio/settings.py
>>
>> > 

Re: Question about form security.

2015-02-19 Thread Mario Gudelj
Because the user must be logged in to update their username you can get the
current user from the request. You don't need to have their id inside the
form.
On 20/02/2015 9:49 am, "Chen Xu"  wrote:

> Hi
> I am implementing a feature while building a website using Django,
> basically, I want user to be able to update their usernames. All of a
> sudden, this question comes to me, if I have the userid (ex: 1) somewhere
> in the form as a data attribute, if someone use firebug or something to
> change the data-userid to 2, and submit the form, this will result in that
> user 2 gets updated, right?
>
> What is the correct way to prevent this?
>
> Thanks
>
>
> --
> ⚡ Chen Xu ⚡
>
> --
> 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CACac-qZ-dOZqFCzS0U7LHWE6Q7HR9bapVfFbYqjawtVhWG5-MQ%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHqTbjkXji3ggpUCPaD8qaiTBEptourA5Qrssmf3iEU22Lxkkg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: how to handle race conditions?

2015-02-18 Thread Mario Gudelj
Great reply. You're a champion, Carl!

On 19 February 2015 at 05:31, Carl Meyer  wrote:

> Hi Abraham,
>
> On 02/17/2015 10:01 PM, Abraham Varricatt wrote:
> > I'm trying to make an app where folks can order X quantity of an item.
> > The condition is that the order should only be made if inventory exists.
> > Assume that we have stock of Y items. This means that only if Y >= X
> > should we allow the sale to go through. And once we accept an order, the
> > inventory should be updated so that Y = Y - X.
>
> In general, the construct you need is called a "transaction", which
> ensures that a series of database operations will either all be
> committed together, or rolled back if they can't be successfully
> completed. The Django API for that is "django.db.transaction.atomic".
>
> > The way I've currently implemented this is with a pair of getter/setter
> > methods. I have a model 'ShopItem' which has two fields called
> > 'quantity' and 'name' (this is unique). I've made a utility class
> > (outside model source file) where I've made the following 2 functions;
> >
> > def get_quantity(name):
> >   stuff_left = 0
> >   try:
> > item = ShopItem.objects.get(name=name)
> > stuff_left = item.quantity
> >   except ShopItem.DoesNotExist:
> > pass # return zero
> >   return stuff_left
> >
> > def set_quantity(name, stuff_left):
> >   item = ShopItem.objects.get(name=name)
> >   item.quantity = stuff_left
> >   item.save()
> >
> >
> > Elsewhere in my project, if I need to display the remaining quantity of
> > an item in a view, I'll pass the result from get_quantity(). At sale
> > time here is how I update things;
> >
> > def customer_buy(name, number):
> >   temp = get_quantity(name)
> >   if (temp >= number):
> > temp = temp - number
> > set_quantity(name, temp)
> > // do other things
> >   else:
> > // sale failed, do something else
> >
> > I tested this on my system and things appear to work. But I'm concerned
> > about race conditions. What if two different customers came in to buy
> > the same item? As in; if I only have 7 items in stock, but one customer
> > came to buy 6nos and another 5nos. There is a chance (as per my
> > understanding) that both orders will be accepted - even worse, my
> > inventory will not accurately reflect the updated situation.
> >
> > Any ideas on how this issue can be resolved? I've come across this
> > -
> https://docs.djangoproject.com/en/1.6/ref/models/instances/#updating-attributes-based-on-existing-fields
> > , but not sure how to apply it to the current scenario.
>
> If we're only considering the changes to your ShopItem model, you don't
> even need an explicit transaction to avoid race conditions, because (as
> the docs you linked show) the operation can be completed in a single
> database query, which is inherently atomic. This is how it would look to
> do it in a single query:
>
> from django.db.models import F
>
> def customer_buy(name, number):
> ShopItem.objects.filter(
> name=name).update(quantity=F('quantity')-number)
>
> You want this to fail if someone tries to purchase a larger quantity
> than are available. The best way to do this is via a database-level
> "check constraint" on the column, such that the database itself will
> never permit a negative quantity. If you make 'quantity' a
> PositiveIntegerField (the name is wrong, it actually allows zero too) on
> your model, and your database is PostgreSQL (or Oracle), Django will add
> this constraint for you automatically. Then if someone tries to purchase
> more than are available, you'll get an IntegrityError, which you'd want
> to catch and handle in some way:
>
> from django.db import IntegrityError
> from django.db.models import F
>
> class InsufficientInventory(Exception):
> pass
>
> def customer_buy(name, number):
> try:
> ShopItem.objects.filter(
> name=name).update(quantity=F('quantity')-number)
> except IntegrityError:
> # signal to the calling code that the purchase failed - the
> # calling code should catch this exception and notify the
> # user that the purchase failed due to lack of inventory,
> # and tell them the updated available quantity
> raise InsufficientInventory()
>
> You also want this function to handle the case where the given product
> name doesn't exist. To help with this case, the `update` method returns
> the number of rows updated:
>
> from django.db import IntegrityError
> from django.db.models import F
>
> class InsufficientInventory(Exception):
> pass
>
> def customer_buy(name, number):
> try:
> updated = ShopItem.objects.filter(
> name=name).update(quantity=F('quantity')-number)
> except IntegrityError:
> raise InsufficientInventory()
> if not updated:
> # Here we reuse Django's 

Re: html response to be loaded in a div

2015-02-18 Thread Mario Gudelj
You may need to use | safe filter in your tag since your output is being
encoded.

E.g.

{{output|safe}}

Cheers,

M

On 19 February 2015 at 07:37, João Marques 
wrote:

> This is what is being sent to the view:
>
>
> %5B%5B%5B%275E%27,%20%2710A%27,%20%278D%27%5D,%20%5B%278B%27,%20%2711B%27,%20%2712G%27%5D,%20%5B%278C%27,%20%277B%27%5D,%20%5B%2712C%27,%20%2711F%27,%20%276A%27%5D,%5B%275E%27,%20%2710G%27,%20%2710H%27%5D,%5B%278A%27,%2711E%27%5D,%20%5B%277A%27,%20%2712E%27,%20%2712F%27%5D,%20%5B%275A%27,%20%2711C%27,%20%2712B%27,%2711G%27%5D,%20%5B%277E%27,%20%2711A%27,%20%276E%27%5D,%20%5B%2710F%27,%20%2712D%27%5D,%20%5B%279E%27,%2710D%27,%20%2712A%27%5D,%20%5B%276C%27,%20%279C%27,%2710E%27%5D,%20%5B%279D%27,%20%275C%27,%20%278E%27%5D,%20%5B%277C%27,%20%2710B%27%5D,%20%5B%279B%27,%20%276B%27%5D,%20%5B%276D%27,%20%279A%27%5D,%5B%2711D%27,%275D%27%5D,%20%2710C%27,%20%275B%27%5D,%20%5B%277D%27%5D,%202800%5D,%20%5B%5B%279E%27,%20%2711G%27,%20%2712B%27,%20%2711C%27%5D,%20%5B%2710H%27,%20%279E%27,%20%2712A%27%5D,%20%5B%2710E%27,%2712C%27,%20%275D%27%5D,%20%5B%276E%27,%2011B%27,%20%277E%27,%20%2712F%27%5D,%20%5B%2712E%27,%20%2710B%27,%20%278E%27,%275C%27%5D,%20%5B%2711D%27,%20%275B%27%5D,%20%5B%277A%27,%20%279D%27,%20%2711E%27%5D,%5B%276A%27,%20%2711A%27,%20%277D%27%5D,%20%5B%279B%27,%20%275E%27,%2710A%27%5D,%20%5B%2710C%27,%20%277C%27%5D,%20%5B%278A%27,%20%2710D%27%5D,%20%5B%276C%27,%20%279A%27,%20%2712D%27%5D,%20%5B%2712G%27,%20%276D%27%5D,%5B%2710F%27%5D,%5B%279C%27,%20%2710G%27%5D,%20%5B%2711F%27,%276B%27%5D,%20%5B%278B%27%5D,%20%5B%278D%27%5D,%20%5B%277B%27,%20%278C%27%5D,%20%5B%275A%27%5D,%202700%5D%5D
>
> instead of:
>
> [[['5E', '10A', '8D'], ['8B', '11B', '12G'], ['8C', '7B'], ['12C', '11F',
> '6A'],['5E', '10G', '10H'],['8A','11E'], ['7A', '12E', '12F'], ['5A',
> '11C', '12B','11G'], ['7E', '11A', '6E'], ['10F', '12D'], ['9E','10D',
> '12A'], ['6C', '9C','10E'], ['9D', '5C', '8E'], ['7C', '10B'], ['9B',
> '6B'], ['6D', '9A'],['11D','5D'], '10C', '5B'], ['7D'], 2800], [['9E',
> '11G', '12B', '11C'], ['10H', '9E', '12A'], ['10E','12C', '5D'], ['6E',
> 11B', '7E', '12F'], ['12E', '10B', '8E','5C'], ['11D', '5B'], ['7A', '9D',
> '11E'],['6A', '11A', '7D'], ['9B', '5E','10A'], ['10C', '7C'], ['8A',
> '10D'], ['6C', '9A', '12D'], ['12G', '6D'],['10F'],['9C', '10G'],
> ['11F','6B'], ['8B'], ['8D'], ['7B', '8C'], ['5A'], 2700]]
>
>
> Altough when I reach the view, the content that is loaded to the db is the
> right one
>
>  --
> 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/158965f3-09d9-4bfe-a66a-1f353698bffd%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHqTbj%3DNUz%2Bzr_LGs5kG4KrRRWyFfotWJ%3D5r2m3_WmHkxM8tOw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django Auth\Auth

2015-02-02 Thread Mario Gudelj
Here's the link to docs
https://docs.djangoproject.com/en/1.7/topics/auth/customizing/#specifying-a-custom-user-model
which will guide you through that.

On 2 February 2015 at 14:30, Ajay M  wrote:

> Hi,
> I'm a new bee to Django, I need to use signup/login facilities in my
> project
> How do I customize and use django Auth/Auth feature? On sign up I have to
> store many details than just first_name, last_name, email and password. Can
> any one help me :) ?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/9206cffd-c423-4699-adf5-9376b7f09f62%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHqTbjkK5cQKStaaQAvXAHiaEbtCS35M2TMfaOp4zPBsPh6yAQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Disorientated by too many google-maps django packages

2015-01-26 Thread Mario Gudelj
Hey Victor,

Here's some basic JS I've used in a project to plot client locations, and
to show their name and phone when the marker is clicked:

var locations = {{ locations|safe }};

var map = new google.maps.Map(document.getElementById('map-canvas'), {
zoom: 11,
center: new google.maps.LatLng(-33.92, 151.25),
mapTypeId: google.maps.MapTypeId.ROADMAP
});
var infowindow = new google.maps.InfoWindow();

var marker, i;

for (i = 0; i < locations.length; i++) {
lat_log_split = locations[i][1].split(",");
marker = new google.maps.Marker({
position: new
google.maps.LatLng(parseFloat(lat_log_split[0]),parseFloat(lat_log_split[1])),
map: map
});

google.maps.event.addListener(marker, 'click', (function(marker, i) {
return function() {
var popup = ''+locations[i][0]+'
'+locations[i][2]+'M:'+locations[i][3]+'';
infowindow.setContent(popup);
infowindow.open(map, marker);
}
})(marker, i));
}

You'll see that the following code is plotting the marker on the map using
lat and long, which I've obtained by geocoding the client's address on the
server side.

marker = new google.maps.Marker({
position: new
google.maps.LatLng(parseFloat(lat_log_split[0]),parseFloat(lat_log_split[1])),
map: map
});

You have to link to maps api before this code with:

http://maps.google.com/maps/api/js?sensor=false";
type="text/javascript">

I'm just passing an array inside {{ locations|safe }} where each array item
contains customer info.

It's probably not the best way to do this and what George has written is a
better approach, but it works well for me. I think I've used something from
here to obtain lat and long https://pypi.python.org/pypi/django-easy-maps

Cheers,

M




On 27 January 2015 at 03:54, George Silva  wrote:

> I would suggest a new approach here. Don't use a package that is out there.
>
> Since your task is quite simple, you should create you webmapp using
> JavaScript, and pull all the patient data from your django server using
> REST or use a map server, like GeoServer, to create and render your layers
> on top of your Google Map's Layers.
>
> In the client side, two libraries dominate: OpenLayers and Leaflet.
>
> Check them out.
>
> If you need other functionality, you can code it yourself. These packages
> have limited functions, so if you ever need anything else, you'll end up
> hacking the package or letting it go all the way.
>
> On Mon, Jan 26, 2015 at 2:41 PM, Victor  wrote:
>
>> I'm working for a medical non-profit company for domiciliary assistance
>> of ill people managed by means of a django app in production.  One of the
>> models is for patients and contains, among many other pieces of info,
>> their addresses scattered all over Rome. I would like to use a google-maps
>> django package able to put all the flags of patients' addresses on the map
>> of Rome in one shot. Googling around I found many of them and frankly feel
>> somewhat disorientated. As a matter of fact it looks as those packages are
>> able to put just one flag at a time on a map.
>> In your experience is there any specific package able to suit my needs?
>> Thanks
>> Vittorio
>>
>> --
>> 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 http://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/12E97993-5E82-48EF-AE5C-443F51F79C32%40gmail.com
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
> George R. C. Silva
> SIGMA Consultoria
> 
> http://www.consultoriasigma.com.br/
>
> --
> 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAGyPVTt2bpAwzi5XVXH3sRZH7YWJEkLikdiZLTpnLPmL_KDA%3DA%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, 

Re: How to run background application via Django

2015-01-08 Thread Mario Gudelj
Look into celery. It's the best and easiest way to run bg jobs imo
On 08/01/2015 9:10 pm, "Sugita Shinsuke"  wrote:

> Hi there.
>
> I'd like to run background application.
>
> I coded this code.
>
> I wrote the urls.py and I added in the view.
>
> def run_junix(request):
> cmd = "cd app_path;nohup python background_app.py &"
> import subprocess
> proc = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE,
> stderr=subprocess.STDOUT)
>
> return HttpResponse("bg test")
>
> Is it good way? or using supervisor or, if you know the better way, would
> you tell me?
>
> Anyone who know this matter, 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/0a8222ff-a22c-44a5-a098-2b663aaca294%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHqTbjnHWho4t5KAV9cf0fbKvckGpTCBFycKnxWdR7SAK2W9OA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Select a single field from database (postgresql)

2014-12-21 Thread Mario Gudelj
Or use .latest()
On 19/12/2014 11:00 pm, "aRkadeFR"  wrote:

>  Hello Cássio,
>
> You first need to map your cars table with a Model in Django
> (https://docs.djangoproject.com/en/1.7/topics/db/models/),
> then you can construct your query something like this:
>
> Car.objects.order_by('-registered').last()
>
> Check out the documentation on queries here:
> https://docs.djangoproject.com/en/1.7/topics/db/queries/
>
> Have a good one,
>
> aRkadeFR
>
>
> On 12/19/2014 12:51 PM, Cássio Van Helden Gameiro wrote:
>
>  Hi, i have a database with many cars, and i want to select the last car
> based the hour that it was registered, can someone help me?
>
>  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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/fecb3393-d336-4aa8-8058-f6bbf9cfbfc4%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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/54941319.9040806%40arkade.info
> 
> .
> 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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHqTbjnoEONUmejPA9f9KodPhb2pzyZzCWkcrYVoNfza1gyFJQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Devils advocate question

2014-12-17 Thread Mario Gudelj
Deploying your Django site doesn't have to be that painful. You can do it
in a single command with https://github.com/gcollazo/Fabulous. It'll take
you about an hour to have a full stack running with a bit of tweaking.

On 18 December 2014 at 11:11, James Schneider 
wrote:
>
> As a reformed PHP and Drupal developer, I can say with 100% certainty that
> trying to crowbar Drupal (or any CMS) in to performing actions that are
> outside of the built-in core functionality is a nightmare at best. I wrote
> half a dozen custom modules (~6K SLOC), and at least 30% of that was wasted
> code that simply overrode the default behavior of the CMS. I grew weary of
> playing whack-a-mole with built-in constraints, and hit a point of
> diminishing returns where I spent more time fighting with the Drupal
> internals than adding needed functionality.
>
> Drupal is a relatively good CMS and has regular updates with an active
> community. If your planned app fits within the CMS model, even with a few
> tweaks from 3rd party modules, you can be up/running with a smaller amount
> of raw developer effort if you keep within their sandbox. The biggest draw
> for me at the time was not needing to build the HTML presentation layer and
> letting Drupal handle the formatting using their theme system. As my
> requirements grew outside of the CMS box, it became a hindrance. Obviously
> I don't have that [dis]advantage with Django, and even the built-in admin
> portal would likely cause me the same grief, so I'm rolling my own custom
> HTML templates (which for me takes more time than the functional code
> underneath). Authentication/authorization was another pain point with
> Drupal, as it is much more tightly integrated into their core. I'm rolling
> a custom auth solution for Django as well to meet my requirements. Don't
> even get me started on the ridiculous amount of expensive SQL queries that
> were run per request...almost everything in a CMS comes from the database.
> I needed APC caching just to have a usable site for 20 concurrent users.
> PHP just feels dirty, especially with inconsistent function naming schemes
> using CamelCase or under_scores. Maintaining raw PHP code intertwined
> inside of HTML templates is obnoxious. Django template abstraction with
> tags, etc. is a much cleaner way to go, and keeps you honest in terms of
> littering inside of your HTML templates.
>
> In terms of development time, I can have a blog running in Drupal in 10-15
> minutes with a custom theme. The equivalent in Django would probably be a
> day or two's worth of work at best assuming that you already know what you
> are doing and are awesome with HTML. There are probably Django packages
> that would shorten that time, though. However, trying to build a pizza
> ordering system in Drupal would require psychological therapy and probably
> never be finished, but the raw logic of how to do it can be a day or two's
> work in Django (depending on how good your HTML skills are). You might even
> be able to do that in the admin and skip the HTML all together. Development
> and time to production are heavily dependent on your skill set and
> available resources for either product. If you don't know Python/HTML,
> don't expect a fully working application in the blink of an eye.
>
> Keep in mind that Drupal is a CMS, with an obvious bias towards CMS-type
> functionality (and is designed to be an almost entirely point and click
> solution). Django is a lower-level framework that provides a toolkit to
> build whatever you want (including not being limited to just rendering
> HTML). Think of Django as a work truck loaded with construction tools and
> lumber, and Drupal as a pre-fabricated house that just gets placed on the
> foundation. You can pick the color of the house, but that's it, although,
> for some people, a blue house is all they need. It's hard to compare the
> two as they have different uses in mind. Not to mention that Python is a
> much cleaner language in many respects, most notably for syntax and memory
> management.
>
> As mentioned before, Rails is similar to Django with the big exception
> being written in Ruby, rather than Python. Not sure what other magic secret
> sauce they include, but I found anything with Ruby tends to be more magical
> than pragmatic in my limited experience with it when I considered it when I
> chose the Django path.
>
>
> HTH,
>
> -James
>
>
>
> On Wed, Dec 17, 2014 at 8:38 AM, Scot Hacker 
> wrote:
>>
>>
>>
>> On Tuesday, December 16, 2014 1:15:57 PM UTC-8, Sayth Renshaw wrote:
>>>
>>> With django what benefit do I get for the extra build time over Drupal
>>> or Rails.
>>
>>
>> I'd strongly contest that statement. Development time might be roughly
>> equivalent to Rails (given equally experienced developers), but compared to
>> Drupal? I see Drupalistas struggling to convince the platform to do the
>> simplest things, on a regular basis. With Django or Rails you 

Re: Models not appearing in db. Am I missing something?

2014-12-16 Thread Mario Gudelj
Pgadmin3 is the bomb. Try that gui tool
On 16/12/2014 4:40 pm, "Shazwi Suwandi"  wrote:

> Hey guys,
>
> I figured it was a problem with the app I'm using for the db. I went to
> use another app and now the tables are showing. Silly me. Thanks Mario and
> David for your helpful advice. :)
>
> On Tuesday, 16 December 2014 13:33:36 UTC+8, Shazwi Suwandi wrote:
>>
>> Hey Mario,
>>
>> The output I get when I use makemigrations is
>>
>>   0001_initial.py:
>>
>> - Create model Member.
>>
>> I've double checked:
>>
>>
>>- The 'Member' model is in core/models.py
>>- 'Core' is inside project/settings.py
>>
>> I use python manage.py shell and I accessed the 'User' object and the
>> linked 'Member' object to get the fields inside and it works.
>> Furthermore, when I went to my db gui and try to delete the rows in the
>> 'auth_user' table, it says that there is a constraint in 'core_member'
>> table.
>>
>> Here's the link to the image that shows all the tables I have.
>> http://i.imgur.com/M1ZWznt.png
>>
>>
>> On Tuesday, 16 December 2014 11:18:58 UTC+8, somecallitblues wrote:
>>>
>>> What's the output of your makemigrations command? If those models are
>>> inside core/models.py and your app is inside installed apps in settings
>>> this should totally work. The default name for the table will be
>>> appname_modelname. Do you get an error when accessing the model? How are
>>> you checking the db for tables?
>>> On 15/12/2014 11:00 pm, "Shazwi Suwandi"  wrote:
>>>
 Hey David,

 You're right, I have to practise writing tests along with my codes.
 However, just to clarify, data input and output works. I can call the data
 in the Member object. I'm just confused as to why the Member table does not
 show up in my postgres database. It's weird.

 Nevertheless, I'll start writing unit tests.

 On Monday, 15 December 2014 19:03:23 UTC+8, David Palao wrote:
>
> Hello,
> From your post I understand you did not write unittests for your
> models?
> I would recommend to write some sensible tests for them and start
> tracing your problem from the failures you should get.
> Best,
>
> David
>
> 2014-12-15 8:15 GMT+01:00 Shazwi Suwandi :
> > I've added 'core' to settings.py file under INSTALLED_APPS too.
> >
> >
> > On Monday, 15 December 2014 15:10:12 UTC+8, Shazwi Suwandi wrote:
> >>
> >> from django.db import models
> >> from django.contrib.auth.models import User
> >>
> >> # CORE APPLICATION
> >> # Create your models here.
> >> class Member(models.Model):
> >> user = models.OneToOneField(User)
> >> description = models.CharField(max_length=250)
> >> date_of_birth = models.DateField()
> >> location = models.CharField(max_length=100)
> >> gender = models.CharField(max_length=15)
> >>
> >> class NewTable(models.Model):
> >> test = models.CharField(max_length=25)
> >>
> >> I've created some models and I used makemigrations and migrate. I
> went to
> >> my db and checked that only the default tables are there
> (auth_group ...
> >> django_session). I know that my connection settings are right and
> that I see
> >> new rows being added to the auth_user table when I create users in
> django
> >> admin page.
> >>
> >> Is there something that I must have missed 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...@googlegroups.com.
> > To post to this group, send email to django...@googlegroups.com.
> > Visit this group at http://groups.google.com/group/django-users.
> > To view this discussion on the web visit
> > https://groups.google.com/d/msgid/django-users/7af04f16-09a8
> -458d-8857-c71694394101%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...@googlegroups.com.
 To post to this group, send email to django...@googlegroups.com.
 Visit this group at http://groups.google.com/group/django-users.
 To view this discussion on the web visit https://groups.google.com/d/
 msgid/django-users/6dff229e-34c3-4e4f-bb34-f95c43bec18f%
 40googlegroups.com
 
 .
 For more options, visit https://groups.google.com/d/optout.

>>>  --
> You received this message because you are subscribed to the 

Re: Models not appearing in db. Am I missing something?

2014-12-15 Thread Mario Gudelj
What's the output of your makemigrations command? If those models are
inside core/models.py and your app is inside installed apps in settings
this should totally work. The default name for the table will be
appname_modelname. Do you get an error when accessing the model? How are
you checking the db for tables?
On 15/12/2014 11:00 pm, "Shazwi Suwandi"  wrote:

> Hey David,
>
> You're right, I have to practise writing tests along with my codes.
> However, just to clarify, data input and output works. I can call the data
> in the Member object. I'm just confused as to why the Member table does not
> show up in my postgres database. It's weird.
>
> Nevertheless, I'll start writing unit tests.
>
> On Monday, 15 December 2014 19:03:23 UTC+8, David Palao wrote:
>>
>> Hello,
>> From your post I understand you did not write unittests for your models?
>> I would recommend to write some sensible tests for them and start
>> tracing your problem from the failures you should get.
>> Best,
>>
>> David
>>
>> 2014-12-15 8:15 GMT+01:00 Shazwi Suwandi :
>> > I've added 'core' to settings.py file under INSTALLED_APPS too.
>> >
>> >
>> > On Monday, 15 December 2014 15:10:12 UTC+8, Shazwi Suwandi wrote:
>> >>
>> >> from django.db import models
>> >> from django.contrib.auth.models import User
>> >>
>> >> # CORE APPLICATION
>> >> # Create your models here.
>> >> class Member(models.Model):
>> >> user = models.OneToOneField(User)
>> >> description = models.CharField(max_length=250)
>> >> date_of_birth = models.DateField()
>> >> location = models.CharField(max_length=100)
>> >> gender = models.CharField(max_length=15)
>> >>
>> >> class NewTable(models.Model):
>> >> test = models.CharField(max_length=25)
>> >>
>> >> I've created some models and I used makemigrations and migrate. I went
>> to
>> >> my db and checked that only the default tables are there (auth_group
>> ...
>> >> django_session). I know that my connection settings are right and that
>> I see
>> >> new rows being added to the auth_user table when I create users in
>> django
>> >> admin page.
>> >>
>> >> Is there something that I must have missed 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...@googlegroups.com.
>> > To post to this group, send email to django...@googlegroups.com.
>> > Visit this group at http://groups.google.com/group/django-users.
>> > To view this discussion on the web visit
>> > https://groups.google.com/d/msgid/django-users/7af04f16-
>> 09a8-458d-8857-c71694394101%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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/6dff229e-34c3-4e4f-bb34-f95c43bec18f%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHqTbjmh6cG08TNO8Eab1Av4amkaHk%2BdZEgmMODpDq7YS0cz8g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django don't load css

2014-12-14 Thread Mario Gudelj
You may have an error in your css file if the link isn't 404ring when you
look at your console or the chrome tab...
On 15/12/2014 1:36 pm, "Jovana Andjelkovic" 
wrote:

> I am trying to run a site on Django development server but my css don't
> load. When I open dev tools in Chrome I see in network that css is loaded
> as text/plain and not as text/css.My link is good,because when I open it,it
> opens my css file.And my admin site don't have css also,and that can't be
> my mistake because I didn't do anything with it! As soon as I change
> something in css in dev tools css starts working but as soon as I reload
> the page it is gone!
>
> --
> 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/e5a23d51-5866-42d0-9e9e-2e69a8c3c340%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHqTbj%3DiU097O52Zu0vDTBSK4me97H_9LOOStM7g7Wempsb6uw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: django template auto format tool?

2014-12-14 Thread Mario Gudelj
PyCharm ide does a great job for all those file types.
On 14/12/2014 2:00 pm, "Abraham Varricatt" 
wrote:

> Hello,
>
> Is there any command-line based tool which would let one auto-format
> Django template files? Ideally, the tool should also be used to format
> HTML, CSS and .JS files too.
>
> I've recently inherited a bad-looking code base and want to clean it up.
> Have heard of the PEP8 autoformatter, but that just works for Python files,
> right?
>
> -Abraham V.
>
>  --
> 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/6ce7098d-5ab0-4223-8488-35f6688adc9f%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHqTbjn%2BZ2rwmRd9qJy%3D_z_6yN4OiSF-oLuM4JRALw3iWYrkug%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Connect django project with sharepoint 2013

2014-12-07 Thread Mario Gudelj
Well your python code is trying access that url so the url must work
On 07/12/2014 4:47 pm, "Hossein Rashnoo"  wrote:

> I can access to http://portal:8080/ in my browser when i set our office
> proxy and port. And my linux server that i run django on it, is local. Do i
> need to set proxy to access sharepoint?
>
> On Sunday, December 7, 2014 8:30:18 AM UTC+3:30, somecallitblues wrote:
>>
>> Urllib2 can't open the url http:// portal:8080. I assume that you can't
>> visit that url from the browser either
>> On 07/12/2014 3:46 pm, "Hossein Rashnoo"  wrote:
>>
>>> I need this connection for adding list items and save my users data on
>>> sharepoint database. I ran it in command line and when i write something
>>> like """ print site.lists[0] """ this error appear :
>>>
>>>
>>>   File "", line 1, in 
>>>   File "/usr/lib/python2.6/site-packages/sharepoint/lists/__init__.py",
>>> line 84, in __getitem__
>>> return self.all_lists[key]
>>>   File "/usr/lib/python2.6/site-packages/sharepoint/lists/__init__.py",
>>> line 36, in all_lists
>>> result = self.opener.post_soap(LIST_WEBSERVICE, xml)
>>>   File "/usr/lib/python2.6/site-packages/sharepoint/site.py", line 31,
>>> in post_soap
>>> response = self.opener.open(request)
>>>   File "/usr/lib64/python2.6/urllib2.py", line 391, in open
>>> response = self._open(req, data)
>>>   File "/usr/lib64/python2.6/urllib2.py", line 409, in _open
>>> '_open', req)
>>>   File "/usr/lib64/python2.6/urllib2.py", line 369, in _call_chain
>>> result = func(*args)
>>>   File "/usr/lib64/python2.6/urllib2.py", line 1190, in http_open
>>> return self.do_open(httplib.HTTPConnection, req)
>>>   File "/usr/lib64/python2.6/urllib2.py", line 1165, in do_open
>>> raise URLError(err)
>>> URLError: 
>>>
>>>
>>> On Saturday, December 6, 2014 4:19:45 PM UTC+3:30, François
>>> Schiettecatte wrote:

 Ok, but I am not sure what this has to do with Django ? Maybe you
 should ask on a SharePoint mailing list ? And did you try running the code
 in a script on the command line ?

 François

 > On Dec 6, 2014, at 7:10 AM, Hossein Rashnoo 
 wrote:
 >
 > I need to connect my project to sharepoint. So i installed
 "sharepoint 0.4.1" package and then use this code in my view :
 >
 > from sharepoint import SharePointSite, basic_auth_opener
 >
 > def userloginres(request):
 > server_url = "http://portal:8080/;
 > site_url = server_url + "rashno/"
 > opener = basic_auth_opener(server_url, "my username", "my
 password")
 > site = SharePointSite(site_url, opener)
 >
 > htt=r"Sharepoint lists"
 > for sp_list in site.lists:
 > htt = htt + r" %s . %s " % (sp_list.id
 ,sp_list.meta['Title'])
 > htt = htt + r""
 >
 > t = get_template('userlogin/userloginres.html')
 > html= t.render(Context({"htt":htt}))
 > return HttpResponse(html)
 >
 > But now when i open that url this error appear:
 >
 > URLError at /test/login/
 >
 > 
 >
 > --
 > 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 http://groups.google.com/group/django-users.
 > To view this discussion on the web visit https://groups.google.com/d/
 msgid/django-users/a982dfcf-6824-441a-ab5f-f68907e1f0d7%40goog
 legroups.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...@googlegroups.com.
>>> To post to this group, send email to django...@googlegroups.com.
>>> Visit this group at http://groups.google.com/group/django-users.
>>> To view this discussion on the web visit https://groups.google.com/d/
>>> msgid/django-users/34b04a5b-0a1e-4405-9a73-a8e3856940a2%
>>> 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 http://groups.google.com/group/django-users.
> To view this discussion on the web 

Re: Connect django project with sharepoint 2013

2014-12-06 Thread Mario Gudelj
Urllib2 can't open the url http:// portal:8080. I assume that you can't
visit that url from the browser either
On 07/12/2014 3:46 pm, "Hossein Rashnoo"  wrote:

> I need this connection for adding list items and save my users data on
> sharepoint database. I ran it in command line and when i write something
> like """ print site.lists[0] """ this error appear :
>
>
>   File "", line 1, in 
>   File "/usr/lib/python2.6/site-packages/sharepoint/lists/__init__.py",
> line 84, in __getitem__
> return self.all_lists[key]
>   File "/usr/lib/python2.6/site-packages/sharepoint/lists/__init__.py",
> line 36, in all_lists
> result = self.opener.post_soap(LIST_WEBSERVICE, xml)
>   File "/usr/lib/python2.6/site-packages/sharepoint/site.py", line 31, in
> post_soap
> response = self.opener.open(request)
>   File "/usr/lib64/python2.6/urllib2.py", line 391, in open
> response = self._open(req, data)
>   File "/usr/lib64/python2.6/urllib2.py", line 409, in _open
> '_open', req)
>   File "/usr/lib64/python2.6/urllib2.py", line 369, in _call_chain
> result = func(*args)
>   File "/usr/lib64/python2.6/urllib2.py", line 1190, in http_open
> return self.do_open(httplib.HTTPConnection, req)
>   File "/usr/lib64/python2.6/urllib2.py", line 1165, in do_open
> raise URLError(err)
> URLError: 
>
>
> On Saturday, December 6, 2014 4:19:45 PM UTC+3:30, François Schiettecatte
> wrote:
>>
>> Ok, but I am not sure what this has to do with Django ? Maybe you should
>> ask on a SharePoint mailing list ? And did you try running the code in a
>> script on the command line ?
>>
>> François
>>
>> > On Dec 6, 2014, at 7:10 AM, Hossein Rashnoo  wrote:
>> >
>> > I need to connect my project to sharepoint. So i installed "sharepoint
>> 0.4.1" package and then use this code in my view :
>> >
>> > from sharepoint import SharePointSite, basic_auth_opener
>> >
>> > def userloginres(request):
>> > server_url = "http://portal:8080/;
>> > site_url = server_url + "rashno/"
>> > opener = basic_auth_opener(server_url, "my username", "my
>> password")
>> > site = SharePointSite(site_url, opener)
>> >
>> > htt=r"Sharepoint lists"
>> > for sp_list in site.lists:
>> > htt = htt + r" %s . %s " % (sp_list.id
>> ,sp_list.meta['Title'])
>> > htt = htt + r""
>> >
>> > t = get_template('userlogin/userloginres.html')
>> > html= t.render(Context({"htt":htt}))
>> > return HttpResponse(html)
>> >
>> > But now when i open that url this error appear:
>> >
>> > URLError at /test/login/
>> >
>> > 
>> >
>> > --
>> > 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 http://groups.google.com/group/django-users.
>> > To view this discussion on the web visit https://groups.google.com/d/
>> msgid/django-users/a982dfcf-6824-441a-ab5f-f68907e1f0d7%
>> 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/34b04a5b-0a1e-4405-9a73-a8e3856940a2%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHqTbj%3D5nfwvwi9AzXU62fOh%2B4P05GH6L19XULrezs_reVT4gg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Seeking for advise on usage MySQL together with MongoDB

2014-12-06 Thread Mario Gudelj
Django ORM is the best thing since sliced bread!
On 07/12/2014 8:17 am, "Cal Leeming"  wrote:

> Hi Artie,
>
> First, I would strongly recommend reading some of the work by David Mytton
> at Server Density, he and his team have been using MongoDB extensively for
> many years and they have shared a lot of their insight [1]. It's also worth
> mentioning that Postgres has support for JSON field type [2] which
> satisfies many of the use cases for document store, though I haven't
> finished my own experiments yet so can't comment on comparative
> performance/functionality.
>
> It's industry knowledge that MySQL is bleeding out, rapidly [3] [4]. At
> this point, I introduce you to Monty and his creation MariaDB [5]. Although
> I would agree with Russell on many of the points he's made about MySQL,
> it's hard not to have respect for the work that Monty and his team have
> done previously on MySQL, and the vision that is now MariaDB. I would
> strongly recommend you spend some time looking into this yourself, read as
> many comparison articles as your eyes will allow, and come to your own
> conclusions.
>
> I have built numerous "large scale" systems with a variety of
> technologies.. Sphinx, ElasticSearch, MongoDB, MySQL, CouchBase, Redis.
> I've also spent many years battling with MongoEngine and have learnt to
> hate it, as much as I now hate the Django ORM. So, unless you are edging
> towards terabytes of data, assuming you are using SSDs and high memory
> nodes, then the impact of your choice will probably be negligible. And if
> you are using the Django ORM, then you are even less likely to reap any of
> these benefits out of the box [6] There are many different reasons for
> choosing one over the over, and you should assess this based on your own
> use case/needs/skills, rather than religious bias.
>
> Determine your use case and test all viable options, otherwise you could
> be avoiding something for the wrong reasons. You can build *beautiful*
> things with all these different technologies, and it's actually the mindset
> which matters the most [7]. Don't just settle for what others are telling
> you, try for yourself and come to your own conclusions, only then can you
> be sure. It's also a good way to gain in-depth knowledge about how these
> technologies work, which can be invaluable.
>
> Cal
>
>
> [1] https://blog.serverdensity.com/mongodb/
> [2] http://www.postgresql.org/docs/9.3/static/datatype-json.html
> [3] http://www.theregister.co.uk/2012/11/29/monty_oracle_eu_promises/
> [4]
> http://www.computing.co.uk/ctg/news/2271011/mysql-creator-monty-widenius-wants-it-to-disappear-from-the-earth
> [5] http://www.themukt.com/2014/09/11/reason-use-mysql-michael-widenius/
> [6] https://news.ycombinator.com/item?id=4076834
> [7]
> http://www.amazon.co.uk/The-Clean-Coder-Professional-Programmers/dp/0137081073
>
>
>
> On Sat, Dec 6, 2014 at 12:26 AM, Russell Keith-Magee <
> russ...@keith-magee.com> wrote:
>
>>
>> On Fri, Dec 5, 2014 at 8:56 PM, Artie  wrote:
>>
>>> Good day, Community,
>>>
>>> I'm looking for advise on MySQL & MongoDB usage so please let me take
>>> your time to describe the situation.
>>>
>>> I came to work on e-commerce shop of electrical components with about 10
>>> millions of products. Now all of it stored in awful structure of tables in
>>> MySQL. Products stored in 10 small tables, each of them represents
>>> individual manufacturer of products and 1 generalized table, where all 10
>>> millions of goods is stored. Those big table serves Sphinx search to
>>> implement search on site.
>>> All these products being crawled from several APIs and sites on web, so
>>> this shop is kind of authorized reseller in our region.
>>>
>>> The case is that we have to update all products daily and  parsing with
>>> updating of products takes very long time.
>>>
>>> I have an idea to start using MongoDB to update and store products and
>>> as I think it might take less time than same in MySQL. First question: Am I
>>> correct with this statement?
>>>
>>> Browsing web I've found that some recommend using pymongo, avoiding
>>> django rather than mongodb for django. So for your opinion is this
>>> statement correct?
>>>
>>> Also it will be highly highly appreciated if you can share your personal
>>> use experience with MongoDB and any information you think be useful.
>>>
>>
>> Hi Artie,
>>
>> Can I make an alternate suggestion? Get a real database.
>>
>> In all honesty, I've never heard anyone in the Django community express a
>> deep love of MySQL or MongoDB. I know people who use MySQL, but when they
>> admit that, they say "Yeah, I know, but the customer required it" or "Yeah,
>> I know, but at the time we started it was the only thing Amazon supported".
>> As for MongoDB, the sentiment is usually "... and that was our first
>> mistake.".
>>
>> Personally - I have very little time for MySQL. It gets a number of key
>> design decisions wrong (for example, InnoDB's 

Re: Newbie: How to implement a app/module, which I can include from my html?

2014-11-27 Thread Mario Gudelj
https://docs.djangoproject.com/en/dev/howto/custom-template-tags/#inclusion-tags
here you go chief
On 27/11/2014 8:04 pm, "ThomasTheDjangoFan" <
stefan.eichholz.ber...@googlemail.com> wrote:

> Oh ok.
>
> so it would be something like:
>
> in home.html
> {% include 'category-list.html' %}
>
> in category-lists.html
> {% load those_categories %}
> 
>
> ?
>
> Am Donnerstag, 27. November 2014 09:55:50 UTC+1 schrieb James Bennett:
>>
>> The usual way would be to write a custom template tag that fetches the
>> objects and puts them into the template context.
>>
>  --
> 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/d88ef650-0d18-4d6d-bad9-8a6a990524bf%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHqTbj%3DB75vLYB77QnHYXGy5%3De0ZroTY2EUhq5No4z9_9cnDnQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Rendering TabuarInline inside ModelAdmin without a foreign key

2014-11-02 Thread Mario Gudelj
Thanks Collin. That's the path I've had to take.
On 03/11/2014 11:55 am, "Collin Anderson"  wrote:

> Hi Mario,
>
> If you are able to edit the model replacing the IntegerField with this
> should do what you want:
> user = models.ForeignKey(CRMUser, null=True, blank=True,
> on_delete=DO_NOTHING)
>
> Collin
>
>  --
> 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/831261fb-2037-4ed1-8bb4-2a6ec7e6b33e%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHqTbjnLzgJ3nn8N62_7o4uJziji2C3eqHrqjL2EELjMHfdcTQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Rendering TabuarInline inside ModelAdmin without a foreign key

2014-10-29 Thread Mario Gudelj
Here's the models code, DR:

class CRMUser(AbstractBaseUser, PermissionsMixin):
email = models.EmailField(
verbose_name='Email Address',
max_length=255,
unique=True,
)
first_name = models.CharField("First Name", max_length=50, blank=True)
last_name = models.CharField("Last Name", max_length=50, blank=True)
phone = models.CharField("Billing Country", max_length=30, null=True,
blank=True)
...

class Order(models.Model):
order_code = models.CharField("Order ID", null=True, max_length=10)
status = models.IntegerField("Order Status",
choices=ORDER_STATUS_CHOICES, null=True, default=1)
user_id = models.IntegerField("User ID", null=True, blank=True)
...

Thanks for all your help on SO and this list by the way. I seem to come
across your answers a lot and they're really useful. You're a champ!

On 30 October 2014 07:06, Mario Gudelj <mario.gud...@gmail.com> wrote:

> I did not produce the original model so I wouldn't know. My thinking is
> that the order model had to be independent of the user model so that the
> deletion of the user doesn't cascade down to orders. It's a mezzanine site
> and that's how it handles fk from orders to users.
> On 29/10/2014 9:27 pm, "Daniel Roseman" <dan...@roseman.org.uk> wrote:
>
>> On Wednesday, 29 October 2014 03:57:36 UTC, somecallitblues wrote:
>>>
>>> Hi list,
>>>
>>> I have a table of orders where one of the columns is a IntegerField
>>> containing the id of a user who created the order.
>>>
>>> Since it's not a FK field django admin can't display these orders inline
>>> inside the user details page.
>>>
>>> I would normally use something like:
>>>
>>> class OrderInline(admin.TabularInline):
>>> extra = 0
>>> model = Order
>>>
>>> And then add that to the user model like this:
>>>
>>> inlines = [OrderInline]
>>>
>>> But it won't work without the FK.
>>>
>>> I've Googled around and tried everything I found on SO but I can't
>>> figure out how to add orders inline to my user model.
>>>
>>> I'm looking at https://docs.djangoproject.com/en/dev/_modules/django/
>>> contrib/contenttypes/admin/#GenericTabularInline and I'm thinking do I
>>> need to write a similar class or is there something easy and simple I'm
>>> missing.
>>>
>>> Cheers,
>>>
>>> Mario
>>>
>>>
>>>
>> You don't show your models, but why is it not a ForeignKey? After all, a
>> FK field is exactly what you describe, an integer field that contains the
>> ID of the model it is pointing to. So why not declare it as one?
>> --
>> DR.
>>
>> --
>> 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 http://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/fc21c60e-5a33-4e10-9f48-42c2c8c43c7e%40googlegroups.com
>> <https://groups.google.com/d/msgid/django-users/fc21c60e-5a33-4e10-9f48-42c2c8c43c7e%40googlegroups.com?utm_medium=email_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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHqTbjmRmLJ1OYP6ptLaJ6U9Wvq3oT1YWiu-URMAE19ahcfsGg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Rendering TabuarInline inside ModelAdmin without a foreign key

2014-10-29 Thread Mario Gudelj
I did not produce the original model so I wouldn't know. My thinking is
that the order model had to be independent of the user model so that the
deletion of the user doesn't cascade down to orders. It's a mezzanine site
and that's how it handles fk from orders to users.
On 29/10/2014 9:27 pm, "Daniel Roseman"  wrote:

> On Wednesday, 29 October 2014 03:57:36 UTC, somecallitblues wrote:
>>
>> Hi list,
>>
>> I have a table of orders where one of the columns is a IntegerField
>> containing the id of a user who created the order.
>>
>> Since it's not a FK field django admin can't display these orders inline
>> inside the user details page.
>>
>> I would normally use something like:
>>
>> class OrderInline(admin.TabularInline):
>> extra = 0
>> model = Order
>>
>> And then add that to the user model like this:
>>
>> inlines = [OrderInline]
>>
>> But it won't work without the FK.
>>
>> I've Googled around and tried everything I found on SO but I can't figure
>> out how to add orders inline to my user model.
>>
>> I'm looking at https://docs.djangoproject.com/en/dev/_modules/django/
>> contrib/contenttypes/admin/#GenericTabularInline and I'm thinking do I
>> need to write a similar class or is there something easy and simple I'm
>> missing.
>>
>> Cheers,
>>
>> Mario
>>
>>
>>
> You don't show your models, but why is it not a ForeignKey? After all, a
> FK field is exactly what you describe, an integer field that contains the
> ID of the model it is pointing to. So why not declare it as one?
> --
> DR.
>
> --
> 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/fc21c60e-5a33-4e10-9f48-42c2c8c43c7e%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHqTbjkp5ZOtatEe-1kdpq_n1EYPejqzV0TjPyd-uHjNpV4qww%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Rendering TabuarInline inside ModelAdmin without a foreign key

2014-10-28 Thread Mario Gudelj
Hi list,

I have a table of orders where one of the columns is a IntegerField
containing the id of a user who created the order.

Since it's not a FK field django admin can't display these orders inline
inside the user details page.

I would normally use something like:

class OrderInline(admin.TabularInline):
extra = 0
model = Order

And then add that to the user model like this:

inlines = [OrderInline]

But it won't work without the FK.

I've Googled around and tried everything I found on SO but I can't figure
out how to add orders inline to my user model.

I'm looking at
https://docs.djangoproject.com/en/dev/_modules/django/contrib/contenttypes/admin/#GenericTabularInline
and I'm thinking do I need to write a similar class or is there something
easy and simple I'm missing.

Cheers,

Mario

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHqTbjkzDTZ54v1-uZPTdTSgApQTnySKGAvZ%2BzZjqH0g4fUB%3DA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Unable to store static

2014-10-16 Thread Mario Gudelj
Try {% load staticfiles %} instead of {% load static %}

On 16 October 2014 20:21, Sachin Tiwari  wrote:

> Hi,
>
> I  created templates and static directory in parallel  with my project
> directory like below but only html part is visible to me css and js part
> are not visible,
>
> //templates/home.html
> //static/static/css/
> //static/static/js/
>
>  html use,
>
> {% load static %}
>
>
>  />
>  rel="stylesheet"/>
> 
>  
> 
>
>
> And added a below line in /settings.py,
>
> STATICFILES_DIRS = (
>os.path.join(PROJECT_PATH, "static"),
>)
>
>
>
>
>
>  --
> 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/ffb7b5a6-2cbf-4573-be0b-b8ea740603b0%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHqTbjmmU%3DrUXAha5hshiAAzHGCgK5-eguOjrcarr3qb7d_PWQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Upload file IN DJANGO

2014-10-15 Thread Mario Gudelj
https://docs.djangoproject.com/en/dev/topics/http/file-uploads/#handling-uploaded-files-with-a-model
cheers!
On 15/10/2014 9:38 pm, "Devin Cky"  wrote:

>
> please help me  i want to upload a file in my django application
>
> how to save in a database(postgresql) an upload file in django ... thank
> for your answers .
>
> --
> 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/9d1545eb-5c94-42d3-8881-64c2c3499c8a%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHqTbjmQHLZt95bvAMvXZzAn-%3D9X0DjL6YNA-gN9gGVCb1xfKA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Ldap authentication using django_auth_ldap

2014-09-25 Thread Mario Gudelj
I've sent the last email prematurely. I'm sorry about that.

The way I normally set this up is I'll use 2 backends:

AUTHENTICATION_BACKENDS = (
'django_auth_ldap.backend.LDAPBackend',
'django.contrib.auth.backends.ModelBackend',
)

If the LDAP backend fails the Django will try the standard ModelBackend, so
this way you can have non LDAP users on the system.

But then in your LDAP settings you'll have the following:

AUTH_LDAP_SERVER_URI = "ldaps://192.168.20.20:636"

That IP will be different in your case but you have to tell Django where
it's going to connect to.

It depends on the server setup, but sometimes you'll have to bind before
performing a search and sometimes you won't. If you do, and this is
something you can find out from the person who's setup the LDAP server,
you'll need to supply AUTH_LDAP_BIND_DN and AUTH_LDAP_BIND_PASSWORD. Note
that AUTH_LDAP_BIND_DN is usually in this format "base_dn\user".

Now do this part:

AUTH_LDAP_USER_SEARCH = LDAPSearchUnion(
LDAPSearch("dc=dn_higher,dc= dn_low", ldap.SCOPE_SUBTREE,
"(sAMAccountName=%(user)s)"),
)

sAMAccountName part is not always the same. But if you have just a base DN
you can figure out the rest from the response. Here's something you can run
in the shell that can help:

import ldap
ldap.set_option(ldap.OPT_X_TLS_REQUIRE_CERT, ldap.OPT_X_TLS_NEVER)
l = ldap.initialize("ldaps://192.168.20.20:636")
l.set_option(ldap.OPT_REFERRALS, 0)
l.set_option(ldap.OPT_PROTOCOL_VERSION, 3)
l.set_option(ldap.OPT_X_TLS,ldap.OPT_X_TLS_DEMAND)
l.set_option( ldap.OPT_X_TLS_DEMAND, True )
l.set_option( ldap.OPT_DEBUG_LEVEL, 255 )
searchScope = ldap.SCOPE_SUBTREE
retrieveAttributes = None
l.bind("base_dn\user", "password")
baseDN = "dc=domain,dc=local"
searchFilter = "cn=*username_here*"
ldap_result_id = l.search(baseDN, searchScope, searchFilter)
result_set = []
while 1:
result_type, result_data = l.result(ldap_result_id, 0)
if (result_data == []):
break
else:
if result_type == ldap.RES_SEARCH_ENTRY:
result_set.append(result_data)
print result_set

Oh, and the backend uses the old User from django.contrib.auth.models so
you may need to do some changes to the django_auth_ldap code if you have
extended AbstractUser or if you're using email for authentication.

Good luck! I hope you don't spend too much time setting this up and I hope
this helps.

On 25 September 2014 22:56, Mario Gudelj <mario.gud...@gmail.com> wrote:

> If that's the actual file it certainly won't work. You don't even have
> ldap server address setup. And those dots in dn, what is that?
> On 25/09/2014 9:09 pm, "RDN" <er.rubidebnath.2...@gmail.com> wrote:
>
>> This is my settings.py file. I am trying to create an application where
>> the user will be able to login using their windows credentials.
>>
>>
>>
>>
>> import os
>> import ldap
>> from django_auth_ldap.config import LDAPSearch, GroupOfNamesType
>> BASE_DIR = os.path.dirname(os.path.dirname(__file__))
>>
>> SECRET_KEY = '_7)uzbsm4*u*ncc6@u(ej9wmy_5+#ol^wdhqh3kf$honrwslh='
>>
>> DEBUG = True
>>
>> TEMPLATE_DEBUG = True
>>
>> ALLOWED_HOSTS = []
>>
>>
>>
>> # Application definition
>>
>> INSTALLED_APPS = (
>> 'django.contrib.admin',
>> 'django.contrib.auth',
>> 'django.contrib.contenttypes',
>> 'django.contrib.sessions',
>> 'django.contrib.messages',
>> 'django.contrib.staticfiles',
>> 'sep24'
>> )
>>
>> MIDDLEWARE_CLASSES = (
>> 'django.contrib.sessions.middleware.SessionMiddleware',
>> 'django.middleware.common.CommonMiddleware',
>> 'django.middleware.csrf.CsrfViewMiddleware',
>> 'django.contrib.auth.middleware.AuthenticationMiddleware',
>> 'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
>> 'django.contrib.messages.middleware.MessageMiddleware',
>> 'django.middleware.clickjacking.XFrameOptionsMiddleware',
>> )
>>
>> #
>> AUTH_LDAP_GLOBAL_OPTIONS ={
>> ldap.OPT_X_TLS_REQUIRE_CERT:False,
>> ldap.OPT_REFERRALS:False,
>> }
>> # Baseline configuration.
>> AUTH_LDAP_SERVER_URI = "ldap://com.example/;
>> AUTH_LDAP_USER_DN_TEMPLATE =
>> "uid=%(user)s,ou=,dc=.,dc=.,dc=.."
>> AUTH_LDAP_BIND_DN = "CN=rdn@com.example,DC=.,DC=.,DC=."
>> AUTH_LDAP_BIND_PASSWORD = "password..."
>> AUTH_LDAP_USER_SEARCH =
>> LDAPSearch("ou=Groups,ou=..,dc=,dc=.,dc=...",
>> ldap.SCOPE_SUBT

Re: Ldap authentication using django_auth_ldap

2014-09-25 Thread Mario Gudelj
If that's the actual file it certainly won't work. You don't even have ldap
server address setup. And those dots in dn, what is that?
On 25/09/2014 9:09 pm, "RDN"  wrote:

> This is my settings.py file. I am trying to create an application where
> the user will be able to login using their windows credentials.
>
>
>
>
> import os
> import ldap
> from django_auth_ldap.config import LDAPSearch, GroupOfNamesType
> BASE_DIR = os.path.dirname(os.path.dirname(__file__))
>
> SECRET_KEY = '_7)uzbsm4*u*ncc6@u(ej9wmy_5+#ol^wdhqh3kf$honrwslh='
>
> DEBUG = True
>
> TEMPLATE_DEBUG = True
>
> ALLOWED_HOSTS = []
>
>
>
> # Application definition
>
> INSTALLED_APPS = (
> 'django.contrib.admin',
> 'django.contrib.auth',
> 'django.contrib.contenttypes',
> 'django.contrib.sessions',
> 'django.contrib.messages',
> 'django.contrib.staticfiles',
> 'sep24'
> )
>
> MIDDLEWARE_CLASSES = (
> 'django.contrib.sessions.middleware.SessionMiddleware',
> 'django.middleware.common.CommonMiddleware',
> 'django.middleware.csrf.CsrfViewMiddleware',
> 'django.contrib.auth.middleware.AuthenticationMiddleware',
> 'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
> 'django.contrib.messages.middleware.MessageMiddleware',
> 'django.middleware.clickjacking.XFrameOptionsMiddleware',
> )
>
> #
> AUTH_LDAP_GLOBAL_OPTIONS ={
> ldap.OPT_X_TLS_REQUIRE_CERT:False,
> ldap.OPT_REFERRALS:False,
> }
> # Baseline configuration.
> AUTH_LDAP_SERVER_URI = "ldap://com.example/;
> AUTH_LDAP_USER_DN_TEMPLATE =
> "uid=%(user)s,ou=,dc=.,dc=.,dc=.."
> AUTH_LDAP_BIND_DN = "CN=rdn@com.example,DC=.,DC=.,DC=."
> AUTH_LDAP_BIND_PASSWORD = "password..."
> AUTH_LDAP_USER_SEARCH =
> LDAPSearch("ou=Groups,ou=..,dc=,dc=.,dc=...",
> ldap.SCOPE_SUBTREE, "(uid=%(User)s)")
> # or perhaps:
> # AUTH_LDAP_USER_DN_TEMPLATE = "uid=%(user)s,ou=users,dc=example,dc=com"
>
> # Set up the basic group parameters.
> AUTH_LDAP_GROUP_SEARCH = LDAPSearch("ou=
> Groups,ou=...,dc=,dc=...,dc=...",
> ldap.SCOPE_SUBTREE, "(objectClass=groupOfNames)"
> )
> AUTH_LDAP_GROUP_TYPE = GroupOfNamesType(name_attr="cn")
>
> # Simple group restrictions
> AUTH_LDAP_REQUIRE_GROUP =
> "cn=enabled,ou=Groups,ou=..,dc=.,dc=..,dc="
> AUTH_LDAP_DENY_GROUP =
> "cn=disabled,ou=.Groups,ou=...,dc=...,dc=..,dc=..."
>
> # Populate the Django user from the LDAP directory.
> AUTH_LDAP_USER_ATTR_MAP = {
> "first_name": "givenname",
> "last_name": "sn",
> "email": "mail"
> }
>
> AUTH_LDAP_PROFILE_ATTR_MAP = {
> "employee_number": "employeeNumber"
> }
>
> AUTH_LDAP_USER_FLAGS_BY_GROUP = {
> "Domain Users":
> "cn=Users,ou=Groups,ou=.,dc=.,dc=.,dc=...",
> "SCS-Employees-Pune": "cn=Users,ou=
> Groups,ou=...,dc=..,dc=..,dc=..",
> "SCSPuneEmployees":
> "cn=superuser,ou=Groups,ou=...,dc=.,dc=.,dc=."
> }
>
> #AUTH_LDAP_PROFILE_FLAGS_BY_GROUP = {
>  #   "is_awesome":
> "cn=Users,ou=Groups,ou=,dc=..,dc=.,dc=.",
> #}
>
> # This is the default, but I like to be explicit.
> AUTH_LDAP_ALWAYS_UPDATE_USER = True
>
> # Use LDAP group membership to calculate group permissions.
> AUTH_LDAP_FIND_GROUP_PERMS = True
>
> # Cache group memberships for an hour to minimize LDAP traffic
> AUTH_LDAP_CACHE_GROUPS = True
> AUTH_LDAP_GROUP_CACHE_TIMEOUT = 3600
> AUTH_LDAP_MIRROR_GROUPS = True
> AUTH_LDAP_AUTHORIZE_ALL_USERS = True
>
> # Keep ModelBackend around for per-user permissions and maybe a local
> # superuser.
> AUTHENTICATION_BACKENDS = (
> 'django_auth_ldap.backend.LDAPBackend',
> 'django.contrib.auth.backends.ModelBackend',
> )
>
> ROOT_URLCONF = 'sep24.urls'
>
> WSGI_APPLICATION = 'sep24.wsgi.application'
>
>
> # Database
> # https://docs.djangoproject.com/en/1.7/ref/settings/#databases
>
> DATABASES = {
> 'default': {
> 'ENGINE': 'django.db.backends.sqlite3',
> 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
> }
> }
>
> # Internationalization
> # https://docs.djangoproject.com/en/1.7/topics/i18n/
>
> LANGUAGE_CODE = 'en-us'
>
> TIME_ZONE = 'UTC'
>
> USE_I18N = True
>
> USE_L10N = True
>
> USE_TZ = True
>
>
> # Static files (CSS, JavaScript, Images)
> # https://docs.djangoproject.com/en/1.7/howto/static-files/
>
> STATIC_URL = '/static/'
>
> LOGGING = {
> 'version': 1,
> 'disable_existing_loggers': False,
> 'handlers': {
> 'mail_admins': {
> 'level': 'ERROR',
> 'class': 'django.utils.log.AdminEmailHandler'
> },
> 'stream_to_console': {
> 'level': 'DEBUG',
> 'class': 'logging.StreamHandler'
> },
> },
> 'loggers': {
> 'django.request': {
> 

Re: Generic way to create forms (not admin forms)

2014-09-17 Thread Mario Gudelj
Look at how mezzanine CMS does it. I think Stephen called it form for forms
at one stage. It uses standard relational schema for everything.
On 18/09/2014 1:07 am, "Collin Anderson"  wrote:

>  We store the field structure using JSON and then use that information to
> construct a django ModelField (so django can render the html and do
> validation).
>
> If you just want to be able to create HTML form elements (without backend
> validation), I think storing them as HTML is the way to go, rather than
> somehow translating them to JSON and back. If needed, you can store extra
> information using class="" or data-*="".
>
>  --
> 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/678735de-3d19-4dfe-a317-7d9305da9691%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHqTbjmTQQ%3D0SWuWj8Gn4gUPZjRDmBJuA7UQaHnjHOWDZfrWFg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: static files in Django 1.7 ; Anything was change?

2014-09-14 Thread Mario Gudelj
What are you using to serve static files? You normally setup your server
e.g. Nginx to take care of this.

Here's an example of Nginx setup file which serves static files from
/webapps/hello_django/static/:

server {

listen   80;
server_name example.com;

client_max_body_size 4G;

access_log /webapps/hello_django/logs/nginx-access.log;
error_log /webapps/hello_django/logs/nginx-error.log;

location /static/ {
alias   /webapps/hello_django/static/;
}

location /media/ {
alias   /webapps/hello_django/media/;
}
...

That was taken from this awesome article on deploying Django
http://michal.karzynski.pl/blog/2013/06/09/django-nginx-gunicorn-virtualenv-supervisor/

On 15 September 2014 11:02, Fellipe Henrique  wrote:

> Hi everybody!
>
> I have my old project in Django 1.6, and works fine in development... when
> DEBUG=True.. but when I update to 1.7, stop to serving static files.
>
> Here is my files:
>
> url: https://gist.github.com/fellipeh/06746184ee0878f70bc2
> template: https://gist.github.com/fellipeh/798b32661d4f9fe376ef
>
> What I missed?
>
> Thanks,
>
> regards,
> Fellipe H.
>
> --
> 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/8690ea0f-35d9-49f2-b4e4-34bb80bdeb28%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHqTbjkCnTcp%2Bc9j06aqC8EUTNp1nbR5ePiXtvnc%3D6bdaSsjKA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Three Django forms in different tabs in one template?

2014-09-11 Thread Mario Gudelj
K. Another option would be to render all the forms in GET and then use Ajax
and 3 different views to process POST requests from those forms.

Or you can add different values to each of the form's submit button and
check which form form is being submitted by that value. That's if you want
to use the same view to process all 3 forms. Example:

if request.method == "POST":
if request.POST['submit_button_name'] == "Submit Button Value":


On 12 September 2014 04:11, Andrew Pinkham  wrote:

> Hi Franco, Faridul, Stodge,
>
> There are actually quite a few problems being asked. I've split them up
> into discrete questions.
>
> 1. Can a single view function print three forms in a template?
>
> Yes.
>
> WARNING: I am coding all of this off the top of my head. The code is
> likely riddled with typos and errors. Sorry. Hopefully the example will
> demonstrate enough of the idea.
>
> # VIEW FUNCTION
> # Start by invoking the forms you want
> # remember to pass POST or initial data if necessary
> form1 = FormClassOne()
> # etc for as many forms as you'd like.
>
> # Create a Context or Request Context
> c = Context({"foo": [form1, form2, form3]})
>
> # or, more easily, use the `render` shortcut
> render(
> request,
> template_name_vsr,
> {'forms' : [form1, form2, form3]})
>
> # TEMPLATE
> 
> {% for form in forms %}
>   
>  method="post">
> {% csrf_token %}
> {{ form.as_p }}
> 
> 
>   
> {% endfor %}
> 
>
> 2. How should I handle the submission process (POST data)? With one view
> function, or with three view functions?
>
> Both are valid ways of doing it, but I heavily favor the method with three
> POST processing views. The reason is that by combining all this logic in
> one location, you are increasing the complexity of your site drastically.
> Debugging that will be no fun in the event of a problem. Having a place
> where the forms are as simple as possible is quite desirable. Remember to
> write tests.
>
> I would recommend starting with the three view method, and then moving
> into the single view function method, if so desired.
>
> 3. How do I program three view functions to handle POST requests from
> forms in a single view function?
>
> Start by creating a basic view function that handles both the GET (display
> of form) and POST (submission of data) for all of the forms (just as you
> would regularly). A Generic Class Based View might be all you need here,
> but it might be wise to start with a simple Class Based View.
>
> Now, simply point the forms above to these webpage urls. There are many
> ways to do this. I would consider: (1) adding the action URL to the form
> class as an instance variable, or else (2) simply building the URL in the
> single form view and passing it to the URL.
>
> Note: you may have/want to account for the URL referring to these forms. I
> am fuzzy on the details
>
> Consider that having a separate view/page for each form will help debug
> any issues, as you have a place where the complexity of the form/view is as
> low as possible.
>
> 4. How do I program a single view function to handle POST requests from
> all three forms?
>
> The first problem is that you need to know which form has been submitted
> from the single view page. Using a hidden form field may provide that
> information, or checking the keys of the POST querydict may also work.
> However, in both cases, you are relying on information provided by the
> user, which is a Bad Idea. This is the biggest reason not to follow this
> method.
>
> However, once you know which form is being submitted, you may then process
> it according to the rules set forth in the three views your previously
> programmed. Remember to adhere to DRY (ie: split the functionality into
> small, reusable pieces)!
>
> I realize that's a lot of info, but again, there was quite a lot being
> asked. I hope that helps clarify the issue.
>
> Andrew
>
> --
> 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/24D6792A-4316-4806-8D10-470EAD15BCFD%40andrewsforge.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 http://groups.google.com/group/django-users.
To view this 

Re: User to Model relationship- implement a "like" feature on a Model

2014-08-25 Thread Mario Gudelj
The other way would be to simply wire a cookie to user's browser and use js
to disable the the like button if the cookie is present if you can get away
with it. Not sure if you need to store that info against the user to see
which items they liked...
On 26/08/2014 8:41 am, "amarshall"  wrote:

> Hi,
>
>I'm trying to implement likes on a Model in which 1 user will be able
> to like an a model (named "event") "once" and only once.
>
> so, I have a model like this:
>
> class Event(models.Model):
>
> user = models.ForeignKey(User)
> . #other fields
> .
> likes = models.PositiveIntegerField(default=0,null=True)
>
>
>
>
> How do I implement it so that only one user can "like" an event (increase
> by 1) ? Brainstorming I'm thinking should I make a new class called "like"
> and have it have "Event" as a foreign key and a oneToOne relationship with
> User ? not really sure how to go about doing this.
>
> class Like(models.Model):
>
>event = models.ForeignKey(Event)
>
>user = model.ManyToMany(User)
>user_liked = models.BooleanField(default=false)
>total_count = models.PositiveIntegerField(default=0)
>
>
> ?   Then when an event is created a "Like" is created as well ? This may
> be doing to much and there's a simpler 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/05ade3fc-f182-49be-a7d3-043fad68131b%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHqTbjmGzLQ7x06XoWpXhjphv6dP7G3O2%3De3%2BBLqO3da4uoEFA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Model - def __unicode__(self) - doesn't work

2014-08-25 Thread Mario Gudelj
Your problem is in the add view. Post your view code
On 26/08/2014 7:20 am, "Przemek Ciborowski"  wrote:

> Hello guys,
>
> I'm really beginner in django.
> I have extremely simple example:
>
> class Vlan(models.Model):
> name = models.CharField(max_length=30, name='Vlan name')
> number = models.IntegerField(default=0, name='Vlan number')
>
> def __unicode__(self):
> return self.name
>
> When I'm trying to use admin interface, I got this error:
>
> AttributeError at /admin/networks/vlan/add/
>
> 'Vlan' object has no attribute 'name'
>
> Request Method:POSTRequest URL:
> http://127.0.0.1:8000/admin/networks/vlan/add/Django Version:1.6.6Exception
> Type:AttributeErrorException Value:
>
> 'Vlan' object has no attribute 'name'
>
> Exception Location:D:\Scripts\Mercury\networks\models.py in __str__, line
> 10Python Executable:C:\Python\Main\Scripts\python.exePython Version:2.7.8
>
> I'm sure that it was working a few days ago. And in meantime I did django
> upgrade.
> What I'm doing wrong, and how I can fix it?
>
> Thanks in advance.
> Przemek.
>
> --
> 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/50470bc3-c7a0-4afd-b655-f7a3cf8304a0%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHqTbj%3DNk8DTt5UNGktqkGb6-Lwqvt8-g2sSW9EpbMZ_8YPRSQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: cms web buyilding

2014-08-22 Thread Mario Gudelj
There's nothing else to be said mate
On 22/08/2014 6:35 pm, "ngangsia akumbo"  wrote:

> Then i should be very comfortable with my django.
>
> Any more comments on that?
>
> On Tuesday, August 19, 2014 11:23:07 AM UTC+1, Tom Evans wrote:
>>
>> On Mon, Aug 18, 2014 at 9:00 AM, ngangsia akumbo 
>> wrote:
>> > then if drupal , jomlam has what django has then why are u building app
>> with
>> > django, that requires much coding?
>> >
>>
>> Drupal and Joomla are CMS applications. They allow you to build Drupal
>> and Joomla CMS apps. They are all very similar and do similar things.
>> If you want to do something that they cannot do, it is difficult
>> because everything you have to do must be done in the way that Drupal
>> or Joomla say you must do things.
>>
>> So CMS applications allow you to easily build CMS applications, but
>> make it difficult to build non CMS applications.
>>
>> Django is a library for doing things with web requests, including
>> generating HTML. It can do anything you want with web requests. It
>> does not become more difficult to utilise django when the project is
>> more complex.
>>
>> When you hire someone who is good at building CMS applications, you
>> are hiring someone who will be very good at building a simple CMS, but
>> will struggle if you want to do something complex, bespoke or just
>> "not CMS-like".
>>
>> When you hire someone who is good at building Django projects, you are
>> hiring someone who can build whatever it is you can think of.
>>
>> If you are thinking about which skill set it is worth learning, the
>> same applies. Learning Django well will make you a more competent and
>> useful developer than learning how to operate a specific CMS platform.
>>
>> On the other hand, many people make a good living by selling their CMS
>> skills to people who don't know better*.
>>
>> Cheers
>>
>> Tom
>>
>> * If this seems derogatory, you should see the paragraph I deleted..
>>
>  --
> 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/0ea59364-1b48-4753-b109-cfc3c0de779f%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHqTbjnQcu9BGZPrQ%3D2eOgbjt2bNcsSr3DsE2DZj897hp1KxjQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Change color of table cell based in another cell value django-tables2

2014-08-21 Thread Mario Gudelj
I have never used "django-tables2" package but traditionally you'd do
something like class="color_{{item.reception_status}}" which will render
class="color_3" or class="color_1" and then use CSS to style it. What does
cell render? Can you access reception_status from it as in {{
cell.reception_status }} and then use an if statement like this {%if
cell.reception_status
== 3%}{{cell}}{%endif%}
On 22/08/2014 6:19 am, "Jose Elvir"  wrote:

> I have a html table (django-tables2) based on a model
>
> class MasterTable(tables.Table):
>class Meta:
>model = Master
>fields = ("name","reception_date","reception_status","amount_files"
> )
>
>
> I need to change the color of some cell based in the value of others cell.
> Example :
> name will be red if reception_status is 3
> name will be green if reception_status is 1
> amount_files will be red if the value is less than 10
> amount_files will be green if the value is greater than 10
>
> This is my code to render the table in the template:
>
>  table.attrs.as_html }}{% endif %}>
> {% block table.thead %}
> 
> 
> {% for column in table.columns %}
> {{
> column.header }}
> {% endfor %}
> 
> 
> {% endblock table.thead %}
> {% block table.tbody %}
> 
> {% for row in table.page.object_list|default:table.rows %} {#
> support pagination #}
> {% block table.tbody.row %}
> 
> {% for column, cell in row.items %}
> {{ cell }}
> 
> {% endfor %}
> 
> {% endblock table.tbody.row %}
> {% empty %}
> {% if table.empty_text %}
> {% block table.tbody.empty_text %}
> {{
> table.empty_text }}
> {% endblock table.tbody.empty_text %}
> {% endif %}
> {% endfor %}
> 
> 
>
> I don't know how to evaluate the value of the cell to change the color of
> the others cells.
> Help please.
> 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/3b48345a-e929-4844-b845-313659a1d687%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHqTbj%3DpgPpgLS3ck%2ByPDfBWWgitaXLCYJL9Dd7KnWW8M7-Xgg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Problem 'duplicating' object instance

2014-08-21 Thread Mario Gudelj
I think you can use deepcopy.copy set the id none then save
On 22/08/2014 10:58 am, "luciusoso"  wrote:

> Hi everyone, as the title says i have a problem when trying to copy a
> model instance.
>
> Basically when i try in my tests to duplicate an object by setting its pk
> and id to None, i get nothing in return.
>
> class MyTest(TestCase):
> def setUp(self):
> u1 = User(username='user1', email='te...@test.com')
> u1.save()
> a1 = Account(full_name='Test1', user=u1)
> a1.save()
>
> def test_copy(self):
> account1 = Account.objects.all()[0]
> account1.pk = None
> account1.id = None
> account1.save()
> print Account.objects.all()
>
> >>>... 
>
> Am i wrong in thinking i should be getting 2 objects after setting the pk
> to none?
>
> --
> 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/c7b353bc-f4aa-4c4d-920d-408650c07d02%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHqTbjnn-piRAzbcgODQ7ShZe%2BP1yrKhP4qEREe2DmbQa5ZXyA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Question about email sending with Google Apps

2014-08-19 Thread Mario Gudelj
Using an email address as from address, which doesn't exist, may hurt your
deliverability. You can set it up and enable an auto responder which
informs the user that the inbox isn't monitored. But if you want the
delivery to fail then simply don't create it and use it as from email.
On 20/08/2014 7:16 am, "Chen Xu" <xuche...@gmail.com> wrote:

> I think  my expected behavior of an no-reply email is a "Delivery Failure"
> when people try to reply. Can google apps do it if I create no reply user.
>
>
> On Tue, Aug 19, 2014 at 6:49 AM, Mario Gudelj <mario.gud...@gmail.com>
> wrote:
>
>> Most likely. In a lot of cases someone will be scaning those even if it's
>> a no-reply address. At least that's been a case in companies I worked for,
>> but it depends how big you are and how much you like your customers. You
>> simply forward the mail to one or more people and filter it as it cook need
>> in them look over it occasionally
>> On 19/08/2014 8:42 pm, "Chen Xu" <xuche...@gmail.com> wrote:
>>
>>>  So does that mean when I see my registration confirmation email sent
>>> from no-re...@exmaple.com or supp...@example.com, they literally
>>> created the  user no-reply or support for the type of purpose?
>>>
>>> Thanks
>>>
>>>
>>> On Tue, Aug 19, 2014 at 6:37 AM, Mario Gudelj <mario.gud...@gmail.com>
>>> wrote:
>>>
>>>> Every email account will have a username and password. Unless it's an
>>>> alias, in which case you can't use it. Sounds like you've set up an alias
>>>> here. You can still use it as a from email address, but can't use it to
>>>> authenticate with smtp
>>>> On 19/08/2014 6:13 pm, "Chen Xu" <xuche...@gmail.com> wrote:
>>>>
>>>>>  Hi Everyone,
>>>>> I just setup google apps to use gmail with my own domain "example.com",
>>>>> and I want to use django send_mail to send emails from
>>>>> supp...@example.com, which might be for registration message,
>>>>> something like that. However, when I create the group in google apps,
>>>>> supp...@example.com will not have a password, but send_mail function
>>>>> requires an authentication. I wonder how this is usually done.
>>>>>
>>>>>
>>>>> Thanks
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> ⚡ Chen Xu ⚡
>>>>>
>>>>> --
>>>>> 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 http://groups.google.com/group/django-users.
>>>>> To view this discussion on the web visit
>>>>> https://groups.google.com/d/msgid/django-users/CACac-qbQL2PMNV-pRZ4Sq5N3MnrvZg4s%3DFcxYRX9L9fo7sykKQ%40mail.gmail.com
>>>>> <https://groups.google.com/d/msgid/django-users/CACac-qbQL2PMNV-pRZ4Sq5N3MnrvZg4s%3DFcxYRX9L9fo7sykKQ%40mail.gmail.com?utm_medium=email_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 http://groups.google.com/group/django-users.
>>>> To view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/django-users/CAHqTbjkZUVHc6M0WvruT_xA9Raw2V9-gUu4qxGTKOcSX_-0s5Q%40mail.gmail.com
>>>> <https://groups.google.com/d/msgid/django-users/CAHqTbjkZUVHc6M0WvruT_xA9Raw2V9-gUu4qxGTKOcSX_-0s5Q%40mail.gmail.com?utm_medium=email_source=footer>
>>>> .
>>>>
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>>
>>>
>>> --
>>> ⚡ Chen Xu ⚡
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe fr

Re: Question on creating a contact form app using bootstrap template

2014-08-19 Thread Mario Gudelj
Some other options:

- Install https://github.com/dyve/django-bootstrap-toolkit and use {{
form|as_bootstrap }}. See the docs for more options.

- http://django-crispy-forms.readthedocs.org/en/latest/ Crispy Forms is
amazing BTW (by the way)

- Render your labels with {{form.field_name.label}} and fields with
{{form.field_name}} and errors with {{form.field_name.errors}} inside that
boostrap markup. You'll have to do this individually for every field
though. As for the attributes, such as placeholder, classes and data
attributes, you have to pass the to the widget class inside attr={}

Cheers,

M





On 19 August 2014 20:15, Martin Spasov  wrote:

> Maybe you could copy the classes and id's from the template and put them
> in your form like this :
>
> class  SomeForm(forms.Form):
> name=forms.CharField(attrs={'class':'form-control', 'id':'name'})
> message=forms.CharField(widget=forms.TextInput(attrs={'class':'the
> class name thats on the templates form for the text input'})
>
> And then pass the SomeForm to the view as some context variable, for
> example 'form'.
> In your template :
>   novalidate>
> 
>{%for field in form%}
>{{field.label}} {{field}}
>{%endfor%}
> Send Message
>  
>
> This is just advice from beginner to beginner and if there is an easier
> way please correct me! If you choose this way Kim and you don't understand
> something please ask!
>
> On Tuesday, August 19, 2014 9:36:55 AM UTC+2, Kim wrote:
>>
>> Thank you for the advice, Collin!
>> However, If I have this HTML below, where should I put {{ form.[name] }}?
>>
>>  > novalidate>
>> 
>> > class="form-control" placeholder="Your Name *" id="name" required
>> data-validation-required-message="Please enter your name.">
>> 
>> 
>> Send Message
>>  
>>
>> 2014年8月19日火曜日 10時42分19秒 UTC+9 Collin Anderson:
>>>
>>> I recommend making the same contact form in django first, then merge the
>>> two. Your starter template only makes the form look good, it doesn't
>>> provide much functionality.
>>>
>>  --
> 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/c25c646e-bbc2-44c5-a4d4-fe36296c9b88%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHqTbjkgxCVe5buPNj-e0h4okhNkvFO6DZbcW_pRiOC1DXW9Uw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Question about email sending with Google Apps

2014-08-19 Thread Mario Gudelj
Most likely. In a lot of cases someone will be scaning those even if it's a
no-reply address. At least that's been a case in companies I worked for,
but it depends how big you are and how much you like your customers. You
simply forward the mail to one or more people and filter it as it cook need
in them look over it occasionally
On 19/08/2014 8:42 pm, "Chen Xu" <xuche...@gmail.com> wrote:

> So does that mean when I see my registration confirmation email sent from
> no-re...@exmaple.com or supp...@example.com, they literally created the
>  user no-reply or support for the type of purpose?
>
> Thanks
>
>
> On Tue, Aug 19, 2014 at 6:37 AM, Mario Gudelj <mario.gud...@gmail.com>
> wrote:
>
>> Every email account will have a username and password. Unless it's an
>> alias, in which case you can't use it. Sounds like you've set up an alias
>> here. You can still use it as a from email address, but can't use it to
>> authenticate with smtp
>> On 19/08/2014 6:13 pm, "Chen Xu" <xuche...@gmail.com> wrote:
>>
>>>  Hi Everyone,
>>> I just setup google apps to use gmail with my own domain "example.com",
>>> and I want to use django send_mail to send emails from
>>> supp...@example.com, which might be for registration message, something
>>> like that. However, when I create the group in google apps,
>>> supp...@example.com will not have a password, but send_mail function
>>> requires an authentication. I wonder how this is usually done.
>>>
>>>
>>> Thanks
>>>
>>>
>>>
>>> --
>>> ⚡ Chen Xu ⚡
>>>
>>> --
>>> 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 http://groups.google.com/group/django-users.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CACac-qbQL2PMNV-pRZ4Sq5N3MnrvZg4s%3DFcxYRX9L9fo7sykKQ%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/django-users/CACac-qbQL2PMNV-pRZ4Sq5N3MnrvZg4s%3DFcxYRX9L9fo7sykKQ%40mail.gmail.com?utm_medium=email_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 http://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAHqTbjkZUVHc6M0WvruT_xA9Raw2V9-gUu4qxGTKOcSX_-0s5Q%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAHqTbjkZUVHc6M0WvruT_xA9Raw2V9-gUu4qxGTKOcSX_-0s5Q%40mail.gmail.com?utm_medium=email_source=footer>
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
> ⚡ Chen Xu ⚡
>
> --
> 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CACac-qa%3DNgEDcDZ92Dw_g2%2BbtBsoKaJan11_G9Ex9hPQcnGB%2BA%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CACac-qa%3DNgEDcDZ92Dw_g2%2BbtBsoKaJan11_G9Ex9hPQcnGB%2BA%40mail.gmail.com?utm_medium=email_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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHqTbj%3DiJCen3H3uzeb2YYovDpYHOEqZ2wm2vaeoQD6CnPy9Xw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Question about email sending with Google Apps

2014-08-19 Thread Mario Gudelj
Every email account will have a username and password. Unless it's an
alias, in which case you can't use it. Sounds like you've set up an alias
here. You can still use it as a from email address, but can't use it to
authenticate with smtp
On 19/08/2014 6:13 pm, "Chen Xu"  wrote:

> Hi Everyone,
> I just setup google apps to use gmail with my own domain "example.com",
> and I want to use django send_mail to send emails from supp...@example.com,
> which might be for registration message, something like that. However, when
> I create the group in google apps, supp...@example.com will not have a
> password, but send_mail function requires an authentication. I wonder how
> this is usually done.
>
>
> Thanks
>
>
>
> --
> ⚡ Chen Xu ⚡
>
> --
> 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CACac-qbQL2PMNV-pRZ4Sq5N3MnrvZg4s%3DFcxYRX9L9fo7sykKQ%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHqTbjkZUVHc6M0WvruT_xA9Raw2V9-gUu4qxGTKOcSX_-0s5Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: images umpload prob

2014-07-29 Thread Mario Gudelj
Use the url it gives you inside src attribute inside img tag.
On 30/07/2014 1:19 pm, "ngangsia akumbo"  wrote:

> i have the following
>
> MODEL
>
> from django.db import models
>
> class Timer(models.Model):
> title = models.CharField(max_length=100)
> slug = models.SlugField(unique=True)
> image2 = models.ImageField(upload_to='image2/')
> last_seen = models.IntegerField()
>
> def __unicode__(self):
> return self.title
>
>
> URLS
> from django.conf.urls import patterns, include, url
>
>
> from django.contrib import admin
> admin.autodiscover()
>
> urlpatterns = patterns('',
>  url(r'^testp/', include('testp.urls')),
>
>  url(r'^admin/', include(admin.site.urls)),
> )
>
> TESTP/URLS
>
> from django.conf.urls import patterns, url
>
> from django.conf import settings
> from django.conf.urls.static import static
>
>
> from testp import views
>
> urlpatterns = patterns('',
> # ex: /testp/
> url(r'^$', views.timers, name='timers'),
> # ex: /test/5/
> url(r'^(?P\d+)/$', views.timers_detail,
> name='timers_detail'),
> )+ static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
>
>
> SETTING
> # Example: "/home/media/media.lawrence.com/media/"
> MEDIA_ROOT =
> 'C:/Python27/Scripts/mysite0/Django-1.5/djang/bin/test0/image2/'
>
> # URL that handles the media served from MEDIA_ROOT. Make sure to use a
> # trailing slash.
> # Examples: "http://media.lawrence.com/media/;, "http://example.com/media/
> "
> MEDIA_URL = '/media/'
>
> # Absolute path to the directory static files should be collected to.
> # Don't put anything in this directory yourself; store your static files
> # in apps' "static/" subdirectories and in STATICFILES_DIRS.
> # Example: "/home/media/media.lawrence.com/static/"
> STATIC_ROOT =
> 'C:/Python27/Scripts/mysite0/Django-1.5/djang/bin/test0/image2/static/'
>
> # URL prefix for static files.
> # Example: "http://media.lawrence.com/static/;
> STATIC_URL = '/static/'
>
> # Additional locations of static files
> STATICFILES_DIRS = (
> 'C:/Python27/Scripts/mysite0/Django-1.5/djang/bin/test0/static/'
>
> TEMPLATE
>
> {{ tis.image2.url}}
>
> WHEN I DISPLAY THE IMAGE IT GIVE ME THE LINK INSTEAD ON THE BROWSER
>
> /media/image2/Desert.jpg
>
> WHERE AM I WRONG
>
> Am using django 1.5
>
> --
> 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/1f016aef-903b-49f0-9641-c1b0bce98fa6%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHqTbjnTz1wKLAWOiTHtoVDzzv4CnjRShLuaq6PEWyakMAhivQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Official tutorial part 4

2014-07-26 Thread Mario Gudelj
Please post the url for your detail view.
On 26/07/2014 2:42 pm, "Juliano Resende"  wrote:

> Hi,
>
> i have a problem in part 4 of official django tutorial, somebody can help
> me?
>
> Error:
>
> *Reverse for 'polls.detail' with arguments '(4,)' and keyword arguments '{}' 
> not found. 0 pattern(s) tried: []*
>
> Index.html (template)
>
> {% if latest_poll_list %}
>   
>   {% for poll in latest_poll_list %}
>*http://poll.id> 
> %}">{{ poll.question }}*
>   {% endfor %}
>   
> {% else %}
>   No polls are available.
> {% endif %}
>
> views.py (polls)
>
> from django.shortcuts import render, get_object_or_404
> from django.http import HttpResponse
> from polls.models import Poll
> # Create your views here.
> def index(request):
> latest_poll_list = Poll.objects.order_by('-pub_date')[:5]
> context = {'latest_poll_list':latest_poll_list}
> return render(request, 'polls/index.html',context)
> def detail(request,poll_id):
> poll = get_object_or_404(Poll,pk=poll_id)
> return render(request, 'polls/detail.html',{'poll':poll})
> def results(request,poll_id):
> return HttpResponse("You're looking at results of poll %s." % poll_id)
> def vote(request,poll_id):
> return HttpResponse("You're voting on poll %s." % poll_id)
>
>
> urls.py (mysite)
>
> from django.conf.urls import patterns, include, url
>
> from django.contrib import admin
> admin.autodiscover()
>
> urlpatterns = patterns('',
> # Examples:
> # url(r'^$', 'app.views.home', name='home'),
> # url(r'^blog/', include('blog.urls')),
> url(r'^polls/', include('polls.urls', namespace="polls")),
> url(r'^admin/', include(admin.site.urls)),
> )
>
> Thanks for any 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/8b3cd25c-ef81-4c1d-afba-8d70cd3fdb2e%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHqTbjnzz1GHEHhza1H79PxoHUEUSAuu52MDFV-5u0-%2B%3DikRtA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: psycopg2

2014-07-24 Thread Mario Gudelj
In
http://stackoverflow.com/questions/20789063/get-fatal-error-when-install-psycopg2
OP mentions that "Just installed python 3.4 and assumed python3-dev would
suffice. Nope. Had to do python3.4-dev. "

Perhaps you need to do the same thing...



On 25 July 2014 10:29, Henrique Oliveira <henriqueollive...@gmail.com>
wrote:

> Hi Mario,
>
> I already installed python-dev
> On Jul 24, 2014 9:11 PM, "Mario Gudelj" <mario.gud...@gmail.com> wrote:
>
>> Install this first:
>>
>> sudo apt-get install python-dev
>>
>> Then try installing that package again.
>>
>>
>> On 25 July 2014 09:55, Henrique Oliveira <henriqueollive...@gmail.com>
>> wrote:
>>
>>>
>>>
>>>
>>>
>>>
>>> *Hi All,I am trying to install psycopg2 but I am getting this error:*I
>>> already installed python3-dev and libpq-dev Any idea?*
>>>
>>> Downloading/unpacking psycopg2
>>>   Downloading psycopg2-2.5.3.tar.gz (690kB): 690kB downloaded
>>>   Running setup.py (path:/opt/d/build/psycopg2/setup.py) egg_info for
>>> package psycopg2
>>>
>>> Installing collected packages: psycopg2
>>>   Running setup.py install for psycopg2
>>> Skipping implicit fixer: buffer
>>> Skipping implicit fixer: idioms
>>> Skipping implicit fixer: set_literal
>>> Skipping implicit fixer: ws_comma
>>> building 'psycopg2._psycopg' extension
>>> gcc -pthread -Wno-unused-result -DNDEBUG -g -fwrapv -O2 -Wall
>>> -Wstrict-prototypes -g -O2 -fstack-protector --param=ssp-buffer-size=4
>>> -Wformat -Werror=format-security -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1
>>> -DPSYCOPG_VERSION="2.5.3 (dt dec pq3 ext)" -DPSYCOPG_EXTENSIONS=1
>>> -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -DPG_VERSION_HEX=0x090304
>>> -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1
>>> -I/usr/include/python3.3m -I. -I/usr/include/postgresql
>>> -I/usr/include/postgresql/9.3/server -c psycopg/psycopgmodule.c -o
>>> build/temp.linux-x86_64-3.3/psycopg/psycopgmodule.o
>>> -Wdeclaration-after-statement
>>> In file included from psycopg/psycopgmodule.c:27:0:
>>> ./psycopg/psycopg.h:30:20: fatal error: Python.h: No such file or
>>> directory
>>>  #include 
>>> ^
>>> compilation terminated.
>>> error: command 'gcc' failed with exit status 1
>>> Complete output from command /opt/d/bin/python3.3 -c "import
>>> setuptools,
>>> tokenize;__file__='/opt/d/build/psycopg2/setup.py';exec(compile(getattr(tokenize,
>>> 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))"
>>> install --record /tmp/pip-on_knf-record/install-record.txt
>>> --single-version-externally-managed --compile --install-headers
>>> /opt/d/include/site/python3.3:
>>> running install
>>>
>>> running build
>>>
>>> running build_py
>>>
>>> creating build
>>>
>>> creating build/lib.linux-x86_64-3.3
>>>
>>> creating build/lib.linux-x86_64-3.3/psycopg2
>>>
>>> copying lib/extensions.py -> build/lib.linux-x86_64-3.3/psycopg2
>>>
>>> copying lib/extras.py -> build/lib.linux-x86_64-3.3/psycopg2
>>>
>>> copying lib/__init__.py -> build/lib.linux-x86_64-3.3/psycopg2
>>>
>>> copying lib/_range.py -> build/lib.linux-x86_64-3.3/psycopg2
>>>
>>> copying lib/psycopg1.py -> build/lib.linux-x86_64-3.3/psycopg2
>>>
>>> copying lib/_json.py -> build/lib.linux-x86_64-3.3/psycopg2
>>>
>>> copying lib/errorcodes.py -> build/lib.linux-x86_64-3.3/psycopg2
>>>
>>> copying lib/pool.py -> build/lib.linux-x86_64-3.3/psycopg2
>>>
>>> copying lib/tz.py -> build/lib.linux-x86_64-3.3/psycopg2
>>>
>>> creating build/lib.linux-x86_64-3.3/psycopg2/tests
>>>
>>> copying tests/test_types_extras.py ->
>>> build/lib.linux-x86_64-3.3/psycopg2/tests
>>>
>>> copying tests/test_bugX000.py ->
>>> build/lib.linux-x86_64-3.3/psycopg2/tests
>>>
>>> copying tests/test_async.py -> build/lib.linux-x86_64-3.3/psycopg2/tests
>>>
>>> copying tests/testconfig.py -> build/lib.linux-x86_64-3.3/psycopg2/tests
>>>
>>> copying tests/test_module.py -> build/lib.linux-x86_64-3.3/psycopg2/tests
>>>
>>> copying tests/test_with.py -> build/lib.linux-

Re: psycopg2

2014-07-24 Thread Mario Gudelj
Install this first:

sudo apt-get install python-dev

Then try installing that package again.


On 25 July 2014 09:55, Henrique Oliveira 
wrote:

>
>
>
>
>
> *Hi All,I am trying to install psycopg2 but I am getting this error:*I
> already installed python3-dev and libpq-devAny idea?*
>
> Downloading/unpacking psycopg2
>   Downloading psycopg2-2.5.3.tar.gz (690kB): 690kB downloaded
>   Running setup.py (path:/opt/d/build/psycopg2/setup.py) egg_info for
> package psycopg2
>
> Installing collected packages: psycopg2
>   Running setup.py install for psycopg2
> Skipping implicit fixer: buffer
> Skipping implicit fixer: idioms
> Skipping implicit fixer: set_literal
> Skipping implicit fixer: ws_comma
> building 'psycopg2._psycopg' extension
> gcc -pthread -Wno-unused-result -DNDEBUG -g -fwrapv -O2 -Wall
> -Wstrict-prototypes -g -O2 -fstack-protector --param=ssp-buffer-size=4
> -Wformat -Werror=format-security -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1
> -DPSYCOPG_VERSION="2.5.3 (dt dec pq3 ext)" -DPSYCOPG_EXTENSIONS=1
> -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -DPG_VERSION_HEX=0x090304
> -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1
> -I/usr/include/python3.3m -I. -I/usr/include/postgresql
> -I/usr/include/postgresql/9.3/server -c psycopg/psycopgmodule.c -o
> build/temp.linux-x86_64-3.3/psycopg/psycopgmodule.o
> -Wdeclaration-after-statement
> In file included from psycopg/psycopgmodule.c:27:0:
> ./psycopg/psycopg.h:30:20: fatal error: Python.h: No such file or
> directory
>  #include 
> ^
> compilation terminated.
> error: command 'gcc' failed with exit status 1
> Complete output from command /opt/d/bin/python3.3 -c "import
> setuptools,
> tokenize;__file__='/opt/d/build/psycopg2/setup.py';exec(compile(getattr(tokenize,
> 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))"
> install --record /tmp/pip-on_knf-record/install-record.txt
> --single-version-externally-managed --compile --install-headers
> /opt/d/include/site/python3.3:
> running install
>
> running build
>
> running build_py
>
> creating build
>
> creating build/lib.linux-x86_64-3.3
>
> creating build/lib.linux-x86_64-3.3/psycopg2
>
> copying lib/extensions.py -> build/lib.linux-x86_64-3.3/psycopg2
>
> copying lib/extras.py -> build/lib.linux-x86_64-3.3/psycopg2
>
> copying lib/__init__.py -> build/lib.linux-x86_64-3.3/psycopg2
>
> copying lib/_range.py -> build/lib.linux-x86_64-3.3/psycopg2
>
> copying lib/psycopg1.py -> build/lib.linux-x86_64-3.3/psycopg2
>
> copying lib/_json.py -> build/lib.linux-x86_64-3.3/psycopg2
>
> copying lib/errorcodes.py -> build/lib.linux-x86_64-3.3/psycopg2
>
> copying lib/pool.py -> build/lib.linux-x86_64-3.3/psycopg2
>
> copying lib/tz.py -> build/lib.linux-x86_64-3.3/psycopg2
>
> creating build/lib.linux-x86_64-3.3/psycopg2/tests
>
> copying tests/test_types_extras.py ->
> build/lib.linux-x86_64-3.3/psycopg2/tests
>
> copying tests/test_bugX000.py -> build/lib.linux-x86_64-3.3/psycopg2/tests
>
> copying tests/test_async.py -> build/lib.linux-x86_64-3.3/psycopg2/tests
>
> copying tests/testconfig.py -> build/lib.linux-x86_64-3.3/psycopg2/tests
>
> copying tests/test_module.py -> build/lib.linux-x86_64-3.3/psycopg2/tests
>
> copying tests/test_with.py -> build/lib.linux-x86_64-3.3/psycopg2/tests
>
> copying tests/test_quote.py -> build/lib.linux-x86_64-3.3/psycopg2/tests
>
> copying tests/test_cursor.py -> build/lib.linux-x86_64-3.3/psycopg2/tests
>
> copying tests/test_cancel.py -> build/lib.linux-x86_64-3.3/psycopg2/tests
>
> copying tests/test_transaction.py ->
> build/lib.linux-x86_64-3.3/psycopg2/tests
>
> copying tests/__init__.py -> build/lib.linux-x86_64-3.3/psycopg2/tests
>
> copying tests/test_connection.py ->
> build/lib.linux-x86_64-3.3/psycopg2/tests
>
> copying tests/test_notify.py -> build/lib.linux-x86_64-3.3/psycopg2/tests
>
> copying tests/test_copy.py -> build/lib.linux-x86_64-3.3/psycopg2/tests
>
> copying tests/test_bug_gc.py -> build/lib.linux-x86_64-3.3/psycopg2/tests
>
> copying tests/test_green.py -> build/lib.linux-x86_64-3.3/psycopg2/tests
>
> copying tests/dbapi20_tpc.py -> build/lib.linux-x86_64-3.3/psycopg2/tests
>
> copying tests/test_types_basic.py ->
> build/lib.linux-x86_64-3.3/psycopg2/tests
>
> copying tests/test_extras_dictcursor.py ->
> build/lib.linux-x86_64-3.3/psycopg2/tests
>
> copying tests/test_psycopg2_dbapi20.py ->
> build/lib.linux-x86_64-3.3/psycopg2/tests
>
> copying tests/test_lobject.py -> build/lib.linux-x86_64-3.3/psycopg2/tests
>
> copying tests/test_dates.py -> build/lib.linux-x86_64-3.3/psycopg2/tests
>
> copying tests/dbapi20.py -> build/lib.linux-x86_64-3.3/psycopg2/tests
>
> copying tests/testutils.py -> build/lib.linux-x86_64-3.3/psycopg2/tests
>
> Skipping implicit fixer: buffer
>
> Skipping implicit fixer: idioms
>
> Skipping implicit fixer: set_literal
>
> Skipping implicit fixer: ws_comma
>
> running build_ext
>
> 

Re: Introducing myself and my first question

2014-07-21 Thread Mario Gudelj
Hey Martin,

I can guarantee you that PyCharm is totally worth buying. It will speed up
your development drastically and it works really well with Django.
Autocompletion both in Python and template code, syntax highlighting in
both, easy Option+Enter imports, navigation through code, refactoring. You
name it has it. Just the merge tool is worth those $99.

Cheers,

M


On 22 July 2014 07:37, Martin Torre Castro  wrote:

> Thanks to you also, Chen, I read you the last, but not least. I looked at
> PyCharm's price but it seemed expensive for buying for being used by two
> people at developing.
>
> I take care of the 'pip freeze' tip. :-)
>
>
> On Sunday, 20 July 2014 03:48:37 UTC+2, Edward Chen wrote:
>
>> Hi - I am kind of new myself, and I don't have all the answers to your
>> questions, but here are some thoughts, and I could be wrong.
>>
>> 1.  You can set up your virtualenv anywhere you like.  The one I'm using
>> right now is in ~/Envs/venv_for_my_project/  All you're doing with it is
>> source/bin/activate.  As Two Scoops of Django recommends, just store the
>> output of pip freeze in version control.
>>
>> 2. I am not using Eclipse, so I can't help there.  I am using PyCharm
>> which has a nice integration with virtualenv and Django.  It's easy to
>> start the server in debugging mode and set break points.  With Pycharm, I
>> set it up once, pointing it to the location of my virtualenv, and haven't
>> touched it since, even though I've added packages to my virtualenv.  The
>> downside of PyCharm is that it costs money.
>>
>> 3. I don't think you can screw things up too much.  You may want to first
>> do as much as possible via the command line in a terminal window and see if
>> that works (for example, start and stop the server), then try the same
>> thing through Eclipse's interface.  The worst that can happen is that your
>> test server doesn't work.
>>
>>
>>
>>
>> On Sat, Jul 19, 2014 at 3:09 PM, Martin Torre Castro 
>> wrote:
>>
>>> Hello,
>>>
>>> my name is Martin and I'm a computer engineer from Spain. I'm going to
>>> start a new project with a colleague and I decided to use Django because we
>>> searched for free opensource tools and I'm in love with Python.
>>>
>>> We have made a couple of tutorials (the official one and "Tango with
>>> django"). I've also bought the book "Two scoops of Django" for the 1.6
>>> Django edition. We're starting the project soon as well as we finish the
>>> design, but I'm concerned about setting up the new environment. We're
>>> thinking of using:
>>>
>>>
>>>- postgresql
>>>- Python/Django [ of course ;-) ]
>>>- Eclipse/Pydev
>>>- Git
>>>- jQuery
>>>
>>> I've been reading the Greenfield/Roy book and some web sites and I want
>>> to set up the environment with good practices by using virtualenvwrapper,
>>> virtualenv, pip, the requirements.txt files and so on.
>>> I have made some mix for all this, but I would be grateful if someone
>>> could confirm us if we are on the right way, give us some advice or maybe
>>> tell us where on the internet we can find a good way of doing all this.
>>>
>>> My preview for the whole setting up is next:
>>>
>>>
>>>1. We should start the installations by installing "sudo apt-get
>>>install virtualenvwrapper" . If I understand correctly, this
>>>installs virtualenv as well as an embedded pip.
>>>2. The virtualenv must be created ("virtualenv env") in the parent
>>>directory of the Eclipse workspace, I suppose. This is one point of
>>>confusion to me. I don't know either if I have to activate this every 
>>> time
>>>I come back for developing resuming the work from days before. I 
>>> completely
>>>understand that later from Eclipse I will give the python path inside the
>>>virtualenv, but don't know if must activate the virtualenv every
>>>time.
>>>3. Next step would be to install all the things we need (django,
>>>pillow, psycopg2) using a requirements.txt file. "pip install -r
>>>requirements.txt"
>>>4. We should create the new django project with a python
>>>django-admin.py startproject 
>>>5. Now I don't know if we should link the project to an already
>>>installed version of Eclipse or run the "git init" first. I
>>>understand that Eclipse and Git don't need to be installed inside the
>>>virtualenv. In fact, I've been reading and it seems that Eclipse can work
>>>OK just by being given the path inside the virtualenv where the python
>>>executable is located. I've also read that some people used to make
>>>different workspaces, but configuring the paths should be enough
>>>http://stackoverflow.com/questions/1145374/virtualenv-with-eclipse-
>>>galileo
>>>
>>> 
>>>
>>> From here I would just upload to github or bitbucket, maybe doing the
>>> whole thing from Eclipse would be easier. But the integration 

Re: django beginner

2014-07-10 Thread Mario Gudelj
You mentioned that you haven't completed a tutorial. You should because
this stuff is in it. Your questions are too broad and covered in docs and
other material on the web. Google is your bro :)
On 10/07/2014 5:52 pm, "ngangsia akumbo"  wrote:

> it is not working thanks bro
>
>
>
>
> i have one more question.
> I have created a series of apps for my project. like services, contact,
> news ,booking app for my hotel site.
> i created their individual individual templates for each of them and
> extended it to the base.html, they are all working fine.
>
> my probe now is how do i feature all of these feature on a single page cos
> all the apps are opening individually using thei various urls?
>
> How do i place these seperate apps on a single web page ? how do i
> introduce design patterns on them ?
>
> how do i deploy it so that even a client can views the already finished
> site from his desk or office, just by typing the name of the site and
> getting in to the webiste?
>
>
> thanks for the reply
>
>
> booking app
>>>
   --
> 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/d5496b23-7d39-46fa-9b48-5b25ca9ebd0f%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHqTbjk70yY7Kc3JA7TNr3-jXh79MMAjwq370zyC-DME1uYqjQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to making a query which filtters objects having a Null field

2014-07-06 Thread Mario Gudelj
something__null=True
On 07/07/2014 6:31 am, "Utkarsh Dixit"  wrote:

> I have a datetime field in my model. Initially when an object is created
> of this model the datetime field is set as NULL (I've defined Null=True and
> blank=True)
>
> Now I want to change make a query which filters all the objects having
> Null in this field.. and changing their datetime to current datetime. The
> latter part I can manage (using python code), but Is it possible to make
> such queries such as modelName.objects.field(date = "") ??
>
> --
> 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/aa74e02d-0b67-4661-9ff9-113217bc7d11%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHqTbjnNGAKbkThZt5_ZUSXiXN3%3DorqW7djOiFn07Fr9f49fxQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Creating subusers

2014-07-01 Thread Mario Gudelj
Hey Jorge,

I think you should extend the Abstract User instead of doing it the old
way, which is creating that OneToOne relationship with a custom model. So,
you'll end up with this:

class IndependentAgent(AbstractBaseUser, PermissionsMixin):
tipo_licencia = models.CharField(max_lenght=140)

class AgencyUser(AbstractBaseUser, PermissionsMixin):
agency = models.ForeignKey(User, related_name='Agency')

This way you'll inherit all those awesome methods like setting the password
etc. and attributes, like is_admin, but you can also simply add your own
and dealing with this is much easier, than having to get the profile etc.

Cheers,

M



On 2 July 2014 12:20, Jorge Andrés Vergara Ebratt 
wrote:

> Hello everyone,
>
> I'm trying to create a system that has 3 different user types:
>
> Independent Agent, that basically is what it sounds like, and Django's
> User Model works fine for this one.
>
> But the catch comes from the other 2, because it also needs to support
> agencies and agencies have sub-users...
>
> I'm trying to figure out the best way to do this, currently I'm trying
> with User profiles but don't really know if what I'm doing is correct, I'm
> doing this:
>
>
> class IndependentAgent(models.Model):
> user = models.OneToOneField(User)
> tipo_licencia = models.CharField(max_lenght=140)
>
>
> class AgencyUser(models.Model):
> user = models.OneToOneField(User)
> agency = models.ForeignKey(User, related_name='Agency')
>
>
> Can I do this? Like that user profile for Agency User would let me 'asign'
> those users to their respective agencies so that later I can set my code
> that those users can only see that agency's information?
>
> Or would making groups be better to handle this kind of situations?
>
> Appreciate any help I can get, thanks in advance
>
>
> --
> *Jorge Andres Vergara Ebratt*
> *#SoftwareDeveloper (Or at least trying to be)*
> *@javebratt*
> *facebook.com/javebratt *
>
> --
> 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAAeX05Gc6gnjdDi%3Dv%2B-n72mSi1JWdO1ecYUQORogvMifAw5o7w%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHqTbjmarOEX%2BJCPkTqyZq7YavkbdjQkmUPhjFeQS%3D5Ecetccg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: django user authenication form in modal form twitter bootstrap

2014-06-27 Thread Mario Gudelj
Sounds like you have a js issue now. Have a look inside chrome console for
any errors and fix them. Modal not coming up wouldn't be a django issue.
On 28/06/2014 5:41 am, "sarfaraz ahmed"  wrote:

> Hello,
>
> You were absolutely right.. the function was wrong. Please help me sort
> out that.. as this your suggestion took me one step close to fix this
> issue.
>
> Now the scenario is like this
> *views.py *has this function to render my login.html
> --
> @csrf_protect
> def login(request):
> #c={}
> #c.update(csrf(request))
> print 'step2'
> return render_to_response('login.html',{},RequestContext(request))
>
> -
>
> base.html has include statement to include login.html and login.html has
> following code
>
>
>  aria-labelledby="myModalLabel" aria-hidden="true">
> 
> 
> 
>  data-dismiss="modal"> class="sr-only">Close
> Modal
> title
> 
> 
>  method='post'>{%csrf_token%}
> User Name:
>  id="username">
> Password:
>  id="password">
> 
> 
> 
> 
>  data-dismiss="modal">Close
> Save
> changes
> 
> 
> 
> 
>
> When I click on link which has following code
>   >Login
>
> Nothing happens...the modal does not open...
>
> When I manually go to link : accounts/login i can see the form with any
> formatting and also can see csrf token.
>
> Desperately looking for help
>
> Regards,
> Sarfaraz Ahmed
>
>
>
>
> On Fri, Jun 27, 2014 at 12:34 PM, sarfaraz ahmed 
> wrote:
>
>> Hello Roman,
>>
>> Thanks for response. Tried what you suggested me. The modal does not even
>> pop up if I used the code mentioned in your reply.
>>
>> Regards,
>> Sarfaraz Ahmed
>>
>>
>> On Fri, Jun 27, 2014 at 12:09 PM, Roman Klesel 
>> wrote:
>>
>>> I think the view function is wrong.
>>>
>>> This should do:
>>>
>>> from django.views.decorators.csrf import csrf_protect
>>> from django.shortcuts impor render
>>>
>>> @csrf_protect
>>> def login(request):
>>> return render(request, 'login.html')
>>>
>>>
>>> 2014-06-27 6:03 GMT+02:00 sarfaraz ahmed :
>>> > Hello
>>> >
>>> > I am new to django I am trying to use modal (bootstrap) for embed by
>>> login
>>> > form. I am using the following error. I have mentioned my code below
>>> and
>>> > tried lot of googling... still no use.
>>> >
>>> > Help
>>> >
>>> > Reason given for failure:
>>> >
>>> > CSRF token missing or incorrect.
>>> >
>>> >
>>> >
>>> >
>>> > Here is code in view.py
>>> >
>>> > from django.shortcuts import render_to_response
>>> > from django.http import HttpResponseRedirect
>>> > from django.contrib import auth
>>> > from django.core.context_processors import csrf
>>> > from django.template import RequestContext
>>> > from django.views.decorators.csrf import csrf_protect
>>> > from django.shortcuts import render
>>> >
>>> >
>>> >
>>> > @csrf_protect
>>> > def login(request):
>>> > c={}
>>> > c.update(csrf(request))
>>> > return
>>> >
>>> render_to_response('login.html',c,context_instance=RequestContext(request))
>>> >
>>> >
>>> >
>>> > I call the login.html via link in nav bar using
>>> >
>>> >  >> > data-target="#myModal">Login
>>> >
>>> > That is code for login.html which is modal included in my base.html
>>> >
>>> >
>>> > >> > aria-labelledby="myModalLabel" aria-hidden="true">
>>> > 
>>> > 
>>> > 
>>> > >> > data-dismiss="modal">>> > class="sr-only">Close
>>> > Modal
>>> title
>>> > 
>>> > 
>>> > {%
>>> csrf_token
>>> > %}
>>> > User Name:
>>> > >> > id="username">
>>> > Password:
>>> > >> > id="password">
>>> > 
>>> > 
>>> > 
>>> > 
>>> > >> > data-dismiss="modal">Close
>>> > Save
>>> > changes
>>> > 
>>> > 
>>> > 
>>> > 
>>> >
>>> > --
>>> > 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 http://groups.google.com/group/django-users.
>>> > To view this discussion on the web visit
>>> >
>>> https://groups.google.com/d/msgid/django-users/943e0bf4-ce4d-4ef5-ae45-57e86c36f367%40googlegroups.com
>>> .

Re: Django image upload not saving

2014-06-26 Thread Mario Gudelj
I always follow a similar pattern for media uploads and it works, so here
it is:

in settings.py

PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__))
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(PROJECT_ROOT, 'media')

in your model:

file = models.ImageField(upload_to='wiki')

say you upload "myfile.doc", it will end up in:

...your_project_path/media/wiki/myfile.doc

Then you just setup your nginx to serve from media folder.





On 27 June 2014 03:58, Bobby Gulshan  wrote:

> No errors when hitting upload. But the image doesn't appear where I have
> indicated it ought to. Put an absolute path in MEDIA_ROOT and referenced
> the same in (upload_to) param ImageField. Not sure what I am missing.
>
> Model:
>
> class FileUploadHandler(models.Model):
> title = models.CharField(max_length=100)
> file =
> models.ImageField(upload_to='/Python27/Lib/site-packages/django/bin/mideastinfo/wiki/static/')
>
> View:
>
> from models import Article, Edit
> from forms import ArticleForm, EditForm
> from forms import *
> from PIL import Image
> from models import FileUploadHandler
>
> def image_upload(request):
> if request.method == 'POST':
> form = UploadImageForm(request.POST, request.FILES)
> if form.is_valid():
> FileUploadHandler(request.FILES['image'])
> return render_to_response('wiki/gallery.html')
> else:
> form = UploadImageForm()
> return render_to_response('wiki/gallery.html',
> RequestContext(request, {'form': form}))
>
> --
> 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/29eff052-3181-4e0d-80fc-84fffe6ba029%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHqTbjmy4pSevANwSRu9pTjWDs5Cosu%3DZj1jxVCo3L5Unn7BOw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to store/model reachable data in django.

2014-06-25 Thread Mario Gudelj
You don't want to use a csv. Store them in a db table cell. Even if you
have a million entries you'll be surprised how quick it will be.
On 26/06/2014 12:45 am, "Subodh Nijsure"  wrote:

> Hello
>
> I have need to store data that can be graphed. Example I have mobile app
> that collects temperature every 30 seconds for say 5 min and uploads these
> samples via REST api to my database. I happen to be using django for
> visualization.
>
> Question I am pondering is what is the best way to store these values in
> database. Store each point as record in db or store csv file? Downside if
> trying to upload single point means lots of request to web site to upload
> data. Csv file means I can't graph across data collected over say one
> month.
>
> Any tips on how to manage graphable data within django?
>
> Subodh
>
> --
> 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CALr9Q3Z%3D9CJvuG0vvbBPBoX_RXHJYCnuRifQN4OKautOG6ruvA%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHqTbjk%2BzqpNKM8B6Wf%2BXYceD4zZAeYoobBMKFqBsB4ststevQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Static Analysis Tool

2014-06-23 Thread Mario Gudelj
PyCharm IDE does a lot of this stuff. It's great at pointing out bad code.
But you can try https://chris-lamb.co.uk/projects/django-lint which is a
wrapper around pylint


On 24 June 2014 10:19, Mayur Sharma  wrote:

> Hi,
>
> I am looking for industry level Django Static Analysis tools. Most of the
> commercial tools don't support Django like Checkmarx and Coverity. Which
> tools are recommended for it then ?
>
> Thanks,
> Mayur Sharma
>
> --
> 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/27e08deb-80ea-46d1-8edc-3494cd6c537c%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHqTbjkVjFoHB%3DtYBpmfaRfzFvSzMd2BiCEqnHDVdhdGX%3DwNUQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: how to add additional data to that submitted by the user in a django form

2014-06-23 Thread Mario Gudelj
Use commit=False when saving the form, add all the other attributes and
then call save(). E.g.

obj = form.save(commit=False)
obj.additional_stuff = additional
obj.save()

But some of that stuff such as creation date and time can be done
automatically at the model with auto_now=True


On 24 June 2014 01:28, Anurag Baidyanath  wrote:

> I am trying to create a form in which the user enter details like his
> email id and query.
>
> After the form is submitted i have to save the data that I get from the
> form along with some additional info such as userid , submitted date and
> time, etc into the database.
>
> What approach should be adopted for solving this problem?
>
> --
> 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/d0f67d83-3e85-4e94-8509-73d69fb6c60d%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHqTbjkhiiczuB4bwOf-EqeEKsB%2BJnEm%2BvSpsxviYoTayyPRUQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: OO in Django

2014-06-23 Thread Mario Gudelj
Ricardo is correct. But make sure you use abstract model for Customer in
this case. I use the AbstractUser a lot because in most cases the customers
need to be system users and have a log in etc.


On 24 June 2014 02:08, Ricardo Daniel Quiroga 
wrote:

> Hi
>  I think I would do as follows :P
>
> #models.py code
>
> class Customer(model.Model):
> ***
>
> class Transation(model.Model):
>  ***
>  customer = models.ForeignKey(Customer)
>
>
> class Person(Customer):
>   ***
>
> class Corporation(Customer):
>***
>
> *** you object atributes
>
>
> 2014-06-23 11:18 GMT-03:00 Eduardo Basílio  >:
>
>  Hello,
>> Can you help me on a question OO in Django?
>>
>> How the Transaction class can reference Person or Corporation?
>> * Customer is an abstract class
>>
>>  --
>> 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 http://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/26474e7c-f79e-416b-8569-9edb689dc191%40googlegroups.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
> 
> Ricardo Daniel Quiroga - L2Radamanthys
>
>Msn: l2radamant...@gmail.com
>ricardo_q...@hotmail.com
>
>Email: l2radamant...@gmail.com
>l2radamant...@saltalug.org.ar
>ricardoquiroga@gmail.com
>
>sitio Web: http://www.l2radamanthys.com.ar
>http://github.com/L2Radamanthys
>
>Facebook: http://es-la.facebook.com/L2Radamanthys
>Twitter:@l2Radamanthys
> -
>
> --
> 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAO2-wHa%3Da6%3Drz%3DXFoK%3DwCcqK8HPRhstDc3Mo2Dps0TpnNhgq2A%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHqTbj%3D7Os9AVbhqByPsY%2BEUT4BZFswP%3Db7m%2BkMepHJ1rtdZnA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django Login/Session Not Sticking

2014-06-05 Thread Mario Gudelj
I know this may sound silly but is there some kind of JavaScript code that
may be messing things up? Had a similar issue before and it was related to
JavaScript stupidity.
On 05/06/2014 10:39 pm, "Juergen Schackmann" 
wrote:

> - all app servers are running the same code with same settings.
> - DNS load balancing was never used
> - just did a htop, no unexpected or old processes
>
> Am Donnerstag, 5. Juni 2014 11:37:30 UTC+2 schrieb Erik Cederstrand:
>>
>> Den 04/06/2014 kl. 13.55 skrev Juergen Schackmann > >:
>>
>> > The production site is served via a load balancer and 8 application
>> servers. Even stranger: if I test the same code (with the same settings) on
>> a test server, that is not load balanced and basically has not traffic,
>> everything is working fine.
>>
>> Are you sure all app servers are running the same code? Same settings.py?
>> DNS load balancing you forgot about? Maybe you have some lingering app
>> server processes that were never shut down? Check the start date of all
>> WSGI processes to be sure.
>>
>> Erik
>>
>>
>> PS: You may have sweaty palms, but please don't triple post the same
>> question to the list.
>
>  --
> 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/593d1369-a6a2-4457-b911-952bb0576877%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHqTbjmozPpYzXij0sf21npjcUNBTm8fmkzm9q842_XFwwKUsQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Supervisor alternative on Python 3.3.2?

2014-06-05 Thread Mario Gudelj
You can use init instead.
On 06/06/2014 5:09 am, "Kwest Ambani"  wrote:

> Anyone know an alternative for Supervisor? I need something to keep
> Gunicorn running in the background. My server is running Python 3.3.2. with
> Nginx serving only static files.
>
> --
> 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/42356d62-79cd-415f-8890-f9a4a903deeb%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHqTbjng3K812YEBTn_78mi9ZgScjVfYA0PBg73GOcf27mgvXQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: saving an istance of an object then trying to save it and it does not save

2014-05-16 Thread Mario Gudelj
That should work. Do you get any errors?
On 16/05/2014 8:53 pm, "Coulson Thabo Kgathi"  wrote:

> if o get an object like this
>
> p = Plot.objects.get(plot_plot_identifier='123323423')
>
> then do
> p.selected=1
> p.save()
>
> this does not save dont know why.
> the is no where the field is being modified anywhy not even on the save
> methon of the Plot model and there are no signals modifying the field at
> all.
>
>
>  --
> 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/273762b5-35a0-44c3-825f-045e1a275cc7%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHqTbjkeuTY%3DGr23yoA2PtcetTZM%2B3zFP9mOfBxH50z0J%2BW7wg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django year month day

2014-05-13 Thread Mario Gudelj
Try  instead.


On 14 May 2014 13:26, hito koto  wrote:

> I'm also have the erroes
>
> Exception Type: NoReverseMatch  Exception Value:
>
> u'article.views.main year|add' is not a registered namespace
>
>
>
>
> 2014年5月14日水曜日 12時19分06秒 UTC+9 hito koto:
>
>> Hello,
>>
>> this time i have this the erroes: Please help me;
>>
>> Exception Type: NoReverseMatch  Exception Value:
>>
>> Reverse for 'article.views.month year month 'prev'' with arguments '()' and 
>> keyword arguments '{}' not found. 0 pattern(s) tried: []
>>
>>
>>
>>
>>  this is my the urls.py;
>>
>> url(r"^month/(?P\d+)/(?P\d+)/(prev|next)/$",
>> "article.views.month"),
>> url(r"^month/(?P\d+)/(?P\d+)/$", "article.views.month"),
>> url(r"^month/$", "article.views.month"),
>>
>> and this is my the template html:
>>
>> 
>> Prev
>> Next
>> 
>>
>> {{ mname }} {{ year }}
>>
>> 
>> 
>>
>> 
>> Mon
>> Tue
>> Wed
>> Thu
>> Fri
>> Sat
>> Sun
>> 
>>
>> {% for week in month_days %}
>> 
>> {% for day, entries, current in week %}
>>
>> 
>> > {% if day != 0 and not current %}"day"{% endif %}
>> {% if day != 0 and current %}"current"{% endif %}
>> {% if day != 0 %}
>> onClick="parent.location='{% url cal.views.day year month
>> day %}'"
>> onMouseOver="this.bgColor='#ee';"
>> onMouseOut="this.bgColor='white';"
>> {% endif %} >
>>
>> 
>> {% if day != 0 %}
>> {{ day }}
>> {% for entry in entries %}
>> 
>> {{ entry.creator }}: {{ entry.short|safe }}
>> {% endfor %}
>> {% endif %}
>> 
>> {% endfor %}
>> 
>> {% endfor %}
>> 
>>
>> 
>> 
>>
>>  --
> 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/eb79a5c7-81b4-4ec7-8b61-16f3a62202f7%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHqTbjk2AJp%3DQ5Ek9UDmucSt5qUT4yqQGYe-8e%2Bf5yuJRMTumQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How would you do this cleanly in Django (remembering the states of check boxes in multiple pages)

2014-05-09 Thread Mario Gudelj
So, you basically need a shopping cart. Use sessions.

Other option would be to store everything in cookies and use js to
manipulate the products.
On 08/05/2014 11:25 pm, "Chi-Cheong Weng"  wrote:

> Hi guys,
>
> I have been using Django for a little more than a year now, but I still
> cannot think of a clean way of achieving this:
>
> Let's say I have 1000 products in the db and I want to create a campaign
> to promote the products. I am displaying the products 100 items each time
> and each item has a check box. I want to be able to go back and forth
> between different pages to select products and then when I hit the submit
> button, the server will know what products I select.
>
> How would you do this? Will you use other technology stack such as ajax,
> jquery, etc?
>
> 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/3b7c61b7-647e-48c9-907a-3a52dad7c183%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHqTbjkh7GA3SrT5sygyRZkKNXD9VGJVz8XAWsYj3yd4UiUwKg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: About django round-up display function of time

2014-05-07 Thread Mario Gudelj
I assume you're using datetime object in which case you have a look at this
SO answer
http://stackoverflow.com/questions/3463930/how-to-round-the-minute-of-a-datetime-object-python


On 7 May 2014 17:55, hito koto  wrote:

> Hi , good afternoon!
>
> I want to the round-up display function of time, how do i can do it ,
> please help me!!
> (Django/Python)
>
> For example:
>
> 2, 09:30 minute = 09:40
> 09:15minute= 09:45
> 09:30minute= 10:00
> 09:31minute = 09:31
>
>
>  --
> 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/11430740-d840-4143-8c3a-67f0054bc92e%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHqTbjmE157YrhYJy3nURbp2vviM0VjL9nfAc16VuV8KDUDeYw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: where is base.html located?

2014-05-04 Thread Mario Gudelj
Usually in the same templates directory your publisher_list.html is in.
On 05/05/2014 2:28 pm, "Venkat Subbiah"  wrote:

> Trying to follow the generic views from this tuotorial. Where would be
> "base.html" be located.
>
> https://docs.djangoproject.com/en/1.6/topics/class-based-views/generic-display/
>
> publisher_list.html contains the line
>
> {% extends "base.html" %}
>
>
>
>  --
> 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/84c3db1c-dc1b-4d78-bb54-3f6b98a45339%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHqTbj%3Dud_X-Vt%3D0AeDTEKtgF%2BKG0vxsyr3bGq9OOZSA39PU9A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Python/Django based Enterprise framowrk

2014-05-01 Thread Mario Gudelj
You'll need to create your own admin in that case. For 90% of my projects
I've unfortunately had to do that. You can find a good admin console kit,
perhaps something based on bootstrap and use the components to create
whatever you want. I usually use one called Metronic.
On 01/05/2014 7:43 pm, "Kenan Bek"  wrote:

> *and full customisation of code/view (I think it should generate python
> codes rather than generate dynamic views)*
>
> I mean for example if we use Django's Admin it will generate Dynamic view
> and it is hard to customise it. I need something which will generate forms
> like Django Admin but with flexible customisation.
>
> On Thursday, May 1, 2014 1:32:14 PM UTC+5, Venkatraman.S. wrote:
>>
>>
>> On Thu, May 1, 2014 at 12:24 PM, Kenan Bek  wrote:
>>
>>>
>>> So, now, I am looking for frameworks based on Django which will give
>>> features for following issues:
>>>
>>>
>> Django itself is a framework :)
>>
>>
>>> - rich CRUD views generation (list/table, details, edit and create forms)
>>>
>>
>> CBV vs FBV.
>>
>>
>>> - ready to use file upload feature
>>>
>>
>> If you ModelForm, it comes inbuilt without u having to code anything.
>>
>>
>>> - rich reporting feature
>>>
>>
>> Most reporting is based on how you collect and store data and what kind
>> of information/report that you want to present. If its all structured info
>> in a db, things become a lot simpler and the only thing that you need is
>> knowledge of sql and some charting lib to render them.
>>
>>
>>> - and full customisation of code/view (I think it should generate python
>>> codes rather than generate dynamic views)
>>>
>>
>> Not sure what do you mean by 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/84c71812-429b-4926-bfb8-2f503ac77f9c%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHqTbjm7VNpNVUkfyxDOZ1ge5v2ZB1wFxrsjkJm9VJUAfoc%3DHw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Subjectively Required Fields

2014-04-28 Thread Mario Gudelj
Your clean method needs to return cleaned_data I believe
On 28/04/2014 10:02 pm, "Daniel Watkins" 
wrote:

> Hello all,
>
> We're running in to an interesting validation problem.  We have a model
> which represents a (specific type of) date interval, bounded by a start
> date and end date. Both fields are optional, but if end date is specified
> then start date must be specified. We are creating an instance of this
> using a ModelForm.
>
> We initially tried to do this with the model's clean method:
>
> def clean(self):
> if self.end_date and not self.start_date:
> raise ValidationError('Start date must be specified if an end
> date is specified.')
>
> This works fine if start date is not specified. However, the error is also
> shown if an invalid date is given, along with the "Invalid date" message
> against the field. This isn't really what we want (as it's not especially
> user-friendly).
>
> I'm pretty sure that this is because the form strips out the invalid date
> from the data it puts in to the model before this is validated, though I'm
> not 100% sure on this.
>
> Is there any way we can achieve what we want with model validation, or
> will we have to put the logic in to the form?
>
>
> Cheers,
>
> Dan
>
> --
> 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/468dc535-c494-4418-86c7-c857f66d130d%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHqTbjmnsxeVfLKJq%3DhFCwuTLb4YiWTMCaPb0yBdHW7SXKOBRg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django

2014-04-19 Thread Mario Gudelj
Two scoops is not a beginner's book. Start with tutorials. The one on
django site is a must, but there are lots of other tuts as well on the net.
Tango with django is a good one. Also django book is awesome resource
although somewhat outdated now. But I'd read first 7 chapters anyway
On 20/04/2014 1:04 am, "John DeRosa"  wrote:

>
> On Apr 19, 2014, at 8:02 AM, Mark Phillips 
> wrote:
>
> > "Two Scoops of Django" is also very good.
> >
> >
>
> +1 for TSoD. Super book!
>
> --
> 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/B5D083F9-F9D1-4C02-9517-C8AB1A569B7F%40ipstreet.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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHqTbjnza25h8w-O9r-gZ3E1NBOYDxLmdWdHOBYHpJyPJoVNWA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: What are the active Django e-commerce frameworks right now (2014)?

2014-04-15 Thread Mario Gudelj
I believe when you say framework you're referring to CMS with e-commerce. I
in same dilemma recently and settled on Mezzanine + cartridge. When you
install it it comes with a functioning cart and everything you need to get
ahead early. It has good docs and it's just Django without much magic in
it. I'd give that one another look.
On 15/04/2014 11:18 pm, "Brutus Schraiber" 
wrote:

> I played with Django a little bit a good couple of years ago and wanted to
> start out again. I created some pet projects to get into it again and I'm
> looking
> for a solid e-commerce framework to start some real projects.
>
> I just started to do some research in my free time and came across quite a
> lot
> of projects. I manged to take a closer look at some and will continue to
> dig,
> but I hope some of you can share some opinions, experiences and tips on
> direction.
>
> My main resources so far have been `Stack Overflow`_, `Django Packages`_,
> some
> of the discussions in this group and of course standard search engines.
> While
> it seems that these kind of questions are not that well received on S.O., I
> still found a lot of info trough the other channels.
>
>
> The frameworks
> --
>
> Right now I could need some help and pointers to narrow it down a bit.
>
> My focus is *easy of use* and *less boilerplate*. Not big and or complicate
> shops with lot's of settings and customization.
>
> I'm looking for a framework, that let's me set up *simple* shops fast. My
> main
> concern is to avoid boilerplate code for managing items, the shopping cart
> and
> check out / payment providers.
>
> Here's what I could find so far, hope to get some input from you - if you
> need
> more info on the kind and requirements on the future projects I plan to
> use it
> in, just ask.
>
>
> * Satchmo - http://www.satchmoproject.com/
>
>   + Probably the best known framework, might also be the one that's around
> the longest.
>
>   - I came across mixed reactions to it. Mostly concerning difficulty of
> customization and lot's of SQL queries.
>
>   - Seems not really lightweight and modular. Might be overkill?
>
>   - The site seems to be under construction. Documentation is not
> accessible
> (``/docs/dev/ was not found on this server``).
>
>
> * Satchless - http://satchless.com/
>
>   * Nice focus: "Satchless brings e-commerce and Python together. It
> provides
> the low-level classes and patterns so you can focus on your business
> logic
> and user experience."
>
>   - Library, not a framework. That is of course not bad at all, but just
> not
> what I'm looking for right now.
>
>   I would like to look more into it in the future but right now I need an
>   fast to setup framework. BTW: Is this used by *Satchmo*?
>
>
> * Saleor - http://getsaleor.com/
>
>   + Looks promising: "Lightweight, Performant, Customizable".
>
>   + Based on their GitHub profile the creators seems to have lot of Django
> practice: https://github.com/mirumee
>
>   - No demo, and no screen shots or anything.
>
>   - No docs (just install instructions).
>
>   Might be a good choice? Looks promising but missing docs is a huge minus.
>
>
> * Oscar - http://tangentlabs.github.io/django-oscar/
>
>   + Full fledged *extensible* Shop-Framework with a nice set of features
> already included (e.g. access control and hierarchy of customers).
>
>   + Sandbox to play around with and Demo-Site.
>
>   + Docs seemed neat: http://django-oscar.readthedocs.org/en/latest/
>
>   Would love to hear more about this one, any experiences to share?
>
>
> * Django Shop - https://www.django-cms.org/en/
>
>   + Documentation: http://django-shop.readthedocs.org/en/latest/
>
>   + From the people behind Django CMS.
>
>   ? Don't know if it requires Django CMS tough.
>
>   - Seems okay but might be a bit too simplistic for me?
>
>  `Django CMS`_ seems quite popular. Sadly I haven't found much info on
>  *Django Shop*. Any experiences?
>
>
> * Cartridge - http://cartridge.jupo.org/
>
>   + Framework build on Mezzanine.
>
>   - Requires `Mezzanine CMS`_. WHile Mezzanine looks great, I don't want to
> depend on it or learn another framework, just for small shops, right
> now.
>
>   ? Just out of curiosity: Is there something similar for `Wagtail`_?
>
> I came across some more but haven't found the time to look at them closely,
> some of the more outstanding ones where *Lightning Fast Shop* and *Plata*.
>
>
> That's what I got so far. What do you all think?
>
>
> .. _Stack Overflow: http://stackoverflow.com/
> .. _Django Packages: https://www.djangopackages.com/
> .. _Django CMS: https://www.django-cms.org
> .. _Mezzanine CMS: http://mezzanine.jupo.org/
> .. _Wagtail: http://wagtail.io/
>
>  --
> 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 remove an item from a queryset object list?

2014-04-09 Thread Mario Gudelj
Have you tried user_list.exclude(user=user)?


On 10 April 2014 12:45, nobody  wrote:

> Hi,
>
> I tried following statement, but did not remove the item from the list,
> appreciate any helps.
>
> user_list.exclude(user__username=user.username)
>
> Thank you.
>
> Kind regards.
>
>
>  --
> 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/e33f0201-f331-4956-9f86-397bb0075ac5%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHqTbj%3DFnfs2v9AvA9DZCdeZ9B%3DT6WWsMAHPt%3DA2Qq6gjuCXgA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Use custom HTML to render forms

2014-04-01 Thread Mario Gudelj
You can use {{form.field_name}} to render the input tag,
{{form.field_name.label}} to render the label
and {{form.field_name.errors}} to render field errors. Simple example:



{{ reorder_form.comments.label }}

{{ reorder_form.comments.errors }}
{{ reorder_form.comments }}

  


To add attributes to the input tag, such as classes, placeholder etc. you
need to add them as attrs dictionary parameter inside the widget class.

e.g. comment = forms.CharField(label="Please submit your comment below",
widget=forms.Textarea(attrs={"class":"span6"}))

You can also create a filter for rendering your own markup. Perhaps you can
take a look at bootstrap toolkit package for example. In particular
{{form|as_bootstrap}}


On 1 April 2014 22:50, Mike Dewhirst  wrote:

> On 1/04/2014 8:12 PM, Daniel Roseman wrote:
>
>> On Tuesday, 1 April 2014 00:40:44 UTC+1, Fred DJar wrote:
>>
>> HELP PLEASE
>>
>
> I agree with DR but it might be interesting to know what your problem
> might be ...
>
>
>>
>> No.
>>
>> You don't get to demand that people help you. If someone knows the
>> answer to your question, and they have time to answer - and if they can
>> work out what you're asking, which isn't obvious - they will reply. But
>> if you want help on demand, you need to pay someone.
>> --
>> DR.
>>
>> --
>> 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 http://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/162b8220-
>> 9c99-4f7f-ad36-7701d6a40451%40googlegroups.com
>> > 9c99-4f7f-ad36-7701d6a40451%40googlegroups.com?utm_medium=
>> email_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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/533AA81F.3070205%40dewhirst.com.au.
>
> 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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHqTbjmJDd6d08JFDmOhaf0WeysVBVe_PGjqk8q4pzB01mpnrg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django python checkbox

2014-04-01 Thread Mario Gudelj
There are a few ways in which you can do this. One of them is to add some
javascript to your code that will listen to onclick and check if your input
button is selected. If it is it will submit the form that initiates your
download. You can also do an Ajax post. Another way would be to create a
link to that view. I don't understand why it needs to be checkbox if it's
not a part of the form the user is submitting.


On 2 April 2014 12:21, Choro H  wrote:

> Sorry you all,
>
>  so,i want to export csv from database that is only when checked
>
>
> 2014年4月1日火曜日 13時22分31秒 UTC+9 Choro H:
>
>> Thank you very much!
>> I'm Sorry, i'm missing write comments,
>> I want to do download have been checboxd file  from html, then i write to
>> views.py this code, so i don't know how do write !
>> Please help me!
>> this is my right code:
>> def export_selected_data(request):
>> #if request.method == 'POST':
>> #_selected_action = request.POST.getlist("_
>> selected_action")
>>
>> response = HttpResponse(mimetype='application/vnd.ms-excel;
>> charset="Shift_JIS"')
>> response['Content-Disposition'] = 'attachment; filename=file.csv'
>> writer = csv.writer(response)
>> if request.method == 'POST':
>> _selected_action = request.POST.getlist("_selected_action")
>>
>> _selected_action = User.objects.all()
>> for obj in _selected_action:
>> row=[]
>> for field in User._meta.fields:
>> row.append(unicode(getattr(obj,field.name)).encode("
>> cp932"))
>> writer.writerow(row)
>> return response
>> This is my html:
>>
>> 
>> 
>> selected_export
>> 
>> 
>> 
>> 
>> 
>> Check
>> 名前
>> 会社名
>> 法人電話
>> 
>> 
>> 
>> {% if articles.count > 0 %}
>> {% for user in articles %}
>> 
>> > ="_selected_action" type="checkbox" value="{{user.id }}" type="submit"
>> class="button">
>> {{ user.user_name
>> }}
>> {{ user.company }}
>> {{ user.number }}
>> 
>> {% endfor %}
>> 
>> 
>> {% else %}
>> None
>> {% endif %}
>>
>> 2014年4月1日火曜日 12時47分08秒 UTC+9 Camilo Torres:
>>>
>>> Hello,
>>>
>>> You should start with the basics:
>>> https://docs.djangoproject.com/en/1.6/topics/http/file-uploads/
>>>
>>> You are using request.FILES and that is for file upload, no file
>>> download. To upload a file to the server, you must have a >> type="file" ...> in your template, which you don't have.
>>>
>>> To download files from the server to the browser (to the user computer),
>>> you should do:
>>> https://docs.djangoproject.com/en/1.6/ref/contrib/staticfiles/
>>> or, if the user uploaded the content:
>>> https://docs.djangoproject.com/en/1.6/topics/files/
>>>
>>> Hope this put you in the right direction.
>>>
>>> Camilo
>>>
>>> On Monday, March 31, 2014 1:31:24 AM UTC-4:30, Choro H wrote:

 Hello,

 i wan to do download file of a checkbox ;
 Please help me

 this is my viewspy:

 def export_selected_dataqq(request):
 if request.method == 'POST':
 _selected_action = request.FILES("_selected_action")

 response = HttpResponse(mimetype='application/vnd.ms-excel;
 charset="Shift_JIS"')
 response['Content-Disposition'] = 'attachment; filename=file.csv'
 writer = csv.writer(response)
 _selected_action = []
 writer.writerow(_selected_action)

 for obj in _selected_action:

 row=[]
 for field in User._meta.fields:
 row.append(unicode(getattr(obj,field.name)).encode("
 cp932"))
 writer.writerow(row)
 return response

 this is mmy html:

 
 
 
 Check
 名前
 会社名
 法人電話
 
 
 
 {% if articles.count > 0 %}
 {% for user in articles %}
 
 >>> ="_selected_action" type="checkbox" value="{{user.id }}" type="submit"
 class="button">
 {{ user.user_name
 }}
 {{ user.company }}
 {{ user.number }}
 
 {% endfor %}

 
 
 
 {% else %}
 None
 {% endif %}

>>>
>>
>> 2014年4月1日火曜日 12時47分08秒 UTC+9 Camilo Torres:
>>>
>>> Hello,
>>>
>>> You should start with the basics:
>>> https://docs.djangoproject.com/en/1.6/topics/http/file-uploads/
>>>
>>> You are using request.FILES and that is for file upload, no file
>>> download. To upload a file to the server, you must have a >> type="file" ...> in your template, which you don't have.
>>>
>>> To download files from the server to the browser (to the user computer),
>>> you should do:
>>> https://docs.djangoproject.com/en/1.6/ref/contrib/staticfiles/
>>> or, if the user uploaded the content:
>>> 

Re: Django RequestContext and JQuery.

2014-03-18 Thread Mario Gudelj
Return your context in json format, load it into js var and then use
.each() on it.
On 19/03/2014 3:27 am, "Kelechi Anyanwu"  wrote:

> Hi guys!
>
> How do i use JQuery to loop through a chunk of Django RequestContext being
> returned to my template.
>
> Please i need response!!
>
> 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/53b81615-a7b0-400c-8a32-a0efef5ebddb%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHqTbj%3DA%2B4xKi96EtE_jH9XktTq5WdbhLY61gh%3DFfA_6yCbiMg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: can anyone suggest me some host which is Australia based and also django friendly?

2014-03-03 Thread Mario Gudelj
Amazon now has a dc in Sydney. I believe that Gondor is au based as well.
On 03/03/2014 10:44 pm, "lu zou"  wrote:

> As above, can anyone suggest me some host which is Australia based and
> also django friendly?:)
>
> --
> 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/687076fd-22f7-4b0e-bcfc-ebeb7fd83214%40googlegroups.com
> .
> For more options, visit https://groups.google.com/groups/opt_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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHqTbjm206WDOm5XQGVNkV0s-%2BnE49y%2BGJc2QT%3DTPWueDGu9EQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Using Django without templates?

2014-02-27 Thread Mario Gudelj
You do have to be careful with templates if you're using too many
inclusions or if you have too much logic in them. There's a good django
debug toolbar add-on that informs you about the time a template takes to
compile.
On 27/02/2014 9:47 am, "ApathyBear"  wrote:

> I was briefly talking with a developer from Google whom I had met.
>
> He mentioned something that I hadn't really gotten a chance to ask him
> more about
>
> He told me to be careful with django templates because in terms of scale,
> they can cause problems and almost always need to be re-written. Rather he
> mentioned something like using a 'full stack'.
>
> I think back, and I don't exactly follow what he means by that. Is their a
> way to use Django without templates? Is it better ? Why or why not?
>
> --
> 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/2aa3d77a-da31-460e-b472-204e2548b69a%40googlegroups.com
> .
> For more options, visit https://groups.google.com/groups/opt_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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHqTbjn1AXCykZT9ggtvj4Z7%2BcEsR_CqpA2TC9wXKDURaR3wUw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


  1   2   3   >