Re: Static files not served

2013-06-28 Thread der_fenix
Is DEBUG is set to True or False?
And can you open static files by paths that are present in page source? I.e. 
by  path which generated from (for exampe) {% static "js/jquery.min.js" %}?
> Hi @der_fenix,
> 
> My STATIC_URL setting is as follows: STATIC_URL = '/static/'
> 
> I suspect that Django's development server's static serving does not like
> noscript tags? I have no idea. I might poke around later ... starting from
> Django's 'django.contrib.staticfiles.views.serve()' call.
> 
> On Thu, Jun 27, 2013 at 10:47 PM, der_fenix  wrote:
> > Is there you main static dir in STATIC_URL in settings.py?
> > 
> > > Update: removing the noscript tags around the css tags in the template
> > > solves the issue. I am no clientside scripting expert, but it is my
> > > understanding that noscript tags accommodate browsers with scripting
> > 
> > turned
> > 
> > > off, or legacy browsers? Surely the css should work by default?
> > > 
> > > I know this is not an html mailing list, but has anybody else
> > > encountered
> > > this?
> > > 
> > > Another thing i noticed is that all this is not a problem when i view
> > > the
> > > templates from outside a Django project - i.e. as a standalone html
> > 
> > website.
> > 
> > > On Thu, Jun 27, 2013 at 10:08 PM, Sithembewena Lloyd Dube <
> > 
> > zebr...@gmail.com
> > 
> > > > wrote:
> > > > 
> > > > Hi all,
> > > > 
> > > > I have a local development project where I put all static media in a
> > > > 'static' subdirectory of my app (/project/app/static/). I then created
> > 
> > a
> > 
> > > > 'static' directory in the root folder of my project (/project/static/)
> > 
> > and
> > 
> > > > specified that as my STATIC_ROOT in settings.py.
> > > > 
> > > > When I run the './manage.py collectstatic' command, all static media
> > 
> > are
> > 
> > > > added to the static root as expected. In the templates, usage is as
> > > > follows: '' and
> > 
> > so
> > 
> > > > on, but when I view the page in a browser the CSS and js are not
> > 
> > applied.
> > 
> > > > If I view page source and click on the generated links to static
> > > > resources,
> > > > I do see them.
> > > > 
> > > > One thing I do notice is that two of the missing css files are in the
> > > > document's noscript tag and the links for all three are not clickable
> > 
> > when
> > 
> > > > viewing source. There are three in there, so one loads fine.
> > > > 
> > > > Any pointers to what I could be missing? Thanks.
> > > > --
> > > > Regards,
> > > > Sithu Lloyd Dube

signature.asc
Description: This is a digitally signed message part.


Re: Advanced Search in django

2013-06-28 Thread coded kid
Try django watson https://github.com/etianen/django-watson/

On Thursday, 27 June 2013 09:33:22 UTC+1, Harjot Mann wrote:
>
> On Thu, Jun 27, 2013 at 1:16 PM, Peith Vergil 
> > 
> wrote: 
> > Try using django-haystack. It's a nice Django app, very easy to use, and 
> > with good documentation: 
> http://django-haystack.readthedocs.org/en/latest/. 
> > It provides a QuerySet like API for several search engine backends. It 
> works 
> > with  Solr, ElasticSearch, Whoosh, Xapian, etc. 
>
>
> Look I have a project called Automation software in which search is 
> already working but when we are searching for a name like hardeep it 
> shows only that clients which have this name but hardeep can also be 
> as hardip so i want that it displays all the clients with both the 
> names. 
>
> -- 
> Harjot Kaur Mann 
> Blog: http://harjotmann.wordpress.com/ 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




How create custom template tags and use Forms?

2013-06-28 Thread MacVictor
I create custom django template and used Form (this tag has to be 
universal):

This is file ratings.py use tags:

from django import template
from django.contrib.contenttypes.models import ContentType
from Ratings.forms import RatingsForm

register = template.Library()

class RatingFormNode(template.Node):
def __init__(self, content, id, varname):
self.content = content.split('.')
self.varname = varname
self.id = template.Variable(id)

def render(self, context):
id = self.id.resolve(context)
content = ContentType.objects.get(app_label=self.content[0], 
model=str(self.content[1]).lower())
context[self.varname] = RatingsForm(initial={'content_type': 
content, 'object_id': id})
return ''

@register.tag(name='rating')
def rating(parser, token):
"""
{% rating appname.Modelname 1 as Newsletter_Form %}
"""
bits = token.split_contents()

if bits[3] != 'as':
raise template.TemplateSyntaxError, "third argument to the 
get_latest tag must be 'as'"

return RatingFormNode(bits[1], bits[2], bits[4])


and I use this tag in tempalte file:

{% rating appname.Modelname id as rating_form %}

{% csrf_token %}
{{ rating_form }}




 
this is urls.py:

from django.conf.urls import patterns, url

urlpatterns = patterns('Ratings.views',
url(r'^add/$', 'ratings_add', name='ratings_add'),
)

 
and create views to get the url:

# -*- coding: utf-8 -*-
from django.core.urlresolvers import reverse
from django.http.response import Http404
from django.http import HttpResponseRedirect
from django.shortcuts import redirect
from Ratings.forms import RatingsForm


def ratings_add(request):
if not request.method == 'POST':
return Http404
form = RatingsForm(request.POST)
if form.is_valid():
form.save()
return HttpResponseRedirect(reverse('post', 
args=[request.POST.get('url')]))
else:
request.session['form_data'] = request.POST
return redirect(reverse('post', args=[request.POST.get('url')]), 
form=form)

 
I use this tag in the template with the url: "/post/name-this-post/". Tag 
creates a form of "RatingForm" of the model "Rating". When the person 
viewing your page and use the form and form is valid this is work (save 
form and redirect to page "/post/name-this-post/"), but when an error 
occurs, you are redirected but does not display an error. How do I fix 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.
For more options, visit https://groups.google.com/groups/opt_out.




how to properly use the m2m_changed signal?

2013-06-28 Thread Roberto López López

Hi,

I am trying to listen to the m2m_changed signal on my models, but I
can't make it work. Even the execution flow does not reach the linked
method!

class Project(models.Model):
departments = models.ManyToManyField('department.Department',
related_name='projects',

through='project.ProjectDepartmentMembership')

@receiver(m2m_changed, sender=Project.departments.through)
def _on_change_m2m(sender, instance, action, reverse, model, pk_set,
using, **kwargs):
pass

As interface I am using the django admin, and departments appears as an
inline of Project

Any help please? Thanks.

Cheers,

Roberto


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: how to properly use the m2m_changed signal?

2013-06-28 Thread Roberto López López

I have tried as well using the post_save signal and overriding the
save() method. But in none of those cases Project.departments is
populated yet when reaching my code :-/



On 06/28/2013 11:50 AM, Roberto López López wrote:
>
> Hi,
>
> I am trying to listen to the m2m_changed signal on my models, but I
> can't make it work. Even the execution flow does not reach the linked
> method!
>
> class Project(models.Model):
> departments = models.ManyToManyField('department.Department',
> related_name='projects',
> 
> through='project.ProjectDepartmentMembership')
>
> @receiver(m2m_changed, sender=Project.departments.through)
> def _on_change_m2m(sender, instance, action, reverse, model,
> pk_set, using, **kwargs):
> pass
>
> As interface I am using the django admin, and departments appears as
> an inline of Project
>
> Any help please? Thanks.
>
> Cheers,
>
> Roberto
>
>
> -- 
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> 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.
> For more options, visit https://groups.google.com/groups/opt_out.
>  
>  


-- 
Kind regards,

Roberto López López


System Developer
Parallab, Uni Computing
Høyteknologisenteret, Thormøhlensgate 55
N-5008 Bergen, Norway
Tel:(+47) 555 84091

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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.
For more options, visit https://groups.google.com/groups/opt_out.




search and export the data in .csv format using django

2013-06-28 Thread roopasingh250


In my application i am using a search function which search and display the 
output.I include search forfromdate and todate,Keyword search etc.

I want to export the searched result in a .csv file.Currently i had written 
a function calledcsv_export and exporting all the report in .csv.I want to 
know how to export the searched item in a .csv file.
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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Django-admin-tools unicode problem

2013-06-28 Thread Sandro Dutra
Como o Gilberto postou, pode haver um problema quando o teu editor de
textos salva o arquivo do template, tente abrir este template pelo bloco de
notas e ao 'salvar como' deve haver um campo lá embaixo para selecionar a
'Codificação', selecione UTF-8 e salve ou tente a configuração relativa no
editor de textos que está a utilizar, talvez isto resolva o problema.

Eu já tive esses problemas quando usava Notepad++, mas tenho utilizado
PyCharm e não tive mais este tipo de problema, há opções gratuitas que
devem lidar com isto também, tais como Sublime e Aptana.


2013/6/27 Jaimerson Leandro Amaro de Araújo 

> Cara, o problema é que a exceção tá sendo no template do aplicativo, que
> lê as informações do banco de dados. Alterar os arquivos do admin-tools é
> inviável em termos de portabilidade na hora do deploy. O que eu quero saber
> é se é possível mudar o encoding padrão desse app.
>
> Em quarta-feira, 26 de junho de 2013 11h22min18s UTC-3, Odin escreveu:
>>
>> Jaimerson, ainda assim creio que você deva tentar adicionar ao topo de
>> suas views e/ou dos módulos usados do admin-tools a linha:
>>
>> # -*- coding: utf-8 -*- ou # -*- coding: iso-8859-1 -*-
>>
>> Isso permitirá ao Python ler o arquivo no encoding definido.
>>
>>
>> 2013/6/26 Jaimerson Leandro Amaro de Araújo 
>>
>> Uh, I know it`s an encoding problem, I was hoping there was a way of
>>> changing default charset for that app.
>>>
>>> Em quarta-feira, 26 de junho de 2013 10h16min02s UTC-3, Odin escreveu:

 Think it's an encode problem. I never use this app but try to add this
 line o top of your views file:

 # -*- coding: utf-8 -*-


 2013/6/26 Jaimerson Leandro Amaro de Araújo 

> (I posted this on django-admin-tools mail list, but apparently there's
> no one alive there)
>
>
> Hello, I'm stuck in a encoding issue, on the dashboard template. Some
> of my models have fields with non-ascii characters (like "à" or "á"), and
> when I try to load the page, I get the following error:
> DjangoUnicodeDecodeError at /
>
> 'ascii' codec can't decode byte 0xc3 in position 5: ordinal not in 
> range(128).
> You passed in  0xb581d98c> ()
>
> [...]
> Unicode error hint
>
> The string that could not be encoded/decoded was: *Conte��do*
> Please, advise.
>
> --
> You received this message because you are subscribed 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
> .
> For more options, visit 
> https://groups.google.com/**grou**ps/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...@**googlegroups.com.
>>> To post to this group, send email to django...@googlegroups.com.
>>> Visit this group at 
>>> http://groups.google.com/**group/django-users
>>> .
>>> 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.
> 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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Django-admin-tools unicode problem

2013-06-28 Thread Roberto López López

Hi,

I can perfectly understand Portuguese, but it's not the case for many
users of this mailing list. Please, stick to English...

Cheers,

Roberto



On 06/28/2013 01:35 PM, Sandro Dutra wrote:
> Como o Gilberto postou, pode haver um problema quando o teu editor de
> textos salva o arquivo do template, tente abrir este template pelo
> bloco de notas e ao 'salvar como' deve haver um campo lá embaixo para
> selecionar a 'Codificação', selecione UTF-8 e salve ou tente a
> configuração relativa no editor de textos que está a utilizar, talvez
> isto resolva o problema.
>
> Eu já tive esses problemas quando usava Notepad++, mas tenho utilizado
> PyCharm e não tive mais este tipo de problema, há opções gratuitas que
> devem lidar com isto também, tais como Sublime e Aptana.
>
>
> 2013/6/27 Jaimerson Leandro Amaro de Araújo  >
>
> Cara, o problema é que a exceção tá sendo no template do
> aplicativo, que lê as informações do banco de dados. Alterar os
> arquivos do admin-tools é inviável em termos de portabilidade na
> hora do deploy. O que eu quero saber é se é possível mudar o
> encoding padrão desse app.
>
> Em quarta-feira, 26 de junho de 2013 11h22min18s UTC-3, Odin
> escreveu:
>
> Jaimerson, ainda assim creio que você deva tentar adicionar ao
> topo de suas views e/ou dos módulos usados do admin-tools a
> linha:
>
> # -*- coding: utf-8 -*- ou # -*- coding: iso-8859-1 -*-
>
> Isso permitirá ao Python ler o arquivo no encoding definido.
>
>
> 2013/6/26 Jaimerson Leandro Amaro de Araújo
> 
>
> Uh, I know it`s an encoding problem, I was hoping there
> was a way of changing default charset for that app.
>
> Em quarta-feira, 26 de junho de 2013 10h16min02s UTC-3,
> Odin escreveu:
>
> Think it's an encode problem. I never use this app but
> try to add this line o top of your views file:
>
> # -*- coding: utf-8 -*-
>
>
> 2013/6/26 Jaimerson Leandro Amaro de Araújo
> 
>
> (I posted this on django-admin-tools mail list,
> but apparently there's no one alive there)
>
>
> Hello, I'm stuck in a encoding issue, on the
> dashboard template. Some of my models have fields
> with non-ascii characters (like "à" or "á"), and
> when I try to load the page, I get the following
> error:
>
>
>   DjangoUnicodeDecodeError at /
>
> 'ascii' codec can't decode byte 0xc3 in position 5: 
> ordinal not in range(128).
> You passed in  at 0xb581d98c> ()
>
> [...]
>
>
> Unicode error hint
>
> The string that could not be encoded/decoded was:
> *Conte��do*
>
> Please, advise. --
> You received this message because you are
> subscribed 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.
> 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...@googlegroups.com.
> To post to this group, send email to
> django...@googlegroups.com.
> Visit this group at
> http://groups.google.com/group/django-users.
> 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.
> For more options, visit https://groups.google.com/groups/opt_out.
>  
>  
>
>
> -- 
> You received this message because you are subsc

What is the best practice to learn Django 1.5?

2013-06-28 Thread subsnico
Hi all,

I am very new to the world of Django and I have a couple questions 
regarding "how to learn it?":

My background is .NET development, mostly developing business logic tiers. 
I am very fluent with OOP, HTML5, CSS, JavaScript and have an entry-level 
knowledge of Python. Still, I have no knowledge of MVC (or MVT in this 
case) nor Django, nor command-line in *nix systems. I am in need to build 
quickly several web apps and due to the productivity gain in using Python 
rather than C# / Java, I naturally took a look at Django. I would like to 
thouroughly learn the framework and be able to bend it to my will as I 
think I'm in here for the long haul (kinda fed up with the Microsoft stack 
for development).

I have a need to do things like provide a web-based interface where users 
can find each other with criteria such as the geographical distance between 
them, upload images and edit them online, provide natural language search 
capabilities, etc... (just to highlight that I need to get to the level of 
knowing more than building a basic polls app or a simple blog).

As I understand, the entry point to learn Django is by completing the 
tutorial. What then? What would you recommend? As I've seen, most of the 
resources I can find online are outdated and target 1.4, would I still be 
able to learn from those and not getting frustrated? Also, I'm working on 
OS X and I have practically no knowledge of the command line. I glanced a 
little at how to deploy a Django site to production and quickly got lost... 
virtualenv, git, etc... No knowledge of that and looks a bit scary for a 
guy used to deploy an app by copying the compiled build using FTP.

So I'm asking you, experts... ...if you had to learn Django today, with no 
prior knowledge of previous versions, what would be your learning path?

Thank you for your time and looking forward to join what seems like a 
really cool community!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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.
For more options, visit https://groups.google.com/groups/opt_out.




Help in finding how to learn Django

2013-06-28 Thread subsnico
Hi all,

What is the best way to learn Django 1.5 thouroughly? I have been a .NET 
developer and have a really good understanding of OOP, HTML5, CSS and 
JavaScript. I also have an entry-level knowledge of Python. I am completely 
new to MVC (or MVT, in this case).

I have a need to build apps with Django that provide users with features 
such as finding each other based on geographical distance, upload pictures 
and edit them online, natural language search, etc... (just to highlight 
that I need to know more than how to build a poll app or a simple blog).

My understanding is that the entry point to learn Django is by completing 
the tutorial at the Django project site. Then, what? What path would you 
recommend? I have seen that lots of learning resources on the web target 
versions lower than 1.5 and I couldn't really find books on 1.5. When 
reading reviews on learning material on 1.4, I often see they are outdated 
and not really applying to 1.5.

Also, I briefly looked at what it takes to deploy a Django app. Virtualenv, 
git, pip, etc... are all things unknown to me and it looks a bit scary for 
a guy used to deploy apps by uploading the compiled binaries through FTP.

Help in defining a clear path to learn how to bend Django to my will would 
be invaluable!

Thank you for your time.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Help in finding how to learn Django

2013-06-28 Thread Roberto López López
https://docs.djangoproject.com/en/1.5/intro/




On 06/28/2013 09:49 AM, subsn...@gmail.com wrote:
> Hi all,
>
> What is the best way to learn Django 1.5 thouroughly? I have been a
> .NET developer and have a really good understanding of OOP, HTML5, CSS
> and JavaScript. I also have an entry-level knowledge of Python. I am
> completely new to MVC (or MVT, in this case).
>
> I have a need to build apps with Django that provide users with
> features such as finding each other based on geographical distance,
> upload pictures and edit them online, natural language search, etc...
> (just to highlight that I need to know more than how to build a poll
> app or a simple blog).
>
> My understanding is that the entry point to learn Django is by
> completing the tutorial at the Django project site. Then, what? What
> path would you recommend? I have seen that lots of learning resources
> on the web target versions lower than 1.5 and I couldn't really find
> books on 1.5. When reading reviews on learning material on 1.4, I
> often see they are outdated and not really applying to 1.5.
>
> Also, I briefly looked at what it takes to deploy a Django app.
> Virtualenv, git, pip, etc... are all things unknown to me and it looks
> a bit scary for a guy used to deploy apps by uploading the compiled
> binaries through FTP.
>
> Help in defining a clear path to learn how to bend Django to my will
> would be invaluable!
>
> Thank you for your time.
> -- 
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> 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.
> For more options, visit https://groups.google.com/groups/opt_out.
>  
>  


-- 
Kind regards,

Roberto López López


System Developer
Parallab, Uni Computing
Høyteknologisenteret, Thormøhlensgate 55
N-5008 Bergen, Norway
Tel:(+47) 555 84091

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: how to properly use the m2m_changed signal?

2013-06-28 Thread Roberto López López

I am doing tests and the m2m_changed signal seems to work perfectly as
long as I have not defined a "through" model. Is there any trick here?

Thanks!




On 06/28/2013 12:14 PM, Roberto López López wrote:
>
> I have tried as well using the post_save signal and overriding the
> save() method. But in none of those cases Project.departments is
> populated yet when reaching my code :-/
>
>
>
> On 06/28/2013 11:50 AM, Roberto López López wrote:
>>
>> Hi,
>>
>> I am trying to listen to the m2m_changed signal on my models, but I
>> can't make it work. Even the execution flow does not reach the linked
>> method!
>>
>> class Project(models.Model):
>> departments = models.ManyToManyField('department.Department',
>> related_name='projects',
>> 
>> through='project.ProjectDepartmentMembership')
>>
>> @receiver(m2m_changed, sender=Project.departments.through)
>> def _on_change_m2m(sender, instance, action, reverse, model,
>> pk_set, using, **kwargs):
>> pass
>>
>> As interface I am using the django admin, and departments appears as
>> an inline of Project
>>
>> Any help please? Thanks.
>>
>> Cheers,
>>
>> Roberto
>>
>>
>> -- 
>> You received this message because you are subscribed to the Google
>> Groups "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it,
>> send 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.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>  
>
>
> -- 
> Kind regards,
>
> Roberto López López
>
>
> System Developer
> Parallab, Uni Computing
> Høyteknologisenteret, Thormøhlensgate 55
> N-5008 Bergen, Norway
> Tel:(+47) 555 84091
> -- 
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> 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.
> For more options, visit https://groups.google.com/groups/opt_out.
>  
>  


-- 
Kind regards,

Roberto López López


System Developer
Parallab, Uni Computing
Høyteknologisenteret, Thormøhlensgate 55
N-5008 Bergen, Norway
Tel:(+47) 555 84091

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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.
For more options, visit https://groups.google.com/groups/opt_out.




standalone script to call a view

2013-06-28 Thread Larry Martell
I am trying to write a standalone script that calls one of my views. I
can call the view, but I'm having a problem with proving what it
wants. One of the things the view needs is request.user, and that
looks like this:

(Pdb) type(request.user)

(Pdb) type(request)


I'm trying to create the objects it needs by instantiating WSGIRequest
and SimpleLazyObject, but I'm having issues proving what they need,
and I'm just going deeper and deeper down the rabbit hole. Maybe I'm
going about this the wrong way.

Anyone ever done something like this and can give me some advise on
what the best way to achieve this is?

Thanks!
-larry

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: standalone script to call a view

2013-06-28 Thread Sergiy Khohlov
View is used for serving  web requests not  for  serving bash script .  Ok
you have called a view and receive a http page. Ia it expected result?
 I think more  easy way is create a function  which is be called by view
and your script.

Many thanks,

Serge


+380 636150445
skype: skhohlov


On Fri, Jun 28, 2013 at 3:41 PM, Larry Martell wrote:

> I am trying to write a standalone script that calls one of my views. I
> can call the view, but I'm having a problem with proving what it
> wants. One of the things the view needs is request.user, and that
> looks like this:
>
> (Pdb) type(request.user)
> 
> (Pdb) type(request)
> 
>
> I'm trying to create the objects it needs by instantiating WSGIRequest
> and SimpleLazyObject, but I'm having issues proving what they need,
> and I'm just going deeper and deeper down the rabbit hole. Maybe I'm
> going about this the wrong way.
>
> Anyone ever done something like this and can give me some advise on
> what the best way to achieve this is?
>
> Thanks!
> -larry
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send 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.
> 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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: standalone script to call a view

2013-06-28 Thread Larry Martell
On Fri, Jun 28, 2013 at 7:12 AM, Sergiy Khohlov  wrote:
> View is used for serving  web requests not  for  serving bash script .  Ok
> you have called a view and receive a http page. Ia it expected result?
>  I think more  easy way is create a function  which is be called by view and
> your script.

I don't really understand what you mean by "create a function which is
be called by view and your script." (Also, it's a python script not a
bash script.)

I understand how the views are normally used. In this case the view,
is normally called from a web page. It extracts data from the db and
downloads a CSV file. I want to do that same thing, except from a
script, not from the web page. Perhaps I have to go further down the
chain, and instead of calling the view, invoke what eventually gets
called. It's just that the view returns exactly what I need and if I
go any further down I'll have to duplicate some existing code, which
I'd rather not have to do.

> On Fri, Jun 28, 2013 at 3:41 PM, Larry Martell 
> wrote:
>>
>> I am trying to write a standalone script that calls one of my views. I
>> can call the view, but I'm having a problem with proving what it
>> wants. One of the things the view needs is request.user, and that
>> looks like this:
>>
>> (Pdb) type(request.user)
>> 
>> (Pdb) type(request)
>> 
>>
>> I'm trying to create the objects it needs by instantiating WSGIRequest
>> and SimpleLazyObject, but I'm having issues proving what they need,
>> and I'm just going deeper and deeper down the rabbit hole. Maybe I'm
>> going about this the wrong way.
>>
>> Anyone ever done something like this and can give me some advise on
>> what the best way to achieve this is?
>>
>> Thanks!
>> -larry
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send 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.
>> 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.
> 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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: how to properly use the m2m_changed signal?

2013-06-28 Thread Roberto López López

Changing the m2m_changed signal on Project.departments.through to
post_save on ProjectDepartmentMembership did the trick.

m2m_changed signal seems to work as long as you don't explicitly define
the "through" model.



On 06/28/2013 02:06 PM, Roberto López López wrote:
>
> I am doing tests and the m2m_changed signal seems to work perfectly as
> long as I have not defined a "through" model. Is there any trick here?
>
> Thanks!
>
>
>
>
> On 06/28/2013 12:14 PM, Roberto López López wrote:
>>
>> I have tried as well using the post_save signal and overriding the
>> save() method. But in none of those cases Project.departments is
>> populated yet when reaching my code :-/
>>
>>
>>
>> On 06/28/2013 11:50 AM, Roberto López López wrote:
>>>
>>> Hi,
>>>
>>> I am trying to listen to the m2m_changed signal on my models, but I
>>> can't make it work. Even the execution flow does not reach the
>>> linked method!
>>>
>>> class Project(models.Model):
>>> departments =
>>> models.ManyToManyField('department.Department',
>>> related_name='projects',
>>> 
>>> through='project.ProjectDepartmentMembership')
>>>
>>> @receiver(m2m_changed, sender=Project.departments.through)
>>> def _on_change_m2m(sender, instance, action, reverse, model,
>>> pk_set, using, **kwargs):
>>> pass
>>>
>>> As interface I am using the django admin, and departments appears as
>>> an inline of Project
>>>
>>> Any help please? Thanks.
>>>
>>> Cheers,
>>>
>>> Roberto
>>>
>>>
>>> -- 
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it,
>>> send 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.
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>  
>>>  
>>
>>
>> -- 
>> Kind regards,
>>
>> Roberto López López
>>
>>
>> System Developer
>> Parallab, Uni Computing
>> Høyteknologisenteret, Thormøhlensgate 55
>> N-5008 Bergen, Norway
>> Tel:(+47) 555 84091
>> -- 
>> You received this message because you are subscribed to the Google
>> Groups "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it,
>> send 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.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>  
>
>
> -- 
> Kind regards,
>
> Roberto López López
>
>
> System Developer
> Parallab, Uni Computing
> Høyteknologisenteret, Thormøhlensgate 55
> N-5008 Bergen, Norway
> Tel:(+47) 555 84091
> -- 
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> 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.
> For more options, visit https://groups.google.com/groups/opt_out.
>  
>  


-- 
Kind regards,

Roberto López López


System Developer
Parallab, Uni Computing
Høyteknologisenteret, Thormøhlensgate 55
N-5008 Bergen, Norway
Tel:(+47) 555 84091

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: What is the best practice to learn Django 1.5?

2013-06-28 Thread yeswanth nadella
The way I learned it was by reading the offical free django book. According 
to me, the tutorial app does not teach you lot of django. The first chapter 
8 chapter of the book will give you a solid understanding. Hope that thelps.

On Friday, June 28, 2013 2:35:17 AM UTC-5, subs...@gmail.com wrote:
>
> Hi all,
>
> I am very new to the world of Django and I have a couple questions 
> regarding "how to learn it?":
>
> My background is .NET development, mostly developing business logic tiers. 
> I am very fluent with OOP, HTML5, CSS, JavaScript and have an entry-level 
> knowledge of Python. Still, I have no knowledge of MVC (or MVT in this 
> case) nor Django, nor command-line in *nix systems. I am in need to build 
> quickly several web apps and due to the productivity gain in using Python 
> rather than C# / Java, I naturally took a look at Django. I would like to 
> thouroughly learn the framework and be able to bend it to my will as I 
> think I'm in here for the long haul (kinda fed up with the Microsoft stack 
> for development).
>
> I have a need to do things like provide a web-based interface where users 
> can find each other with criteria such as the geographical distance between 
> them, upload images and edit them online, provide natural language search 
> capabilities, etc... (just to highlight that I need to get to the level of 
> knowing more than building a basic polls app or a simple blog).
>
> As I understand, the entry point to learn Django is by completing the 
> tutorial. What then? What would you recommend? As I've seen, most of the 
> resources I can find online are outdated and target 1.4, would I still be 
> able to learn from those and not getting frustrated? Also, I'm working on 
> OS X and I have practically no knowledge of the command line. I glanced a 
> little at how to deploy a Django site to production and quickly got lost... 
> virtualenv, git, etc... No knowledge of that and looks a bit scary for a 
> guy used to deploy an app by copying the compiled build using FTP.
>
> So I'm asking you, experts... ...if you had to learn Django today, with no 
> prior knowledge of previous versions, what would be your learning path?
>
> Thank you for your time and looking forward to join what seems like a 
> really cool community!
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: What is the best practice to learn Django 1.5?

2013-06-28 Thread Gabriel
Hey, you could also try Getting Started With Djangorest, that's a series of
classes in everything you might need to become a Django dev.

-Gabe

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: What is the best practice to learn Django 1.5?

2013-06-28 Thread Roberto López López
Two scoops of django is also a good book https://django.2scoops.org/


On 06/28/2013 03:45 PM, Gabriel wrote:
>
> Hey, you could also try Getting Started With Djangorest, that's a
> series of classes in everything you might need to become a Django dev.
>
> -Gabe
>
> -- 
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> 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.
> For more options, visit https://groups.google.com/groups/opt_out.
>  
>  


-- 
Kind regards,

Roberto López López


System Developer
Parallab, Uni Computing
Høyteknologisenteret, Thormøhlensgate 55
N-5008 Bergen, Norway
Tel:(+47) 555 84091

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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.
For more options, visit https://groups.google.com/groups/opt_out.




ANNOUNCE: Django 1.6 beta 1 released

2013-06-28 Thread Jacob Kaplan-Moss
Hi folks --

I'm pleased to announce that we've just released Django 1.6 beta 1,
the second in our series of preview releases leading up to Django 1.6
(due in August).

More information can be found on our blog:


https://www.djangoproject.com/weblog/2013/jun/28/django-16-beta-1-released/

And in the release notes:

https://docs.djangoproject.com/en/dev/releases/1.6/

Thanks!

Jacob

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: standalone script to call a view

2013-06-28 Thread Javier Guerra Giraldez
On Fri, Jun 28, 2013 at 8:21 AM, Larry Martell  wrote:
> I don't really understand what you mean by "create a function which is
> be called by view and your script."


AFAICT, your situation looks like this:

you have this:

def myview(request, maybesomeparams...):
    does lots of things
   return HttpResponse(...templates,...)

now you want that "lot of things" from the command line, but to call
view you must create a request and interpret the response, because the
view function works only within a web request/response cycle.


you can refactor it like this:


def utilityfunction(user, otherparams...):
   ... does some things (with database? no matter)...
   return somepythondata


def myview(request, .):
   # get data
   data = utilityfunction(request.user, .)
   # use data to create response
   return HttpResponse(... templates...(data)...)


def mycommandlinefunc(...):
   # find user (with username?)
   user=User.objects.get(username=)
   # get data
   data = utilityfunction(user, .)
   # use data to create output
   # maybe using a different template
   print RenderToString(template, data)


the point is not to call the view function, because it does things in
a very web-specific way, but instead encapsulate whatever is common to
both the view and the commandline operation into a separate function
and use that in both cases.


--
Javier

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: django deploy structure

2013-06-28 Thread coded kid
Man, use GIT. Push to your git repo. Clone from git through your production 
server. It's easy to do. Hope this helps? :)

On Thursday, 27 June 2013 09:08:13 UTC+1, Mulianto wrote:
>
> Hi,
>
> If cannot use git, for copy the source you can use rsync or use fabric to 
> selective upload the file and reload the app.
>
> But easier using GIT
>
> Sent from my iPhone
>
> On 27 Jun 2013, at 08:15, Nick Apostolakis > 
> wrote:
>
> You could use a code versioning  system like git or bazaar.when you want 
> to deploy just pull from your repository 
> Στις 26 Ιουν 2013 8:46 μ.μ., ο χρήστης "fred" 
> > 
> έγραψε:
>
>> I've got django 1.5 deploying successfully to a Linux Apache system with 
>> mod_wsgi.  This system is still being developed and changes are frequent.  
>>
>> I currently just copy the Eclipse project directory over, which gives me 
>> the site/settings as well as the app.  This works, but has the disadvantage 
>> of also copying unnecessary stuff like my docs subdirectory and test data 
>> directory, etc. I cannot use tools like git to solve this for various 
>> internal reasons.
>>
>> I'm the only one using django in my organization and I would appreciate 
>> some insight from the more experienced developers in the community.  
>>
>> Thanks,
>>
>> Fred.
>>
>> -- 
>> You received this message because you are subscribed 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.
>> 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...@googlegroups.com .
> To post to this group, send email to django...@googlegroups.com
> .
> Visit this group at http://groups.google.com/group/django-users.
> 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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: standalone script to call a view

2013-06-28 Thread Sergiy Khohlov
for this case you can use  django shell 

Many thanks,

Serge


+380 636150445
skype: skhohlov


On Fri, Jun 28, 2013 at 4:47 PM, Javier Guerra Giraldez
wrote:

> On Fri, Jun 28, 2013 at 8:21 AM, Larry Martell 
> wrote:
> > I don't really understand what you mean by "create a function which is
> > be called by view and your script."
>
>
> AFAICT, your situation looks like this:
>
> you have this:
>
> def myview(request, maybesomeparams...):
> does lots of things
>return HttpResponse(...templates,...)
>
> now you want that "lot of things" from the command line, but to call
> view you must create a request and interpret the response, because the
> view function works only within a web request/response cycle.
>
>
> you can refactor it like this:
>
>
> def utilityfunction(user, otherparams...):
>... does some things (with database? no matter)...
>return somepythondata
>
>
> def myview(request, .):
># get data
>data = utilityfunction(request.user, .)
># use data to create response
>return HttpResponse(... templates...(data)...)
>
>
> def mycommandlinefunc(...):
># find user (with username?)
>user=User.objects.get(username=)
># get data
>data = utilityfunction(user, .)
># use data to create output
># maybe using a different template
>print RenderToString(template, data)
>
>
> the point is not to call the view function, because it does things in
> a very web-specific way, but instead encapsulate whatever is common to
> both the view and the commandline operation into a separate function
> and use that in both cases.
>
>
> --
> Javier
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send 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.
> 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.
For more options, visit https://groups.google.com/groups/opt_out.




Filter more than one level in the related field

2013-06-28 Thread Hélio Miranda
Hi!
I have my application django-tastypie as BD and MongoDB
But I have a problem, it is unable to filter on more than one level, I will 
give an example to explain better.
I have the following:
*class EntrepreneurResource (resources.MongoEngineResource):*
**
* country = fields.ReferencedListField (of = 
'Football.Resource.CountryResource'*
*  attribute = 'country', full = True, null = True)*
**
* class Meta:*
* queryset = Entrepreneur.objects.all ()*
* allowed_methods = ('get', 'post', 'put', 'delete', 'patch')*
* list_allowed_methods = ['get', 'post', 'put', 'delete', 'patch']*
* authorization = Authorization ()*
* filtering = {*
* 'id': ALL,*
* 'name': ALL,*
* 'country': ALL_WITH_RELATIONS,*
* }*

When I want to make a filter in the Entrepreneur country do the following:
*
http://localhost:8080/onpitch/api/v1/Entrepreneur/?country=51cd93e18774a713bc1f5763
*

And he returns the entrepreneur to have the country with that id

But now if I as you want, eg a filter like this:
*http://localhost:8080/onpitch/api/v1/Entrepreneur/?country__name=Portugal*

I do not return anything []

Someone can help me? What am I doing wrong?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Filter more than one level in the related field

2013-06-28 Thread Gabriel
I'm not familiar with Mongo and Tastypie, but is parsing querystrings in
the __ format something that it's supposed to do
by default?


On Fri, Jun 28, 2013 at 11:20 AM, Hélio Miranda  wrote:

> Hi!
> I have my application django-tastypie as BD and MongoDB
> But I have a problem, it is unable to filter on more than one level, I
> will give an example to explain better.
> I have the following:
> *class EntrepreneurResource (resources.MongoEngineResource):*
> **
> * country = fields.ReferencedListField (of =
> 'Football.Resource.CountryResource'*
> *  attribute = 'country', full = True, null = True)*
> **
> * class Meta:*
> * queryset = Entrepreneur.objects.all ()*
> * allowed_methods = ('get', 'post', 'put', 'delete', 'patch')*
> * list_allowed_methods = ['get', 'post', 'put', 'delete', 'patch']
> *
> * authorization = Authorization ()*
> * filtering = {*
> * 'id': ALL,*
> * 'name': ALL,*
> * 'country': ALL_WITH_RELATIONS,*
> * }*
>
> When I want to make a filter in the Entrepreneur country do the following:
> *
> http://localhost:8080/onpitch/api/v1/Entrepreneur/?country=51cd93e18774a713bc1f5763
> *
>
> And he returns the entrepreneur to have the country with that id
>
> But now if I as you want, eg a filter like this:
> *http://localhost:8080/onpitch/api/v1/Entrepreneur/?country__name=Portugal
> *
>
> I do not return anything []
>
> Someone can help me? What am I doing wrong?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send 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.
> 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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Help in finding how to learn Django

2013-06-28 Thread Mike Dewhirst

On 28/06/2013 5:49pm, subsn...@gmail.com wrote:

Hi all,

What is the best way to learn Django 1.5 thouroughly? I have been a .NET
developer and have a really good understanding of OOP, HTML5, CSS and
JavaScript. I also have an entry-level knowledge of Python. I am
completely new to MVC (or MVT, in this case).

I have a need to build apps with Django that provide users with features
such as finding each other based on geographical distance, upload
pictures and edit them online, natural language search, etc... (just to
highlight that I need to know more than how to build a poll app or a
simple blog).

My understanding is that the entry point to learn Django is by
completing the tutorial at the Django project site. Then, what? What
path would you recommend?


See if you can abstract one or more sub-sections of your planned greater 
project and choose the smallest or most self-contained one to start 
with. Your objective is to turn it into a re-usable app (or library) for 
all your future projects which might need it. Think in boundaries rather 
than technicalities.


Omitting everything else, build that one.

I have seen that lots of learning resources on

the web target versions lower than 1.5 and I couldn't really find books
on 1.5. When reading reviews on learning material on 1.4, I often see
they are outdated and not really applying to 1.5.


Most, if not all, books and material relating to Django 1.0 will work on 
all versions of Django up to 1.9. So they are still valuable.




Also, I briefly looked at what it takes to deploy a Django app.
Virtualenv, git, pip, etc... are all things unknown to me and it looks a
bit scary for a guy used to deploy apps by uploading the compiled
binaries through FTP.


You have no choice. You simply have to have a repository. Git or 
Mercurial seem to be flavour du jour. I use Subversion but I'm 
old-fashioned.


Deployment strategies vary so you need to figure out what suits you. I 
develop in Windows, commit to a Linux hosted repo and use Buildbot on 
the same VM to completely blow away the staging site and reconstitute it 
from the repo. That happens automatically on every commit.


The production server gets updated manually when/as required but by 
scripted export from a tagged production release in the repo.


It isn't scary. It is safely reproduceable. CSS and Javascript are scary.

Pip is dead easy so you need to look more deeply. Python has a number of 
installer tools but pip seems to be the way forward.


Virtualenv is necessary if you are developing in different areas. For 
example, if you have a "legacy" app to support you really require a 
"legacy" environment within which to support it. Modern developers see 
enough of this requirement to simply do it for all their projects so 
they don't have to think about it. If you only have one project you 
might delay Virtualenv until you need it. You will know when that time 
comes.




Help in defining a clear path to learn how to bend Django to my will
would be invaluable!


M. I thought that way in the beginning. Going with the Django flow 
is much more productive.


Welcome :)

Mike



Thank you for your time.

--
You received this message because you are subscribed to the Google
Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send
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.
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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Filter more than one level in the related field

2013-06-28 Thread Hélio Miranda
is supposed to do research in the related field, as shown here, the 
documentation
http://django-tastypie.readthedocs.org/en/v0.9.15/interacting.html

Would filter Entrepreneur by country named Portugal


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: What is the best practice to learn Django 1.5?

2013-06-28 Thread Mike Dewhirst

On 28/06/2013 11:47pm, Roberto López López wrote:

Two scoops of django is also a good book https://django.2scoops.org/


+1




On 06/28/2013 03:45 PM, Gabriel wrote:


Hey, you could also try Getting Started With Djangorest, that's a
series of classes in everything you might need to become a Django dev.

-Gabe

--
You received this message because you are subscribed to the Google
Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send
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.
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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Filter more than one level in the related field

2013-06-28 Thread Tom Christie
Hi Hélio,

  As mentioned 
before, 
it's not really appropriate to consistently cross-post your questions. 
 Folks on either list won't be aware if there question has already been 
answered by someone else, it's more difficult for others to follow the 
threads, and it spams people who follow both lists.
I see this post on both the `tastypie` and `django developers` mailing 
lists - please try to just choose one appropriate forum and post there.

Many thanks,

  Tom

On Friday, 28 June 2013 15:38:51 UTC+1, Hélio Miranda wrote:
>
> is supposed to do research in the related field, as shown here, the 
> documentation
> http://django-tastypie.readthedocs.org/en/v0.9.15/interacting.html
>
> Would filter Entrepreneur by country named Portugal
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: standalone script to call a view

2013-06-28 Thread Larry Martell
On Fri, Jun 28, 2013 at 7:47 AM, Javier Guerra Giraldez
 wrote:
> On Fri, Jun 28, 2013 at 8:21 AM, Larry Martell  
> wrote:
>> I don't really understand what you mean by "create a function which is
>> be called by view and your script."
>
>
> AFAICT, your situation looks like this:
>
> you have this:
>
> def myview(request, maybesomeparams...):
> does lots of things
>return HttpResponse(...templates,...)
>
> now you want that "lot of things" from the command line, but to call
> view you must create a request and interpret the response, because the
> view function works only within a web request/response cycle.
>
>
> you can refactor it like this:
>
>
> def utilityfunction(user, otherparams...):
>... does some things (with database? no matter)...
>return somepythondata
>
>
> def myview(request, .):
># get data
>data = utilityfunction(request.user, .)
># use data to create response
>return HttpResponse(... templates...(data)...)
>
>
> def mycommandlinefunc(...):
># find user (with username?)
>user=User.objects.get(username=)
># get data
>data = utilityfunction(user, .)
># use data to create output
># maybe using a different template
>print RenderToString(template, data)
>
>
> the point is not to call the view function, because it does things in
> a very web-specific way, but instead encapsulate whatever is common to
> both the view and the commandline operation into a separate function
> and use that in both cases.

Thanks for the reply. I got this going. I ended up instantiating the
class that actually does the db pull, and initializing and calling
that.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Filter more than one level in the related field

2013-06-28 Thread Hélio Miranda
Ok, peço desculpas

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Filter more than one level in the related field

2013-06-28 Thread Hélio Miranda

>
> Ok, I apologize
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: A PHP framework with some Django features?

2013-06-28 Thread Tiago Almeida
Hi ,
try Symfony2.
Symfony template language has the same syntax as django templates. Only the 
template filters have different names but similar functions. 
It does not have an admin as good as django's. There are third party apps 
(called bundles in the context of symfony) that try to do that (e.g. 
SonataAdminBundle). Never used it though. It does however have a generator 
of views and controllers. It's a management command that you run for a 
specific Model and it generates views to edit, create new instances, 
delete, etc.
It generates the DB schema from your models.
I like it but it's not as clean as Django (lots of config files, huge 
nested folder structure etc...)
my 2 cent...



On Thursday, June 27, 2013 10:13:38 PM UTC+1, thoms wrote:
>
> Hello,
>
> I have a PHP background, and I'm learning Django.
> Long story short: I love Django, but some things are really painful to do 
> (configuration, media/static content, etc.).
>
> That's why I want to know if there is a PHP framework that has some of 
> Django's really cool features:
> - Automatically creates the SQL table from the model
> - Automatically creates an admin
>
> Thanks for your 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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: A PHP framework with some Django features?

2013-06-28 Thread Deepak Kumar
I have used symfony2 quite a bit and as very rightly said by *Tiago Almeida 
*in the thread below that SonataAdminBundle (in sf2 context) serves as very 
good admin management, till now I am very happy with Symfony2.

On Friday, June 28, 2013 2:43:38 AM UTC+5:30, thoms wrote:
>
> Hello,
>
> I have a PHP background, and I'm learning Django.
> Long story short: I love Django, but some things are really painful to do 
> (configuration, media/static content, etc.).
>
> That's why I want to know if there is a PHP framework that has some of 
> Django's really cool features:
> - Automatically creates the SQL table from the model
> - Automatically creates an admin
>
> Thanks for your 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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: A PHP framework with some Django features?

2013-06-28 Thread Andre Terra
I've heard good anecdotes about http://laravel.com/...


but I'd never ever leave Django...


Cheers,
AT

On Fri, Jun 28, 2013 at 12:52 PM, Deepak Kumar wrote:

> I have used symfony2 quite a bit and as very rightly said by *Tiago
> Almeida *in the thread below that SonataAdminBundle (in sf2 context)
> serves as very good admin management, till now I am very happy with
> Symfony2.
>
>
> On Friday, June 28, 2013 2:43:38 AM UTC+5:30, thoms wrote:
>>
>> Hello,
>>
>> I have a PHP background, and I'm learning Django.
>> Long story short: I love Django, but some things are really painful to do
>> (configuration, media/static content, etc.).
>>
>> That's why I want to know if there is a PHP framework that has some of
>> Django's really cool features:
>> - Automatically creates the SQL table from the model
>> - Automatically creates an admin
>>
>> Thanks for your 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.
> 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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: ANN: django-otp and friends: one-time passwords and trusted agents

2013-06-28 Thread Jason Arnst-Goodrich
I just stumbled on this and it looks absolutely amazing. I do have one 
request though: can we get a sample project up that uses Google's 
authenticator (or anything else).

This looks like the best solution for two factor authentication for Django 
but I don't think many people will know where to start when it comes to 
using it (myself included).

On Wednesday, September 12, 2012 1:27:26 PM UTC-7, Peter Sagerson wrote:
>
> I recently released a suite of packages to support two-factor 
> authentication in Django by way of one-time passwords.
>
> The core package is django-otp , 
> which defines the framework and provides all of the shared APIs. 
> Integration is possible at several levels, from low-level APIs (
> devices_for_user()
> , 
> match_token(),
>  
> etc.); to an AuthenticationForm 
> subclass;
>  to 
> a replacement for Django's login view and an OTP-enabled admin site. Other 
> niceties include the 
> otp_required
>  decorator, 
> an analog to login_required. This is not an authentication backend: 
> although it depends on django.contrib.auth for modeling purposes, it 
> operates independently of the normal authentication machinery.
>
> A given user may have zero or more OTP devices against which we can verify 
> a one-time password. The core project includes Django apps that implement 
> common devices such as HOTP and TOTP (compatible with Google Authenticator, 
> among others) and static passwords (typically used as backup codes). The 
> former include standard features such as tolerance and drift. Separately, 
> django-otp-yubikey  provides 
> support for YubiKey devices (locally or remotely verified). 
> django-otp-twilio  provides 
> support for Twilio's SMS service for delivering codes by SMS. Implementing 
> support for additional mechanisms is as simple as subclassing an abstract 
> model class and implementing a verification method (and optionally a 
> challenge method). Raw implementations of HOTP and TOTP are provided for 
> convenience along with a few other generally useful utility functions.
>
> As a companion to these, I've also released 
> django-agent-trust, 
> which uses Django 1.4's signed key APIs to tag user-agents that the user 
> has identified as trustworthy. In other words, this implements the "This is 
> a private/shared computer" option one often sees on sensitive sites. 
> Features include revocation and expiration (both absolute and by 
> inactivity; globally, per-user, and per-agent). 
> django-otp-agents is 
> a project that glues together django-otp and django-agent-trust to assign 
> trust to user-agents by way of two-factor authentication (one of the most 
> common scenarios, it seems).
>
> Documentation: django-otp , 
> django-otp-yubikey , 
> django-otp-twilio , 
> django-agent-trust , 
> django-otp-agents 
> Bitbucket: django-otp , 
> django-agent-trust 
>
> As always, the as-is clause in the BSD license isn't kidding. It's early 
> days for these yet and while everything has been carefully documented and 
> unit-tested, not all of the code has had contact with the real world. 
> Feedback is always welcome. The Google group 
> https://groups.google.com/forum/#!forum/django-otp is available for 
> discussion and questions.
>
> Thanks,
> Peter
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: A PHP framework with some Django features?

2013-06-28 Thread Jason Arnst-Goodrich
Nobody's ever switched FROM Django TO PHP as far as I know :)

But like others have already said - there's plenty of good frameworks that 
accomplish the same things Django does in PHP. Unless you truly love PHP 
I'd take the time to learn Django instead. :P

On Friday, June 28, 2013 10:17:50 AM UTC-7, Andre Terra (airstrike) wrote:
>
> I've heard good anecdotes about http://laravel.com/... 
>
>
> but I'd never ever leave Django...
>
>
> Cheers,
> AT
>
> On Fri, Jun 28, 2013 at 12:52 PM, Deepak Kumar 
> 
> > wrote:
>
>> I have used symfony2 quite a bit and as very rightly said by *Tiago 
>> Almeida *in the thread below that SonataAdminBundle (in sf2 context) 
>> serves as very good admin management, till now I am very happy with 
>> Symfony2.
>>
>>
>> On Friday, June 28, 2013 2:43:38 AM UTC+5:30, thoms wrote:
>>>
>>> Hello,
>>>
>>> I have a PHP background, and I'm learning Django.
>>> Long story short: I love Django, but some things are really painful to 
>>> do (configuration, media/static content, etc.).
>>>
>>> That's why I want to know if there is a PHP framework that has some of 
>>> Django's really cool features:
>>> - Automatically creates the SQL table from the model
>>> - Automatically creates an admin
>>>
>>> Thanks for your 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...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com
>> .
>> Visit this group at http://groups.google.com/group/django-users.
>> 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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: A PHP framework with some Django features?

2013-06-28 Thread Javier Guerra Giraldez
On Fri, Jun 28, 2013 at 12:54 PM, Jason Arnst-Goodrich
 wrote:
> Nobody's ever switched FROM Django TO PHP as far as I know :)


maybe not, but returns to PHP might be common.

still many people take PHPs ease of deployment as a failure of other
schemes (not realizing that creating a web application separate from
the web server is a big plus), so i don't find surprising that some of
them don't take the time to reap the benefits and get back to what
they know.

--
Javier

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: A PHP framework with some Django features?

2013-06-28 Thread Gustavo Carneiro
On Fri, Jun 28, 2013 at 7:04 PM, Javier Guerra Giraldez
wrote:

> On Fri, Jun 28, 2013 at 12:54 PM, Jason Arnst-Goodrich
>  wrote:
> > Nobody's ever switched FROM Django TO PHP as far as I know :)
>
>
> maybe not, but returns to PHP might be common.
>
> still many people take PHPs ease of deployment as a failure of other
> schemes (not realizing that creating a web application separate from
> the web server is a big plus), so i don't find surprising that some of
> them don't take the time to reap the benefits and get back to what
> they know.
>
>
I don't know what you mean.  You can use apache mod_wsgi to have apache
directly serve Django web apps[1], same as PHP.

[1] unless you need to do web sockets, of course.

-- 
Gustavo J. A. M. Carneiro
"The universe is always one step beyond logic." -- Frank Herbert

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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.
For more options, visit https://groups.google.com/groups/opt_out.




Using django tags in a blog post

2013-06-28 Thread Cody Scott
I have a simple model that has a TextField used to store a blog post.

body = models.TextField()


I would like to be able to use django tags in the blog post, such as {% url 
'' %} and {% trans "" %}.


I tried using the |safe filter and passing a mark_safe() value but they 
don't convert the django tags to 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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: A PHP framework with some Django features?

2013-06-28 Thread Javier Guerra Giraldez
On Fri, Jun 28, 2013 at 1:16 PM, Gustavo Carneiro  wrote:
> I don't know what you mean.  You can use apache mod_wsgi to have apache
> directly serve Django web apps[1], same as PHP.


in most cases, apache out of the box will let you simply drop *.php
files anywhere you have static files and they'll be interpreted.  many
people consider that an advantage.


--
Javier

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: A PHP framework with some Django features?

2013-06-28 Thread Gustavo Carneiro
On Fri, Jun 28, 2013 at 7:26 PM, Javier Guerra Giraldez
wrote:

> On Fri, Jun 28, 2013 at 1:16 PM, Gustavo Carneiro 
> wrote:
> > I don't know what you mean.  You can use apache mod_wsgi to have apache
> > directly serve Django web apps[1], same as PHP.
>
>
> in most cases, apache out of the box will let you simply drop *.php
> files anywhere you have static files and they'll be interpreted.  many
> people consider that an advantage.
>

Yeah.  It's easier, true, no need to do apache configuration.  I see your
point.

On the other hand, scary.  Putting on a sysadmin hat, the possibility of a
PHP file accidentally lying around in certain places being able to be
executed remotely would scare me.  You _should_ be forced to do apache
configuration, so that you tell apache explicitly what code can be executed.



>
>
> --
> Javier
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send 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.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>


-- 
Gustavo J. A. M. Carneiro
"The universe is always one step beyond logic." -- Frank Herbert

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: configure apache for shared hosting using fcgi

2013-06-28 Thread gilberto dos santos alves
please take steps bellow, for understand what is going on.

for run django app on shared host
where we have apache2 and fcgi module installed
like hostgator.com

step 01 - create symbolic link for static (css, img, js) 


1.1 if in your provider there is a 
/usr/local/lib/pythonx.y/dist-packages/django/contrib/admin/static

try

ex a: 

ln -s /usr/local/lib/pythonx.y/dist-packages/django/contrib/admin/static 
/home/your-user/public_html/static

or use your own instaled version of python/django static files

ex b:
 
ln -s /home/your-user/django/v16a1/django/contrib/admin/static 
/home/your-user/public_html/static


this solve style,css etc for admin app of django


step 02 - .htacces for directory main app http
==

folder ex:  /home/your-user/public_html/rundjango/
what url is: http://your-url-dot/rundjango/admin

AddHandler fastcgi-script .fcgi
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ mysite.fcgi/$1 [QSA,L]


step 03 - index.fcgi (like index.html or index.php)
===

because we use pytz (for handle datetime) it is installed with 
"easy_install pytz",
so it may be declared on sys.path.

this is my index.fcgi 
after creation you may chmod +x index.fcgi for allow run mode

#!/usr/local/bin/python

import sys, os, user
sys.path.insert(0, "/home/your-user/mycode/mysite")
sys.path.insert(0, "/home/your-user/python/pytz-2013b-py2.6.egg")


# Switch to the directory of your project.
os.chdir("/home/your-user/mycode/mysite")

# Set the DJANGO_SETTINGS_MODULE environment variable.
os.environ['DJANGO_SETTINGS_MODULE'] = "mysite.settings"

from django.core.servers.fastcgi import runfastcgi
runfastcgi(method="threaded", daemonize="false")


step 04 - verify environment vars $PATH and $PYTHONPATH
===

this .bash_profile config your env setup when you login
or your apps runs (ex. apache2, etc)
verify that your PYTHONPATH is correct setup
in this case we could use some different python version
that one is default (ex. 2.6, 2.7, 3.2)

# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi

# User specific environment and startup programs

PATH=$HOME/bin:$HOME/my-other-app-dir:$PATH
PYTHONPATH=$HOME/python
export PYTHONPATH
export PATH



step 05 - verify if your env is ok
==

please logout and login for verify your env var is ok

issue this commands:

echo $PATH
echo $PYTHONPATH

run this small codes of python for verification

python 



>>> import sys
>>> for whatlocal in sys.path:
...  print whatlocal
... 

Be Happy!

Em quinta-feira, 27 de junho de 2013 07h06min50s UTC-3, Sheila escreveu:
>
> Following the django book 
> https://docs.djangoproject.com/en/dev/howto/deployment/fastcgi/#running-django-on-a-shared-hosting-provider-with-apache
>  I am trying to deploy my project on shared host. 
> To try it first I am using a virtual Ubuntu 10.04 server. In my server 
> user can access http://localhost/~USER/ and if I put any html in 
> /home/user/public_html it can be access. 
> But the method in the book using .htacess and fastcgi do not work. I am 
> suspecting that my apache2 configuration is wrong. 
> Can someone tell me what do I need to change in my apache2 configuration 
> to set up share hosting?? I am new to apache2 :(
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: ANNOUNCE: Django 1.6 beta 1 released

2013-06-28 Thread Marc Aymerich
On Fri, Jun 28, 2013 at 3:48 PM, Jacob Kaplan-Moss  wrote:
> Hi folks --
>
> I'm pleased to announce that we've just released Django 1.6 beta 1,
> the second in our series of preview releases leading up to Django 1.6
> (due in August).
>
> More information can be found on our blog:
>
>
> https://www.djangoproject.com/weblog/2013/jun/28/django-16-beta-1-released/
>
> And in the release notes:
>
> https://docs.djangoproject.com/en/dev/releases/1.6/
>

Wow, lots of cool changes for the next release!
thank you guys for all the great effort !!


-- 
Marc

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: What is the best practice to learn Django 1.5?

2013-06-28 Thread Kakar Arunachal Service
For me, Beginning Django E-commerce by James McGaw was very helpful! Hope
this helped you.


On Fri, Jun 28, 2013 at 8:08 PM, Mike Dewhirst wrote:

> On 28/06/2013 11:47pm, Roberto López López wrote:
>
>> Two scoops of django is also a good book https://django.2scoops.org/
>>
>
> +1
>
>
>
>>
>> On 06/28/2013 03:45 PM, Gabriel wrote:
>>
>>>
>>> Hey, you could also try Getting Started With Djangorest, that's a
>>> series of classes in everything you might need to become a Django dev.
>>>
>>> -Gabe
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to 
>>> django-users+unsubscribe@**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
>>> .
>>> 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+unsubscribe@**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
> .
> 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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: ANNOUNCE: Django 1.6 beta 1 released

2013-06-28 Thread Gabriel
Yeah, that new testrunnser may be exactly what I was looking for!
Great work!


On Fri, Jun 28, 2013 at 4:20 PM, Marc Aymerich  wrote:

> On Fri, Jun 28, 2013 at 3:48 PM, Jacob Kaplan-Moss 
> wrote:
> > Hi folks --
> >
> > I'm pleased to announce that we've just released Django 1.6 beta 1,
> > the second in our series of preview releases leading up to Django 1.6
> > (due in August).
> >
> > More information can be found on our blog:
> >
> >
> >
> https://www.djangoproject.com/weblog/2013/jun/28/django-16-beta-1-released/
> >
> > And in the release notes:
> >
> > https://docs.djangoproject.com/en/dev/releases/1.6/
> >
>
> Wow, lots of cool changes for the next release!
> thank you guys for all the great effort !!
>
>
> --
> Marc
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send 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.
> 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.
For more options, visit https://groups.google.com/groups/opt_out.




Get Form from string?

2013-06-28 Thread MacVictor
get the model by string i use:

from django.db.models.loading import get_model
def get_model(self, app_label, model_name, seed_cache=True):

how to get ModelForm by string?

i try used:

modelforms = forms.ModelForm.__subclasses__()

def get_form(form):
try:
for model_form in modelforms:
try:
if model_form.Meta.form == form:
return model_form
except AttributeError:
continue
except IndexError:
print "Does not exist Model Forms for the object"

but I must import the form in which I will seek appropriate by name!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Get Form from string?

2013-06-28 Thread MacVictor
and how to get only Form (not ModelForm) use string name?


W dniu piątek, 28 czerwca 2013 22:09:41 UTC+2 użytkownik MacVictor napisał:
>
> get the model by string i use:
>
> from django.db.models.loading import get_model
> def get_model(self, app_label, model_name, seed_cache=True):
>
> how to get ModelForm by string?
>
> i try used:
>
> modelforms = forms.ModelForm.__subclasses__()
>
> def get_form(form):
> try:
> for model_form in modelforms:
> try:
> if model_form.Meta.form == form:
> return model_form
> except AttributeError:
> continue
> except IndexError:
> print "Does not exist Model Forms for the object"
>
> but I must import the form in which I will seek appropriate by name!
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Get Form from string?

2013-06-28 Thread yeswanth nadella
I am afraid, I did not understand your question. Are you trying to generate 
a form based on your model/ models? 

On Friday, June 28, 2013 3:23:00 PM UTC-5, MacVictor wrote:
>
> and how to get only Form (not ModelForm) use string name?
>
> W dniu piątek, 28 czerwca 2013 22:09:41 UTC+2 użytkownik MacVictor napisał:
>>
>> get the model by string i use:
>>
>> from django.db.models.loading import get_model
>> def get_model(self, app_label, model_name, seed_cache=True):
>>
>> how to get ModelForm by string?
>>
>> i try used:
>>
>> modelforms = forms.ModelForm.__subclasses__()
>>
>> def get_form(form):
>> try:
>> for model_form in modelforms:
>> try:
>> if model_form.Meta.form == form:
>> return model_form
>> except AttributeError:
>> continue
>> except IndexError:
>> print "Does not exist Model Forms for the object"
>>
>> but I must import the form in which I will seek appropriate by name!
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Ajax

2013-06-28 Thread Nafiul Islam
In which version, will Django natively support Ajax? I'm curious because 
you need Ajax for almost any site these days, and Django not supporting it 
natively has become a bit of a hindrance for 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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Ajax

2013-06-28 Thread Russell Keith-Magee
I'm not sure what you mean. Django completely supports AJAX right now.

Django is a server-side framework, and the only part of AJAX that is
server-side is the API call.

An API call is just a view that returns JSON/XML instead of HTML. You can
write that right now in Django.

If you want a library to make it even easier, there are several options,
including TastyPie and Django-REST-Framework.

The client-side part of the AJAX problem is outside the domain of Django.
There are plenty of good client-side frameworks; pick one, and you'll find
it can talk perfectly well with Django.

Yours,
Russ Magee %-)

On Sat, Jun 29, 2013 at 1:52 PM, Nafiul Islam wrote:

> In which version, will Django natively support Ajax? I'm curious because
> you need Ajax for almost any site these days, and Django not supporting it
> natively has become a bit of a hindrance for 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.
> 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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Ajax

2013-06-28 Thread Gamesbrainiac
Then why does itsay on the website that Django does not support Ajax
natively?
On Jun 29, 2013 12:03 PM, "Russell Keith-Magee" 
wrote:

>
> I'm not sure what you mean. Django completely supports AJAX right now.
>
> Django is a server-side framework, and the only part of AJAX that is
> server-side is the API call.
>
> An API call is just a view that returns JSON/XML instead of HTML. You can
> write that right now in Django.
>
> If you want a library to make it even easier, there are several options,
> including TastyPie and Django-REST-Framework.
>
> The client-side part of the AJAX problem is outside the domain of Django.
> There are plenty of good client-side frameworks; pick one, and you'll find
> it can talk perfectly well with Django.
>
> Yours,
> Russ Magee %-)
>
> On Sat, Jun 29, 2013 at 1:52 PM, Nafiul Islam wrote:
>
>> In which version, will Django natively support Ajax? I'm curious because
>> you need Ajax for almost any site these days, and Django not supporting it
>> natively has become a bit of a hindrance for 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.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
>  --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/2oaiisZw_ZY/unsubscribe.
> To unsubscribe from this group and all its topics, send 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.
> 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.
For more options, visit https://groups.google.com/groups/opt_out.