Re: please help me,how to create registration model

2013-02-14 Thread Sergiy Khohlov
all are already done
 Take a look at the builded form :

https://github.com/django/django/blob/master/django/contrib/auth/forms.py

Many thanks,

Serge


+380 636150445
skype: skhohlov


On Fri, Feb 15, 2013 at 8:36 AM, Avnesh Shakya wrote:

> thanks alot...
> tell me about html form, i have created a registration.html form. now i
> want to store these things through its page.. so how can i do? i m nervous
> because i m beginner.. plz tell me ... if any site is available for it plz
> suggest me...
>
>
> On Fri, Feb 15, 2013 at 11:49 AM, Sergiy Khohlov wrote:
>
>> Take a look at the examples
>> https://docs.djangoproject.com/en/dev/topics/auth/default/
>>
>> Many thanks,
>>
>> Serge
>>
>>
>> +380 636150445
>> skype: skhohlov
>>
>>
>> On Fri, Feb 15, 2013 at 7:23 AM, Avnesh Shakya wrote:
>>
>>> please help me,i m beginner i m creating my registration model but how
>>> can i write password field?
>>> thanks in advance...
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users+unsubscr...@googlegroups.com.
>>> To post to this group, send email to django-users@googlegroups.com.
>>> Visit this group at http://groups.google.com/group/django-users?hl=en.
>>> 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?hl=en.
>> 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?hl=en.
> 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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: how to password will come in hidden form in django?

2013-02-14 Thread Jani Tiainen

Hi,

You need to specify widget as PasswordInput on a form if you want to 
show asterisks.


Though using 3rd party package is good option - no need to reinvent wheel.

15.2.2013 8:11, Avnesh Shakya kirjoitti:

i have created my Userinfo model for registration, but password is
showing means it's not filling in hidden form so what will i have to do
for it... please help me

class Userinfo(models.Model):
full_name=models.CharField(max_length=30)
username=models.CharField(max_length=20)
email_address=models.CharField(max_length=75)
password=models.CharField(max_length=255)
reenter_password=models.CharField(max_length=255)
area_of_interest=models.CharField(max_length=255)
def _unicode_(self):
return self.full_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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




--
Jani Tiainen

- Well planned is half done and a half done has been sufficient before...

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




Re: please help me,how to create registration model

2013-02-14 Thread Avnesh Shakya
thanks alot...
tell me about html form, i have created a registration.html form. now i
want to store these things through its page.. so how can i do? i m nervous
because i m beginner.. plz tell me ... if any site is available for it plz
suggest me...

On Fri, Feb 15, 2013 at 11:49 AM, Sergiy Khohlov  wrote:

> Take a look at the examples
> https://docs.djangoproject.com/en/dev/topics/auth/default/
>
> Many thanks,
>
> Serge
>
>
> +380 636150445
> skype: skhohlov
>
>
> On Fri, Feb 15, 2013 at 7:23 AM, Avnesh Shakya wrote:
>
>> please help me,i m beginner i m creating my registration model but how
>> can i write password field?
>> thanks in advance...
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at http://groups.google.com/group/django-users?hl=en.
>> 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?hl=en.
> 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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: please help me,how to create registration model

2013-02-14 Thread Sergiy Khohlov
Take a look at the examples
https://docs.djangoproject.com/en/dev/topics/auth/default/

Many thanks,

Serge


+380 636150445
skype: skhohlov


On Fri, Feb 15, 2013 at 7:23 AM, Avnesh Shakya wrote:

> please help me,i m beginner i m creating my registration model but how can
> i write password field?
> thanks in advance...
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> 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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: how to password will come in hidden form in django?

2013-02-14 Thread Sergiy Khohlov
 Gave you checked django-auth befor start ?
 This module has all for you. You should not code code which is already
coded :-)



Many thanks,

Serge


+380 636150445
skype: skhohlov


On Fri, Feb 15, 2013 at 8:11 AM, Avnesh Shakya wrote:

> i have created my Userinfo model for registration, but password is showing
> means it's not filling in hidden form so what will i have to do for it...
> please help me
>
> class Userinfo(models.Model):
> full_name=models.CharField(max_length=30)
> username=models.CharField(max_length=20)
> email_address=models.CharField(max_length=75)
> password=models.CharField(max_length=255)
> reenter_password=models.CharField(max_length=255)
> area_of_interest=models.CharField(max_length=255)
> def _unicode_(self):
> return self.full_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?hl=en.
> 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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




how to password will come in hidden form in django?

2013-02-14 Thread Avnesh Shakya
i have created my Userinfo model for registration, but password is showing 
means it's not filling in hidden form so what will i have to do for it... 
please help me 

class Userinfo(models.Model):
full_name=models.CharField(max_length=30)
username=models.CharField(max_length=20)
email_address=models.CharField(max_length=75)
password=models.CharField(max_length=255)
reenter_password=models.CharField(max_length=255)
area_of_interest=models.CharField(max_length=255)
def _unicode_(self):
return self.full_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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




please help me,how to create registration model

2013-02-14 Thread Avnesh Shakya
please help me,i m beginner i m creating my registration model but how can 
i write password field? 
thanks in advance...   

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




Bootstrap does not format my templates..

2013-02-14 Thread galvanjg
Hi Guys

I am learning Django and trying to use Bootstrap, I already download 
bootstrap and put it under 'D:\django14\projects\nomina\nom_mex\static', I 
have Django 1.4 and use the developer server "runserver". According 
Django's documentation says referent it I need to use STATICFILES_DIRS and 
STATIC_URL parameters in my settings.py what else do I have to take in 
count to run bootstrap ?, It seems I have something wrong in my settings.py 
or may be in my urls.py,  I left my project's files hoping somebody can 
help me, the template I am testing is the index.html.

I will appreciate any observations or suggestions...

Thanks in advance.

Jose Galvan

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


{% extends "D:/django14/projects/nomina/nom_mex/templates/nom_mex/base.html" %}

{% block content %}
		Lista de empleados  
		{{ static_url }}
		
	{% if lista_empleados %}
		{% for empleado in lista_empleados %}
		{{empleado.nombre}} {{empleado.ap_paterno}} {{empleado.ap_materno}}
		 {% endfor%}
		
		{% else %}	
	
		 No hay empleados registrados !.
	{% endif %}  	
	
	Crear empleado 
	
{% endblock %}
# Create your views here.
from django.shortcuts import render_to_response, get_object_or_404
from nom_mex.forms import EmpleadoForm
from nom_mex.models import Empleado
from django.template import RequestContext
from django.http import HttpResponse



def index(request):
	lista_empleados = Empleado.objects.all().order_by('ap_materno')
	return render_to_response('nom_mex/index.html',{'lista_empleados':lista_empleados})

 
def crea_empleado(request):
	if request.method=='POST': # if method is post then catch the info from the form, validate it and do commit
		form = EmpleadoForm(request.POST)
		if form.is_valid():
			nombre=form.cleaned_data['nombre']
			ap_paterno=form.cleaned_data['ap_paterno']
			ap_materno=form.cleaned_data['ap_materno']
			sexo=form.cleaned_data['sexo']
			fecha_nacimiento=form.cleaned_data['fecha_nacimiento']
			estatura=form.cleaned_data['estatura']
			peso=form.cleaned_data['peso']
			domicilio=form.cleaned_data['domicilio']
			colonia=form.cleaned_data['colonia']
			cod_postal=form.cleaned_data['cod_postal']
			estado=form.cleaned_data['estado']
			pais=form.cleaned_data['pais']
			telefono_1=form.cleaned_data['telefono_1']
			telefono_2=form.cleaned_data['telefono_2']
			buzon_electronico=form.cleaned_data['buzon_electronico']
			rfc=form.cleaned_data['rfc']
			no_seg_social=form.cleaned_data['no_seg_social']
			curp=form.cleaned_data['curp']
			cartilla_militar=form.cleaned_data['cartilla_militar']
			activo=form.cleaned_data['activo']
			e=Empleado()
			e.nombre=nombre
			e.ap_paterno=ap_paterno
			e.ap_materno=ap_materno
			e.sexo=sexo
			e.fecha_nacimiento=fecha_nacimiento
			e.estatura=estatura
			e.peso=peso
			e.domicilio=domicilio
			e.colonia=colonia
			e.cod_postal=cod_postal
			e.estado=estado
			e.pais=pais
			e.telefono_1=telefono_1
			e.telefono_2=telefono_2
			e.buzon_electronico=buzon_electronico
			e.rfc=rfc
			e.no_seg_social=no_seg_social
			e.curp=curp
			e.cartilla_militar=cartilla_militar
			e.activo=activo
			e.save() # Commit to database
			mensaje='Registro Gravado correctamente'
			form=EmpleadoForm()
			lista_empleados = Empleado.objects.all().order_by('ap_materno')
			return render_to_response('nom_mex/index.html',{'lista_empleados':lista_empleados})
		else:
			mensaje="Error en los datos de entrada caray, el registro no fue grabado"
			#form=EmpleadoForm()
			return render_to_response('nom_mex/crea_empleado.html',{'empleado_form':form,'mensaje':mensaje},context_instance=RequestContext(request))
	else:
		form=EmpleadoForm()
		mensaje='Em metodo no fue post'
		return render_to_response('nom_mex/crea_empleado.html', {'empleado_form': form,'mensaje':mensaje},context_instance=RequestContext(request))
	
	
  

 
def edita_empleado(request, empleado_id):
	empleado = get_object_or_404(Empleado,pk=empleado_id)
	form = EmpleadoForm(request.POST or None,instance=empleado)
	if form.is_valid():
		form.cleaned_data['nombre']
		form.cleaned_data['ap_paterno']
		form.cleaned_data['ap_materno']
		form.cleaned_data['sexo']
		form.cleaned_data['fecha_nacimiento']
		form.cleaned_data['estatura']
		form.cleaned_data['peso']
		form.cleaned_data['domicilio']
		form.cleaned_data['colonia']
		form.cleaned_data['cod_postal']
		form.cleaned_data['estado']
		form.cleaned_data['pais']
		form.cleaned_data['telefono_1']
		form.cleaned_data['telefono_2']
		form.cleaned_data['buzon_electronico']
		form.cleaned_data['rfc']
		form.cleaned_data['no_seg_social']
		form.cleaned_data['curp']
		

Re: how do i run project level tests?

2013-02-14 Thread Nikolas Stevenson-Molnar
Just realized I misunderstood your question, sorry. You have test which
cover the project as a whole, rather than individual apps, is that correct?

_Nik

On 2/14/2013 6:02 PM, Nikolas Stevenson-Molnar wrote:
> Why doesn't it make sense to leave them in the app? That's fairly common
> practice. You'll see tests shipped with a lot of 3rd-party apps (and for
> that matter with a lot of code libraries in general). For running the
> tests, see this doc: https://docs.djangoproject.com/en/1.4/topics/testing/
>
> _Nik
>
> On 2/14/2013 4:40 PM, calum mchaffie wrote:
>> I have a django project with a couple apps. Where do i put tests for
>> the project (as it doesnt make sense to have them in an app)? and how
>> do i run them? --
>> You received this message because you are subscribed to the Google
>> Groups "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send
>> 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?hl=en.
>> 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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Is there an easy way to popup forms?

2013-02-14 Thread Felipe Prenholato
This can't be included in Django core because does not have a really
generic solution. AjaxViews like I posted can handle only POST or can also
handle GET and POST, so instead of only reply form with errors also render
initial form on GET. Also, is hard to define a standard for responses... I
like JSON, someone may need WSDL, pure XML, etc. We maybe handle this kind
of issue in some django-ajax-views package better than in core :)

Felipe 'chronos' Prenholato.
Linux User nº 405489
Home page: http://devwithpassion.com | http://chronosbox.org/blog
GitHub: http://github.com/chronossc/ | Twitter: http://twitter.com/chronossc


2013/2/14 Kelly Nicholes 

> I was looking for something like this for CBVs about a week ago!  I'm glad
> this guy posted this question more clearly than mine to get this response.
>  I might try this out!  Thanks.  This is a very common pattern, I've found,
> and wasn't sure why it wasn't included in django's core!
>
>
> On Thursday, February 14, 2013 6:30:27 AM UTC-7, Felipe 'chronos'
> Prenholato wrote:
>
>> I use bootstrap modal with some jquery code.
>>
>> jQuery code isnt hard, on Django side what you need is special treatment
>> for ajax call so you can render template for form (and only form), so you
>> can load it into modal.
>>
>> Fortunately I wrote a AjaxUpdateView yesterday. It is in beta, but check
>> at https://github.com/**chronossc/django-cbv-utils/**blob/**
>> 4d992533925e4bc2e215cbfa8e98d0**7853d65784/cbv_utils/views.py#**L152
>>  ...
>> you will see in form_valid and form_invalid methods that I render the form
>> and return with JSON in response to ajax request.
>>
>> Here is html files and jquery code used with this view:
>> https://gist.github.com/**chronossc/4952775
>>  ...
>> consider it a example :)
>>
>>
>>
>> Felipe 'chronos' Prenholato.
>> Linux User nº 405489
>> Home page: http://devwithpassion.**com  |
>> http://chronosbox.org/**blog 
>> GitHub: http://github.com/chronossc/ | Twitter: http://twitter.com/**
>> chronossc 
>>
>>
>> 2013/2/13 
>>
>>> **
>>> Probably the easiest way is to use a JS/CSS framework that has a good
>>> support for popups and forms. There are a lot out there. I have personal
>>> experience with Bootstrap (one of the most popular these days) - check its
>>> documentation (look for both "popup" and "modal"), also search for
>>> available bootstrap plugins - plenty exist.
>>>
>>> If you wanted to stick with jQuery, check out jQuery UI - a set of
>>> reusable components that might suit your needs.
>>>
>>> HTH
>>>
>>> Jirka
>>> --
>>> *From: * frocco 
>>> *Sender: * django...@googlegroups.com
>>> *Date: *Wed, 13 Feb 2013 11:35:36 -0800 (PST)
>>> *To: *
>>> *ReplyTo: * django...@googlegroups.com
>>> *Cc: *
>>> *Subject: *Re: Is there an easy way to popup forms?
>>>
>>> Thanks Tom,
>>>
>>> Do you know how I would have a form display using this?
>>>
>>>
>>> On Wednesday, February 13, 2013 11:41:59 AM UTC-5, Tom Evans wrote:

 On Wed, Feb 13, 2013 at 4:12 PM, frocco  wrote:
 > I have a form I want to popup and am having trouble getting this to
 work.
 > This is not in the admin page.
 >
 > Can someone give me an example?
 >
 > Thanks
 >

 An easy way to do a pop up form is to use a jqueryui dialog¹

 http://api.jqueryui.com/**dialog**/ 

 Cheers

 Tom

 ¹ Other dialogs are available, consult your local google

>>>  --
>>> You received this message because you are subscribed 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?hl=en
>>> .
>>> 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?hl=en
>>> .
>>> For more options, visit 
>>> 

Re: how do i run project level tests?

2013-02-14 Thread Nikolas Stevenson-Molnar
Why doesn't it make sense to leave them in the app? That's fairly common
practice. You'll see tests shipped with a lot of 3rd-party apps (and for
that matter with a lot of code libraries in general). For running the
tests, see this doc: https://docs.djangoproject.com/en/1.4/topics/testing/

_Nik

On 2/14/2013 4:40 PM, calum mchaffie wrote:
> I have a django project with a couple apps. Where do i put tests for
> the project (as it doesnt make sense to have them in an app)? and how
> do i run them? --
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> 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?hl=en.
> 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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




how do i run project level tests?

2013-02-14 Thread calum mchaffie
I have a django project with a couple apps. Where do i put tests for the 
project (as it doesnt make sense to have them in an app)? and how do i run 
them?

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




Re: Is there an easy way to popup forms?

2013-02-14 Thread Kelly Nicholes
I was looking for something like this for CBVs about a week ago!  I'm glad 
this guy posted this question more clearly than mine to get this response. 
 I might try this out!  Thanks.  This is a very common pattern, I've found, 
and wasn't sure why it wasn't included in django's core!

On Thursday, February 14, 2013 6:30:27 AM UTC-7, Felipe 'chronos' 
Prenholato wrote:
>
> I use bootstrap modal with some jquery code.
>
> jQuery code isnt hard, on Django side what you need is special treatment 
> for ajax call so you can render template for form (and only form), so you 
> can load it into modal.
>
> Fortunately I wrote a AjaxUpdateView yesterday. It is in beta, but check 
> at 
> https://github.com/chronossc/django-cbv-utils/blob/4d992533925e4bc2e215cbfa8e98d07853d65784/cbv_utils/views.py#L152
>  ... 
> you will see in form_valid and form_invalid methods that I render the form 
> and return with JSON in response to ajax request.
>
> Here is html files and jquery code used with this view: 
> https://gist.github.com/chronossc/4952775 ... consider it a example :)
>  
>
>
> Felipe 'chronos' Prenholato.
> Linux User nº 405489
> Home page: http://devwithpassion.com | http://chronosbox.org/blog
> GitHub: http://github.com/chronossc/ | Twitter: 
> http://twitter.com/chronossc
>
>
> 2013/2/13 
>
>> **
>> Probably the easiest way is to use a JS/CSS framework that has a good 
>> support for popups and forms. There are a lot out there. I have personal 
>> experience with Bootstrap (one of the most popular these days) - check its 
>> documentation (look for both "popup" and "modal"), also search for 
>> available bootstrap plugins - plenty exist.
>>
>> If you wanted to stick with jQuery, check out jQuery UI - a set of 
>> reusable components that might suit your needs.
>>
>> HTH
>>
>> Jirka
>> --
>> *From: * frocco  
>> *Sender: * django...@googlegroups.com  
>> *Date: *Wed, 13 Feb 2013 11:35:36 -0800 (PST)
>> *To: *
>> *ReplyTo: * django...@googlegroups.com  
>> *Cc: *
>> *Subject: *Re: Is there an easy way to popup forms?
>>
>> Thanks Tom,
>>
>> Do you know how I would have a form display using this?
>>
>>
>> On Wednesday, February 13, 2013 11:41:59 AM UTC-5, Tom Evans wrote:
>>>
>>> On Wed, Feb 13, 2013 at 4:12 PM, frocco  wrote: 
>>> > I have a form I want to popup and am having trouble getting this to 
>>> work. 
>>> > This is not in the admin page. 
>>> > 
>>> > Can someone give me an example? 
>>> > 
>>> > Thanks 
>>> > 
>>>
>>> An easy way to do a pop up form is to use a jqueryui dialog¹ 
>>>
>>> http://api.jqueryui.com/**dialog/  
>>>
>>> Cheers 
>>>
>>> Tom 
>>>
>>> ¹ Other dialogs are available, consult your local google 
>>>
>>  -- 
>> You received this message because you are subscribed 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?hl=en.
>> 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?hl=en.
>> 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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: A small bug for dynamic choices

2013-02-14 Thread vijay shanker

 code is getting executed when Django validates it's models. Hence, 
Cartprobably has not been validated yet and it's model class is 
None.

On Monday, February 11, 2013 4:29:44 PM UTC+5:30, vijay shanker wrote:
>
> hi 
> i wrote a function for producing tuples of all model names, which is this:
> from django.contrib.contenttypes.models import ContentType
> from django.db.models.loading import get_model
>
> def get_all_models():
> return tuple([(each.__module__+'.'+each.__name__,each.__name__) for 
> each in [each.model_class() for each in 
> ContentType.objects.filter(app_label__in=['products','productoptions','shoppingcart'])
>  
> if each is not None] if each is not None])
> 
> when i run this in my shell it gives this output:
>
> (('shoppingcart.models.Cart', 'Cart'), ('shoppingcart.models.CartItem', 
> 'CartItem'), ('shoppingcart.models.CartRule', 'CartRule'), 
> ('products.models.CasesAccessory', 'CasesAccessory'), 
> ('productoptions.models.Coating', 'Coating'), 
> ('shoppingcart.models.ConditionSet', 'ConditionSet'), 
> ('products.models.Eyeglass', 'Eyeglass'), ('products.models.GiftVoucher', 
> 'GiftVoucher'), ('productoptions.models.Lens', 'Lens'), 
> ('productoptions.models.Prescription', 'Prescription'), 
> ('products.models.Readingglass', 'Readingglass'), 
> ('products.models.Sunglass', 'Sunglass'), ('productoptions.models.Tint', 
> 'Tint'), ('productoptions.models.Vision', 'Vision'))
>
> while at choices my first option got lost and output is:
>
> (('shoppingcart.models.CartItem', 'CartItem'), 
> ('products.models.CasesAccessory', 'CasesAccessory'), 
> ('productoptions.models.Coating', 'Coating'), ('products.models.Eyeglass', 
> 'Eyeglass'), ('products.models.GiftVoucher', 'GiftVoucher'), 
> ('productoptions.models.Lens', 'Lens'), 
> ('productoptions.models.Prescription', 'Prescription'), 
> ('products.models.Readingglass', 'Readingglass'), 
> ('products.models.Sunglass', 'Sunglass'), ('productoptions.models.Tint', 
> 'Tint'), ('productoptions.models.Vision', 'Vision'))
>
> why did this happened and whats the fix ?
>

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




Re: Questions about vim

2013-02-14 Thread yati sagade
Check out this post  by @haridas_n


On Fri, Feb 15, 2013 at 12:02 AM, Trevor Joynson wrote:

> Jedi seems to work the best for me.
>
> My vim config is on my github if you're interested:
> http://github.com/akatrevorjay/dotfiles-vim.got
>  On Feb 12, 2013 6:23 AM, "Yussi"  wrote:
>
>> Hi,
>> I was wondering if there are any vim users here who managed to get a
>> productive working environment for django here.
>>
>> I looked at the manuals, and set myself up with tags, omni complete, and
>> syntax error check, but it's far from ideal. omni complete fails to guess
>> the context correctly most of the time, and is otherwise lacking what I
>> expect from an ide, namely I would like to be able to see function headers
>> when typing so I know what arguments to give it,I would like some short
>> cuts for local variables, I would like some easy vim templates for things
>> like CharField, DateField etc, I am still new to django, and i really don't
>> remember enough to free code everything.
>>
>> any other tip of using vim with django would be appreciated.
>>
>> thanks,
>> Yussi
>>
>> --
>> You received this message because you are subscribed 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?hl=en
>> .
>> 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?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>



-- 
Yati Sagade

Software Engineer at mquotient 


Twitter: @yati_itay  | Github:
yati-sagade

Organizing member of TEDx EasternMetropolitanBypass
http://www.ted.com/tedx/events/4933
https://www.facebook.com/pages/TEDx-EasternMetropolitanBypass/337763226244869

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




Re: Questions about vim

2013-02-14 Thread Trevor Joynson
.git not .got, sorry on a phone
On Feb 14, 2013 1:31 PM, trevorjoyn...@gmail.com wrote:

Jedi seems to work the best for me.

My vim config is on my github if you're interested:
http://github.com/akatrevorjay/dotfiles-vim.got
 On Feb 12, 2013 6:23 AM, "Yussi"  wrote:

Hi,
I was wondering if there are any vim users here who managed to get a
productive working environment for django here.

I looked at the manuals, and set myself up with tags, omni complete, and
syntax error check, but it's far from ideal. omni complete fails to guess
the context correctly most of the time, and is otherwise lacking what I
expect from an ide, namely I would like to be able to see function headers
when typing so I know what arguments to give it,I would like some short
cuts for local variables, I would like some easy vim templates for things
like CharField, DateField etc, I am still new to django, and i really don't
remember enough to free code everything.

any other tip of using vim with django would be appreciated.

thanks,
Yussi

-- 
You received this message because you are subscribed 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?hl=en
.
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Questions about vim

2013-02-14 Thread Trevor Joynson
Jedi seems to work the best for me.

My vim config is on my github if you're interested:
http://github.com/akatrevorjay/dotfiles-vim.got
 On Feb 12, 2013 6:23 AM, "Yussi"  wrote:

> Hi,
> I was wondering if there are any vim users here who managed to get a
> productive working environment for django here.
>
> I looked at the manuals, and set myself up with tags, omni complete, and
> syntax error check, but it's far from ideal. omni complete fails to guess
> the context correctly most of the time, and is otherwise lacking what I
> expect from an ide, namely I would like to be able to see function headers
> when typing so I know what arguments to give it,I would like some short
> cuts for local variables, I would like some easy vim templates for things
> like CharField, DateField etc, I am still new to django, and i really don't
> remember enough to free code everything.
>
> any other tip of using vim with django would be appreciated.
>
> thanks,
> Yussi
>
> --
> You received this message because you are subscribed 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?hl=en
> .
> 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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Is there an easy way to popup forms?

2013-02-14 Thread frocco
I get a popup for the first row only and it will not allow me to close the 
window.

On Wednesday, February 13, 2013 11:12:44 AM UTC-5, frocco wrote:
>
> I have a form I want to popup and am having trouble getting this to work.
> This is not in the admin page.
>
> Can someone give me an example?
>
> 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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Using template fragment caching *inside* a sitewide cache: possible?

2013-02-14 Thread Matt Andrews
Hi Tom,

Yep, you've got the problem right. Reading it back that way I see the issue 
much more clearly...

One approach I thought of: what if, instead of the sitewide caching, I used 
template-fragment caching for *every* view (there aren't that many) and 
invalidated the relevant ones along with the nested caches when needed 
(there are probably only five or so views where this would need to happen)?

I'm on shared hosting so I don't think Varnish is going to be a 
possibility...

thanks!

On Thursday, 14 February 2013 16:02:53 UTC, Tom Evans wrote:
>
> On Mon, Feb 11, 2013 at 1:42 PM, Matt Andrews 
>  
> wrote: 
> > Hi all, 
> > 
> > I've been experimenting with an expensive query I need to call 
> (essentially 
> > grabbing data from some Google APIs). I tried this experiment: 
> > 
> > A sitewide cache with a long (days) expiry time 
> > A template fragment with its own separate cache inside a view cached by 
> the 
> > sitewide cache -- this fragment simply displays the current time. 
> > A view function which clears the named template fragment cache. 
> > 
> > The behaviour I expected was that on first pageload, the fragment would 
> > display the time of page render, and all subsequent reloads would 
> display 
> > the same time. This was true. 
> > 
> > The second part, though, was that I expected to be able to call the view 
> > function to clear the fragment cache and then reload the page to see the 
> > time update. This didn't happen. 
> > 
> > Is it possible to achieve this behaviour? Essentially I want to run a 
> > background cron task which just hits the Google API and updates my 
> cached 
> > fragments - the Google data changes every 15 minutes but the sitewide 
> cache 
> > has several hours timeout, normally. 
> > 
> > Hope this makes sense. 
> > 
> > Matt 
> > 
>
> Hi Matt 
>
> Can I restate the problem to see if I am getting it right? 
>
> You have a page fragment, 'FRAG', stored in the cache. 
> You have a page, 'PAGE', using that fragment stored in the cache. 
> You update 'FRAG' in the cache. 
> You reload 'PAGE', and it has the old contents of 'FRAG' instead of 
> the updated one. 
>
> If so, this is to be expected. The site cache caches entire responses, 
> with a key derived from that request. When a new request comes in, a 
> key is generated from that request. If the key is found in the cache, 
> the cached response is returned. 
>
> At no point does the cache know that one cache entry is built using 
> another, or that invalidating the fragment should invalidate any page 
> containing that fragment. 
>
> One potential solution is to use something like Varnish, an HTTP 
> accelerator/cache that has support for ESI - Edge Side Includes - that 
> allow you to build up responses from multiple components, and 
> intelligently cache the components. Eg, an example of what you are 
> trying to do in Varnish using ESI: 
>
> https://www.varnish-cache.org/trac/wiki/ESIfeatures#Anesi:includeexample 
>
> Alternatively, I may have completely misunderstood this :) 
>
> Cheers 
>
> Tom 
>

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




Re: Is there an easy way to popup forms?

2013-02-14 Thread Felipe Prenholato
You can't put {{ row.sku }} out of id. Try this:

open the dialog

This is a test

 
$( "#dialog{{ row.sku  }}" ).dialog({ autoOpen: false });
$( "#opener" ).click(function() {
$( "#dialog{{ row.sku  }}" ).dialog( "open" );
});


2013/2/14 frocco 

> open the dialog
> 
> This is a test
> 
>  
> $( "#dialog"{{ row.sku  }} ).dialog({ autoOpen: false
> });
> $( "#opener" ).click(function() {
> $( "#dialog"{{ row.sku  }} ).dialog( "open" );
> });
> 
>



Felipe 'chronos' Prenholato.
Linux User nº 405489
Home page: http://devwithpassion.com | http://chronosbox.org/blog
GitHub: http://github.com/chronossc/ | Twitter: http://twitter.com/chronossc

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




Re: Using template fragment caching *inside* a sitewide cache: possible?

2013-02-14 Thread Tom Evans
On Mon, Feb 11, 2013 at 1:42 PM, Matt Andrews  wrote:
> Hi all,
>
> I've been experimenting with an expensive query I need to call (essentially
> grabbing data from some Google APIs). I tried this experiment:
>
> A sitewide cache with a long (days) expiry time
> A template fragment with its own separate cache inside a view cached by the
> sitewide cache -- this fragment simply displays the current time.
> A view function which clears the named template fragment cache.
>
> The behaviour I expected was that on first pageload, the fragment would
> display the time of page render, and all subsequent reloads would display
> the same time. This was true.
>
> The second part, though, was that I expected to be able to call the view
> function to clear the fragment cache and then reload the page to see the
> time update. This didn't happen.
>
> Is it possible to achieve this behaviour? Essentially I want to run a
> background cron task which just hits the Google API and updates my cached
> fragments - the Google data changes every 15 minutes but the sitewide cache
> has several hours timeout, normally.
>
> Hope this makes sense.
>
> Matt
>

Hi Matt

Can I restate the problem to see if I am getting it right?

You have a page fragment, 'FRAG', stored in the cache.
You have a page, 'PAGE', using that fragment stored in the cache.
You update 'FRAG' in the cache.
You reload 'PAGE', and it has the old contents of 'FRAG' instead of
the updated one.

If so, this is to be expected. The site cache caches entire responses,
with a key derived from that request. When a new request comes in, a
key is generated from that request. If the key is found in the cache,
the cached response is returned.

At no point does the cache know that one cache entry is built using
another, or that invalidating the fragment should invalidate any page
containing that fragment.

One potential solution is to use something like Varnish, an HTTP
accelerator/cache that has support for ESI - Edge Side Includes - that
allow you to build up responses from multiple components, and
intelligently cache the components. Eg, an example of what you are
trying to do in Varnish using ESI:

https://www.varnish-cache.org/trac/wiki/ESIfeatures#Anesi:includeexample

Alternatively, I may have completely misunderstood this :)

Cheers

Tom

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




Re: Object composition in django

2013-02-14 Thread Ray Hatfield
Thanks, but I've omitted related_name and I've used distinct related_names and 
gotten the same errors. I don't want to reuse addresses. The one-to-one 
relationship you describe is precisely what I'm trying to do.

On Feb 14, 2013, at 1:32 AM, Jani Tiainen  wrote:

> Hi,
> 
> You're trying to setup one-to-one relationship.
> 
> It means that producer.mailing_address does have exactly one unique Address 
> entity. Same goes for physical_address.
> 
> What you want is really ForeignKey to address which means that you reuse 
> addresses to multiple producer.mailing_address.
> 
> Then you can omit related names, or like someone suggested use different 
> related names for both fields.
> 
> 13.2.2013 21:25, Ray Hatfield kirjoitti:
>> Hi,
>> 
>> I have a model which requires two addresses: a mailing address and a
>> physical address. From an OO perspective it makes sense to have an
>> Address class and the Producer to have Address instances as properties,
>> but I can't seem to achieve this in django while still being able to
>> edit the addresses inline as part of the Producer admin.
>> 
>> I've tried this sort of thing:
>> 
>> class Address( models.Model ):
>> street = models.CharField( ... )
>> # city state zip, etc.
>> 
>> class Producer( models.Model ):
>> mailing_address = models.OneToOneField( Address, related_name='+' )
>> physical_address = models.OneToOneField( Address, related_name='+' )
>> 
>> but when I attempt to inline the addresses in the django admin I run
>> into trouble. I get errors like:
>> 
>>  has no ForeignKey to > 'producers.models.Producer'>
>> 
>> (This error is true, of course. But I was under the apparently erroneous
>> impression that including related_name='+' would prevent django from
>> setting up the reverse relationship.)
>> 
>> I realize I could add a foreign key to Address to associate it with a
>> specific Producer but this feels backwards to me. An Address shouldn't
>> need to know whether it's for a Producer or some other object. It's just
>> an address.
>> 
>> I've been banging my head on this for far too long. Advice?
>> 
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send
>> 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?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>> 
>> 
> 
> 
> -- 
> Jani Tiainen
> 
> - Well planned is half done and a half done has been sufficient before...
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send 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?hl=en.
> 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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Using template fragment caching *inside* a sitewide cache: possible?

2013-02-14 Thread Matt Andrews
Apologies for bumping this thread, but is there anybody with any insight on 
this? Really driving me crazy!

On Monday, 11 February 2013 13:42:05 UTC, Matt Andrews wrote:
>
> Hi all,
>
> I've been experimenting with an expensive query I need to call 
> (essentially grabbing data from some Google APIs). I tried this experiment:
>
>- A sitewide cache with a long (days) expiry time
>- A template fragment with its own separate cache *inside* a view 
>cached by the sitewide cache -- this fragment simply displays the current 
>time.
>- A view function which clears the named template fragment cache.
>
> The behaviour I expected was that on first pageload, the fragment would 
> display the time of page render, and all subsequent reloads would display 
> the same time. This was true.
>
> The second part, though, was that I expected to be able to call the view 
> function to clear the fragment cache and then reload the page to see the 
> time update. This didn't happen.
>
> Is it possible to achieve this behaviour? Essentially I want to run a 
> background cron task which just hits the Google API and updates my cached 
> fragments - the Google data changes every 15 minutes but the sitewide cache 
> has several hours timeout, normally.
>
> Hope this makes sense.
>
> Matt
>

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




Re: Question from a very beginner: Include dynamic template

2013-02-14 Thread Olivier
Thank you for your answer, actually I didn't know I can do this kind of 
things* :D I'm not very familiar with the using of framework !*
Thank you for your help !


Le mercredi 13 février 2013 22:10:37 UTC+1, Daniel Roseman a écrit :
>
> On Wednesday, 13 February 2013 03:52:20 UTC-8, Olivier wrote:
>
>> But before including template ( tasklist-one.html ) I would like to call 
>> a function  which take the tasklist_id and look for the task which compose 
>> the tasklist.
>>
>
> Why? You don't show your models, which would have been useful, but 
> presumably there's a ForeignKey from Task to Tasklist. So instead of 
> passing the tasklist ID to the child template, just pass the actual 
> tasklist object, then you can refer to the tasks via the reverse 
> relationship: {{ tasklist.task_set.all }}
>
> --
> DR.
>

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




Re: Is there an easy way to popup forms?

2013-02-14 Thread frocco
I tried to get this working, but I can only display one box.
How do I do this if I am displaying a list of products?

open the dialog

This is a test

 
$( "#dialog"{{ row.sku  }} ).dialog({ autoOpen: false 
});
$( "#opener" ).click(function() {
$( "#dialog"{{ row.sku  }} ).dialog( "open" );
});

The above is not working

On Wednesday, February 13, 2013 11:12:44 AM UTC-5, frocco wrote:
>
> I have a form I want to popup and am having trouble getting this to work.
> This is not in the admin page.
>
> Can someone give me an example?
>
> 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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: django generate pdf with tables and charts

2013-02-14 Thread Jaimin Patel
Sorry I posted the answer on wrong thread, 

Sure.

I had tried to render PDF with pisa,

template = get_template(template_src)
context = Context(context_dict)
html  = template.render(context)
result = StringIO.StringIO()

pdf = pisa.pisaDocument(StringIO.StringIO(html.encode("ISO-8859-1")), 
result, link_callback=fetch_resources)
if not pdf.err:
return HttpResponse(result.getvalue(), mimetype='application/pdf')
return HttpResponse('Errors%s' % escape(html))

Also tried with wkhtmltopdf -

from wkhtmltopdf.views import PDFTemplateResponse
..
return PDFTemplateResponse(request, 'pdf/pdftemplate.html', {
'pagesize':'A4',
   'user': results['user'],
   'question': results['question_obj'],
   })

In both cases it doesn't render the elements which I am populating with 
help of onload javascript function.

On Wednesday, February 13, 2013 10:45:40 PM UTC-5, ovnicraft wrote:
>
>
>
>
> On Sun, Feb 10, 2013 at 11:10 AM, Jaimin Patel 
>  > wrote:
>
>> I am trying to generate pdf using django template, also need some support 
>> of javascript code. I have tried PISA, ReportLib and wkhtmltopdf but it 
>> seems that it doesn't wait for Javascript. 
>
>
> Hello, can you explain us better what you means with *does not wait for 
> JS* ? 
> I understand you say: pdf is rendered w/o running JS code.
>
> Regards, 
>
>>
>> Can someone suggest good solution or example?
>>
>> -- 
>> You received this message because you are subscribed 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?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>  
>>
>
>
>
> -- 
> Cristian Salamea
> @ovnicraft 
>

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




Re: django generate pdf with tables and charts

2013-02-14 Thread Jaimin Patel
Sure.

I had tried to render PDF with pisa,

template = get_template(template_src)
context = Context(context_dict)
html  = template.render(context)
result = StringIO.StringIO()

pdf = pisa.pisaDocument(StringIO.StringIO(html.encode("ISO-8859-1")), 
result, link_callback=fetch_resources)
if not pdf.err:
return HttpResponse(result.getvalue(), mimetype='application/pdf')
return HttpResponse('Errors%s' % escape(html))

Also tried with wkhtmltopdf -

from wkhtmltopdf.views import PDFTemplateResponse
..
return PDFTemplateResponse(request, 'pdf/pdftemplate.html', {
'pagesize':'A4',
   'user': results['user'],
   'question': results['question_obj'],
   })

In both cases it doesn't render the elements which I am populating with 
help of onload javascript function.

On Wednesday, February 13, 2013 10:45:40 PM UTC-5, ovnicraft wrote:
>
>
>
>
> On Sun, Feb 10, 2013 at 11:10 AM, Jaimin Patel 
>  > wrote:
>
>> I am trying to generate pdf using django template, also need some support 
>> of javascript code. I have tried PISA, ReportLib and wkhtmltopdf but it 
>> seems that it doesn't wait for Javascript. 
>
>
> Hello, can you explain us better what you means with *does not wait for 
> JS* ? 
> I understand you say: pdf is rendered w/o running JS code.
>
> Regards, 
>
>>
>> Can someone suggest good solution or example?
>>
>> -- 
>> You received this message because you are subscribed 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?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>  
>>
>
>
>
> -- 
> Cristian Salamea
> @ovnicraft 
>

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




Re: Multiple sites and inheritance

2013-02-14 Thread Avraham Serour
I'm not sure you can inherit the whole project, in any case I believe you
could make a boilerplate project and override whatever settings or models
as needed.


On Thu, Feb 14, 2013 at 11:25 AM, Jonathan ATTON
wrote:

> Hello,
>
> I currently have a website made with Django. I use models, databases,
> admin ...
>
> Now I need to create two new sites based on this first site. The first
> site will become a abstract site.
>
> I will have to do some differents update on these two new sites: add
> attributs, update admin pages, ...
>
>
> Can you help me to find the best way to do this ?
>
> My first idea was to use inheritance but some poblems appears. The main
> problem is that in my abastract site I have reference to the abstract class
> and not to the new class.
>
> In C# the keyword 'new' allow to do something closed to what I need: add
> attributs, methods ... to an existing class.
>
> Thank you.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> 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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Is there an easy way to popup forms?

2013-02-14 Thread Felipe Prenholato
I use bootstrap modal with some jquery code.

jQuery code isnt hard, on Django side what you need is special treatment
for ajax call so you can render template for form (and only form), so you
can load it into modal.

Fortunately I wrote a AjaxUpdateView yesterday. It is in beta, but check at
https://github.com/chronossc/django-cbv-utils/blob/4d992533925e4bc2e215cbfa8e98d07853d65784/cbv_utils/views.py#L152
...
you will see in form_valid and form_invalid methods that I render the form
and return with JSON in response to ajax request.

Here is html files and jquery code used with this view:
https://gist.github.com/chronossc/4952775 ... consider it a example :)



Felipe 'chronos' Prenholato.
Linux User nº 405489
Home page: http://devwithpassion.com | http://chronosbox.org/blog
GitHub: http://github.com/chronossc/ | Twitter: http://twitter.com/chronossc


2013/2/13 

> **
> Probably the easiest way is to use a JS/CSS framework that has a good
> support for popups and forms. There are a lot out there. I have personal
> experience with Bootstrap (one of the most popular these days) - check its
> documentation (look for both "popup" and "modal"), also search for
> available bootstrap plugins - plenty exist.
>
> If you wanted to stick with jQuery, check out jQuery UI - a set of
> reusable components that might suit your needs.
>
> HTH
>
> Jirka
> --
> *From: * frocco 
> *Sender: * django-users@googlegroups.com
> *Date: *Wed, 13 Feb 2013 11:35:36 -0800 (PST)
> *To: *
> *ReplyTo: * django-users@googlegroups.com
> *Cc: *
> *Subject: *Re: Is there an easy way to popup forms?
>
> Thanks Tom,
>
> Do you know how I would have a form display using this?
>
>
> On Wednesday, February 13, 2013 11:41:59 AM UTC-5, Tom Evans wrote:
>>
>> On Wed, Feb 13, 2013 at 4:12 PM, frocco  wrote:
>> > I have a form I want to popup and am having trouble getting this to
>> work.
>> > This is not in the admin page.
>> >
>> > Can someone give me an example?
>> >
>> > Thanks
>> >
>>
>> An easy way to do a pop up form is to use a jqueryui dialog¹
>>
>> http://api.jqueryui.com/**dialog/ 
>>
>> Cheers
>>
>> Tom
>>
>> ¹ Other dialogs are available, consult your local google
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send 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?hl=en.
> 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?hl=en.
> 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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Announce: DjangoSprint 13.2 in Japan.

2013-02-14 Thread Hiroki Kiyohara
To: Django guys.

Hello, I am Hiroki Kiyohara.
I will let you know the holding of DjangoSprint in Japan.

The detail page about this event is here (in Japanese, sorry)
http://djangoproject.jp/weblog/2013/02/14/djangosprint_13_2/

I will write a report about this event to this djangoja weblog (yes, both in 
English and Japanese).

Thank you.

--
清原弘貴 (Hiroki KIYOHARA)
mail: hirok...@gmail.com
http://hirokiky.org/
@hirokiky

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




Updated Django by Example tutorials

2013-02-14 Thread hoffman
Let me express my many Appreciations for your time & efforts for excellent 
Django by Example compilation.

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




Multiple sites and inheritance

2013-02-14 Thread Jonathan ATTON
Hello,

I currently have a website made with Django. I use models, databases, admin 
...

Now I need to create two new sites based on this first site. The first site 
will become a abstract site. 

I will have to do some differents update on these two new sites: add 
attributs, update admin pages, ...


Can you help me to find the best way to do this ?

My first idea was to use inheritance but some poblems appears. The main 
problem is that in my abastract site I have reference to the abstract class 
and not to the new class.

In C# the keyword 'new' allow to do something closed to what I need: add 
attributs, methods ... to an existing class.

Thank you.

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




Re: django generate pdf with tables and charts

2013-02-14 Thread Frank Bieniek

Checkout happypdf.com
rest call to create your pdfs

Am 14.02.2013 04:28, schrieb Waitman Gobble:



On Feb 10, 2013 8:11 AM, "Jaimin Patel" > wrote:

>
> I am trying to generate pdf using django template, also need some 
support of javascript code. I have tried PISA, ReportLib and 
wkhtmltopdf but it seems that it doesn't wait for Javascript.

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

You could send a request using Ajax, to a cgi program on the server, 
and include the URL. The program would pull the content and convert to 
pdf, then return the URL of the document. If the user has to be 
authenticated to view the content, then you would have to pass the 
authentication key to the CGI program. You may find something like 
html2pdf will do the conversion, there are free and non-free programs 
available.


Waitman Gobble
San Jose California USA

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




select_related() estrange behaviour

2013-02-14 Thread nsbk
Hi, I am using select_related in a loop in order to reduce database hits. 
The weird thing is that I get a different result set when using 
select_related();

This is not the actual code, but a simple example that illustrates the 
problem:

>>> rr = 
> RouteTableRangeProvider.objects.filter(routetablerange__routetable__id=219,routetablerange__numberingrange__id=21366)
> >>> for r in rr:
> ...   print r.provider.id
> ... 
> 5
> 3
> >>> rr = 
> RouteTableRangeProvider.objects.select_related().filter(routetablerange__routetable__id=219,routetablerange__numberingrange__id=21366)
> >>> for r in rr:
> ...   print r.provider.id
> ... 
> 5
> >>>


None of the FK allows null values. Any ideas of what can be going on?

Regards,

-- Pedro



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