Re: I don't understand whats wrong with the way im passing django list to json

2014-07-29 Thread Tom Evans
On Tue, Jul 29, 2014 at 12:10 AM, G Z  wrote:
> so I'm trying to display some vm performance data on javascript charts. It
> needs the information as a list, I have tried passing a json list from
> django and a django list like below in the javascript i ahve the one they
> tell me to use and the one im trying the one they tell me to use works
> obviously and i kept it there as reference to see how it needs to be input.
> How do I get the variables between django and javascript in an acceptable
> way?
>
>
>
>
>  for stat in vm_stats:
>  cpu_values.append(stat[4])
>   cpu_json = simplejson.dumps(cpu_values)
>
>   context = Context({'user.is_superuser':user.is_superuser,
> 'customers':customers,
> 'vms': vms,
> 'vm_stats': vm_stats,
> 'customer_id': customer_id,
> 'cpu_json':cpu_json,
>
>
>  })
>
>
> 
> 
> var randomScalingFactor = function(){ return Math.round(Math.random()*100)};
> var lineChartData = {
> labels : ["January","February","March","April","May","June","July"],
> datasets : [
> {
> label: "My First dataset",
> fillColor : "rgba(220,220,220,0.2)",
> strokeColor : "rgba(220,220,220,1)",
> pointColor : "rgba(220,220,220,1)",
> pointStrokeColor : "#fff",
> pointHighlightFill : "#fff",
> pointHighlightStroke : "rgba(220,220,220,1)",
> data : [{{cpu_json}}]
> },
> {
> label: "My Second dataset",
> fillColor : "rgba(151,187,205,0.2)",
> strokeColor : "rgba(151,187,205,1)",
> pointColor : "rgba(151,187,205,1)",
> pointStrokeColor : "#fff",
> pointHighlightFill : "#fff",
> pointHighlightStroke : "rgba(151,187,205,1)",
> data :
> [randomScalingFactor(),randomScalingFactor(),randomScalingFactor(),randomScalingFactor(),randomScalingFactor(),randomScalingFactor(),randomScalingFactor()]
> }
> ]
>
> }
>
> window.onload = function(){
> var ctx = document.getElementById("canvas").getContext("2d");
> window.myLine = new Chart(ctx).Line(lineChartData, {
> responsive: true
> });
> }
>
>
> 
>

It doesn't seem like you have done much to debug this yet.

When you look at the generated javascript, does your "data" property
look the same type as the examples, or does it look different. Hint,
in your "My Second dataset", "data" is an array of values - is it an
array of values in "My First dataset".

Cheers

Tom

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


Re: How do I test my Django App on my Phone

2014-07-29 Thread vickster


//On the terminal type the below line.

sudo python manage.py runserver 0.0.0.0:80

//type your password

//on your phone you only need to open the browser and on the search bar 
input the network's ip address (both devices should be connected to the 
same network)


Voila!

El martes, 10 de diciembre de 2013 03:44:08 UTC+9, Muhammad Ali escribió:
>
> Hello,
>
> I'm developing a Django-powered blog, with two versions: a desktop version 
> and a mobile I optimized version for when it is accessed through a mobile 
> device.
>
> Now, I'm trying to test it on my Samsung phone to see how it would look 
> and act like when someone uses it through a mobile phone's browser [iPhone, 
> Android, etc.]
>
> Instructions I found online (such as this one: ) say that I should plug 
> the phone to the computer through a USB and run: manage.py runser 
> 0.0.0.0:8000 and visit this IP address via my phone's browser. But it 
> doesn't work and instead returns an error:
>
> "Oops! Google Chrome could not connect to 0.0.0.0:8000" 
>
> What am I missing in the setup? What are other, if any, alternative ways 
> of testing my Django app on my phone during development?
>
> Thank you for your time and help.
>
> Sincerely,
> Muhammad
>
>

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


Compositional Templates Django

2014-07-29 Thread Secret


What is the best way to create modular templates?

For example, if I have something like this:

#base file:{header}{block content}{footer}
#main file:{extends base}{block content definition}
#product file:{extends base}{block content definition}

This is the django way from what I understand - filling in the blanks.

Now, my question is what if I needed a page like this:

{header}{main}{product}{footer}

Basically, the main, and product are both inside the base file. I could try 
a deep inherit (a page that has main, which then consecutively loads 
product) but that does not work since the files both define 'content', and 
that is not possible in Django

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


simultaneously submit three forms on the same page

2014-07-29 Thread Devin Cky
*hi i am a beginner in django and I have a problem .. how can I validate 3 
forms on the same page **simultaneously ..please help me*

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/146660c0-083a-452b-b519-206c8bb2a1c2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Using Django as a centralised auth server?

2014-07-29 Thread Stodge
I have several Django websites and I want to create a centralized auth 
provider. The auth provider site would contain the user accounts and be the 
only repository for user details and passwords. Users would log into the 
auth provider site and when they visit each satellite website for the first 
time, an account is created on that site. Subsequent visits to the 
satellite site would result in them being sent to the auth provider site to 
login first. On returning they are automatically logged in to the satellite 
site. My only difficulty is that the auth provider site would be on the 
internet and the satellite sites are in DMZs on private networks with 
access to the internet. So the satellite sites cannot establish any 
outgoing connections to the auth provider.

Is oauth2 the right solution? I just found the cas-provider so I'll read up 
on that. Are there any better or more appropriate alternatives?

Thanks

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


Re: simultaneously submit three forms on the same page

2014-07-29 Thread Babatunde Akinyanmi
Hi Devin,

On 29 Jul 2014 12:33, "Devin Cky"  wrote:
>
> hi i am a beginner in django and I have a problem .. how can I validate 3
forms on the same page simultaneously ..please help me
>

This is what formsets were made for.

> --
> You received this message because you are subscribed to the Google Groups
"Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/146660c0-083a-452b-b519-206c8bb2a1c2%40googlegroups.com
.
> For more options, visit https://groups.google.com/d/optout.

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


Re: simultaneously submit three forms on the same page

2014-07-29 Thread Tom Evans
On Tue, Jul 29, 2014 at 12:31 PM, Devin Cky  wrote:
> hi i am a beginner in django and I have a problem .. how can I validate 3
> forms on the same page simultaneously ..please help me
>

If they are different types of forms, you cannot use a formset.

In that case, just test whether all forms are valid. If they are all
valid, save/process the forms. If not, re-render the page with the
bound forms and display the errors.

Eg

def myview(request):
  if request.method == 'POST':
form_a = FormA(request.POST)
form_b = FormB(request.POST)
form_c = FormC(request.POST)
if form_a.is_valid() and form_b.is_valid() and form_c.is_valid():
  form_a.save()
  
  return HttpResponseRedirect(...)
  else:
form_a = FormA()
form_b = FormB()
form_c = FormC()
  return render(...)

Cheers

Tom

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


Re: Compositional Templates Django

2014-07-29 Thread Tom Evans
On Tue, Jul 29, 2014 at 9:41 AM, Secret  wrote:
> What is the best way to create modular templates?
>
> For example, if I have something like this:
>
> #base file:
> {header}
> {block content}
> {footer}
>
> #main file:
> {extends base}
> {block content definition}
>
> #product file:
> {extends base}
> {block content definition}
>
> This is the django way from what I understand - filling in the blanks.
>
> Now, my question is what if I needed a page like this:
>
> {header}
> {main}
> {product}
> {footer}
>
> Basically, the main, and product are both inside the base file. I could try
> a deep inherit (a page that has main, which then consecutively loads
> product) but that does not work since the files both define 'content', and
> that is not possible in Django
>

If product is a specialisation of main, then it should extend main and
not base. If it is not, I do not understand the question.

It is common to define your base page style, without any content
layout or menu system at all, extend that to add basic layout and
menu, extend *that* to add a specific layout style, and then extend
that for each page in that style that has specific template needs.

Cheers

Tom

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


Re: simultaneously submit three forms on the same page

2014-07-29 Thread John
How can one submit 3 forms simultaneously?? Even ajax, is on by one!

Sent from my iPhone

> On Jul 29, 2014, at 08:46, Babatunde Akinyanmi  wrote:
> 
> Hi Devin,
> 
> On 29 Jul 2014 12:33, "Devin Cky"  wrote:
> >
> > hi i am a beginner in django and I have a problem .. how can I validate 3 
> > forms on the same page simultaneously ..please help me
> >
> 
> This is what formsets were made for.
> 
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "Django users" group.
> > To unsubscribe from this group and stop receiving emails from it, send an 
> > email to django-users+unsubscr...@googlegroups.com.
> > To post to this group, send email to django-users@googlegroups.com.
> > Visit this group at http://groups.google.com/group/django-users.
> > To view this discussion on the web visit 
> > https://groups.google.com/d/msgid/django-users/146660c0-083a-452b-b519-206c8bb2a1c2%40googlegroups.com.
> > For more options, visit https://groups.google.com/d/optout.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/CA%2BWjgXN%3DN5LiLtHjAkUtKEqfnXnPg8wP%3D8_TojUYeiTEyex0tA%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.

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


user object's is_authenticated() method ALWAYS return True even after they log out??

2014-07-29 Thread Chris Seberino
I tried viewing the value of is_authenticated() for a user and it always is 
true...before and after logging in and after signing out.

I'm trying to determine if a user has logged in or not.  Is this the right 
variable to use?  Why not changing?

Thanks.


cs

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


Re: user object's is_authenticated() method ALWAYS return True even after they log out??

2014-07-29 Thread Andreas Kuhne
Hi Chris,

is_authenticated() on a User should always be true. The reason for this is
that you check the function on the request.user object. When a user is
logged in, it will be true, however, the AnonymousUser returns false, which
is the default when a user has not logged in.

So you can only check it in a view.

Regards,

Andréas


2014-07-29 17:08 GMT+02:00 Chris Seberino :

> I tried viewing the value of is_authenticated() for a user and it always
> is true...before and after logging in and after signing out.
>
> I'm trying to determine if a user has logged in or not.  Is this the right
> variable to use?  Why not changing?
>
> Thanks.
>
>
> cs
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/a1ac670d-1406-452b-8868-aefd70d3e7cf%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: simultaneously submit three forms on the same page

2014-07-29 Thread Santiago Lamora
2014-07-29 16:50 GMT+02:00 John :

> How can one submit 3 forms simultaneously?? Even ajax, is on by one!
>
>
Quotting
https://docs.djangoproject.com/en/dev/ref/forms/api/#prefixes-for-forms
> You can put several Django forms inside one  tag. To give each Form its
own namespace, use the prefix keyword argument:

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


Re: I don't understand whats wrong with the way im passing django list to json

2014-07-29 Thread G Z

>
> Tom, I have done alot actually,


I have put the data into a json array, a list, a tupple, a dictionary. I 
have tried the following:
my data has been passed in every possible way I can think of. What I need 
to know how to do is convert a python list I pass with django to a 
javascript list because I believe that will correct the problem. Yes you 
are correct if I look at the second one [1,2,3,45,5] is how the data is 
ordered ie it is a list, however my data passes exactly the same.



var randomScalingFactor = function(){ return Math.round(Math.random()*100)};
var lineChartData = {
labels : ["1000","2000","3000","4000","5000","6000","7000", "8000", "9000", 
"1", "11000", "12000", "13000", "14000", "15000",],
datasets : [
{
label: "CPU Usage in MHZ",
fillColor : "rgba(220,220,220,0.2)",
strokeColor : "rgba(220,220,220,1)",
pointColor : "rgba(220,220,220,1)",
pointStrokeColor : "#fff",
pointHighlightFill : "#fff",
pointHighlightStroke : "rgba(220,220,220,1)",
data : [{{Json_data}}]
data : {{json_data}}
data : {{tupple_array}}
data : {{ list }}
data : [ {{tupple_data }} ]
data : [ {{ list }} ]

} 
]

}

window.onload = function(){
var ctx = document.getElementById("canvas").getContext("2d");
window.myLine = new Chart(ctx).Line(lineChartData, {
responsive: true
});
}



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


Re: I don't understand whats wrong with the way im passing django list to json

2014-07-29 Thread G Z
fixed it i was passing strings and not integers



var randomScalingFactor = function(){ return Math.round(Math.random()*100)};
var lineChartData = {
labels : ["1000","2000","3000","4000","5000","6000","7000", "8000", "9000", 
"1", "11000", "12000", "13000", "14000", "15000",],
datasets : [
{
label: "CPU Usage in MHZ",
fillColor : "rgba(220,220,220,0.2)",
strokeColor : "rgba(220,220,220,1)",
pointColor : "rgba(220,220,220,1)",
pointStrokeColor : "#fff",
pointHighlightFill : "#fff",
pointHighlightStroke : "rgba(220,220,220,1)",
data : {{cpu_values}}
}
]

}

window.onload = function(){
var ctx = document.getElementById("canvas").getContext("2d");
window.myLine = new Chart(ctx).Line(lineChartData, {
responsive: true
});
}



-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/1b6ea547-7c07-469b-921c-f089b3e7c7d8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: I don't understand whats wrong with the way im passing django list to json

2014-07-29 Thread G Z
["2014-07-28 14:24:11", "2014-07-28 14:24:11"]

On Monday, July 28, 2014 5:10:50 PM UTC-6, G Z wrote:
>
> so I'm trying to display some vm performance data on javascript charts. It 
> needs the information as a list, I have tried passing a json list from 
> django and a django list like below in the javascript i ahve the one they 
> tell me to use and the one im trying the one they tell me to use works 
> obviously and i kept it there as reference to see how it needs to be input. 
> How do I get the variables between django and javascript in an acceptable 
> way?
>
>
>
>
>  for stat in vm_stats:
>  cpu_values.append(stat[4])
>   cpu_json = simplejson.dumps(cpu_values)
>   
>   context = Context({'user.is_superuser':user.is_superuser, 
> 'customers':customers,
> 'vms': vms,
> 'vm_stats': vm_stats,
> 'customer_id': customer_id,
> 'cpu_json':cpu_json,
>
> 
>  })
>
>
> 
> 
> var randomScalingFactor = function(){ return 
> Math.round(Math.random()*100)};
> var lineChartData = {
> labels : ["January","February","March","April","May","June","July"],
> datasets : [
> {
> label: "My First dataset",
> fillColor : "rgba(220,220,220,0.2)",
> strokeColor : "rgba(220,220,220,1)",
> pointColor : "rgba(220,220,220,1)",
> pointStrokeColor : "#fff",
> pointHighlightFill : "#fff",
> pointHighlightStroke : "rgba(220,220,220,1)",
> data : [{{cpu_json}}]
> },
> {
> label: "My Second dataset",
> fillColor : "rgba(151,187,205,0.2)",
> strokeColor : "rgba(151,187,205,1)",
> pointColor : "rgba(151,187,205,1)",
> pointStrokeColor : "#fff",
> pointHighlightFill : "#fff",
> pointHighlightStroke : "rgba(151,187,205,1)",
> data : 
> [randomScalingFactor(),randomScalingFactor(),randomScalingFactor(),randomScalingFactor(),randomScalingFactor(),randomScalingFactor(),randomScalingFactor()]
> }
> ]
>
> }
>
> window.onload = function(){
> var ctx = document.getElementById("canvas").getContext("2d");
> window.myLine = new Chart(ctx).Line(lineChartData, {
> responsive: true
> });
> }
>
>
> 
>

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


Re: I don't understand whats wrong with the way im passing django list to json

2014-07-29 Thread G Z
the values will show how, but i ran into another problem while trying to 
input the labels, labels need to be strings so I input them as an array 
such as the following: ["2014-07-28 14:24:11", "2014-07-28 14:24:11"] I 
saved it as a simple json in django and pass it to the webbrowser and then 
conver the json to a javascript value and pass that as the labels. Normally 
labels is ['sdfsdf','sdfsfs'] which is exactly how I pass mine Ive passed 
with "" and '' it doesn't matter. I'm trying to use the datetimes as the 
graph labels.


 
var dates = JSON.parse("{{ date_values }}");
var lineChartData = {
labels : [dates],
datasets : [
{
label: "CPU Usage in MHZ",
fillColor : "rgba(220,220,220,0.2)",
strokeColor : "rgba(220,220,220,1)",
pointColor : "rgba(220,220,220,1)",
pointStrokeColor : "#fff",
pointHighlightFill : "#fff",
pointHighlightStroke : "rgba(220,220,220,1)",
data : {{cpu_values}}
}
]

}

window.onload = function(){
var ctx = document.getElementById("canvas").getContext("2d");
window.myLine = new Chart(ctx).Line(lineChartData, {
responsive: true
});
}



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


Re: simultaneously submit three forms on the same page

2014-07-29 Thread Devin Cky


On Tuesday, July 29, 2014 1:48:00 PM UTC, Tom Evans wrote:
>
> On Tue, Jul 29, 2014 at 12:31 PM, Devin Cky  > wrote: 
> > hi i am a beginner in django and I have a problem .. how can I validate 
> 3 
> > forms on the same page simultaneously ..please help me 
> > 
>
> If they are different types of forms, you cannot use a formset. 
>
> In that case, just test whether all forms are valid. If they are all 
> valid, save/process the forms. If not, re-render the page with the 
> bound forms and display the errors. 
>
> Eg 
>
> def myview(request): 
>   if request.method == 'POST': 
> form_a = FormA(request.POST) 
> form_b = FormB(request.POST) 
> form_c = FormC(request.POST) 
> if form_a.is_valid() and form_b.is_valid() and form_c.is_valid(): 
>   form_a.save() 
>    
>   return HttpResponseRedirect(...) 
>   else: 
> form_a = FormA() 
> form_b = FormB() 
> form_c = FormC() 
>   return render(...) 
>
> Cheers 
>
> Tom 
>





---thank you TOM--- 
  when I submit my forms .. no field is validated


...view.



def enregistrer(request):
if request.method == 'POST': 
emet_form = EmetteurForm(request.POST, prefix = "emet")
des_form = DestinataireForm(request.POST, prefix = "des")
fich_form = FichierForm(request.POST, prefix = "fich")
if emet_form.is_valid() and des_form.is_valid() and 
fich_form.is_valid(): 
civilite = emet_form.cleaned_data.get('civilite')
nom = emet_form.cleaned_data.get('nom')
prenom = emet_form.cleaned_data.get('prenom')

cni = emet_form.cleaned_data.get('cni')
mail = emet_form.cleaned_data.get('mail')
telephone = emet_form.cleaned_data.get('telephone')
pays = emet_form.cleaned_data.get('pays')
ville = emet_form.cleaned_data.get('ville')
quartier = emet_form.cleaned_data.get('quartier')
emet = emet_form.save()
nom = des_form.cleaned_data.get('nom')
prenom = des_form.cleaned_data.get('prenom')
mail = des_form.cleaned_data.get('mail')  
telephone = des_form.cleaned_data.get('telephone')
des = des_form.save()
description_fichier = 
fich_form.cleaned_data.get('description_fichier')
date_enregistrement = 
fich_form.cleaned_data.get('date_enregistrement')
observation = fich_form.cleaned_data.get('observation')
montant_prestation = 
fich_form.cleaned_data.get('montant_prestation')
fich = fich_form.save()
else:
emet_form = EmetteurForm()
des_form = DestinataireForm()
fich_form = FichierForm() 

return 
render(request,'formulaire/information.html',locals())
//***please look ..if my view is good***//

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


Django views for handling blobstore uploads

2014-07-29 Thread Gábor Major
Hi!

I'm using Django 1.5 with Python 2.7 running in Google App Engine. I got 
into this project recently, the former programmers didn't use the webapp 
framework, but now I have to be able to make file upload possible with 
large files (GAE doesn't allow more than 1 MB). I tried to make blobstore 
work, but I couldn't, then I started looking into this stuff and found this 
patch:

https://code.djangoproject.com/ticket/13721

Is it possible to make this patch work with GAE?

Thanks in advance!

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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/2efe17c0-5948-406e-99eb-7eaaeba2dfdc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


plz help me to learn django

2014-07-29 Thread Soumya Verma

 i m a beginner in this area, plz help me to learn this. i dnt know how to 
create django project...:(

> 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/68f3d8d2-1005-412d-9014-8bf53b54cdfa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: plz help me to learn django

2014-07-29 Thread François Schiettecatte
Two great resources:

https://www.djangoproject.com

https://docs.djangoproject.com/en/1.6/intro/tutorial01/

http://www.djangobook.com/en/2.0/index.html

François

On Jul 29, 2014, at 1:13 PM, Soumya Verma  wrote:

> 
>  i m a beginner in this area, plz help me to learn this. i dnt know how to 
> create django project...:(
> 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.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/68f3d8d2-1005-412d-9014-8bf53b54cdfa%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

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


asyncio integration /benefits & performance

2014-07-29 Thread sastry mln
Hi All,
   
   Recently there was a presentation in our company about node.js and 
the success stories of using it in walmart and linkedin (it was 2 years old 
story but news to me). And i started googling about this concept of 
asychronous I/O and bumped into youtube video about *asyncio *by Guido
   
   Can and will django use asyncio or any other asyc framework like 
twisted? will django or django apps benefit by using this new asyncio api?

   Was any performance studies done to compare django with node

Please share your experiences in this area

-regards

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


Re: simultaneously submit three forms on the same page

2014-07-29 Thread C. Kirby
They are not getting validated, or validation is failing.
Also, it looks like you are using model forms. You can get rid of all the 
for,.cleaned_data.get lines and just use:

if emet_form.is_valid() and des_form.is_valid() and fich_form.is_valid(): 
  emet = emet_form.save()
  des = des_form.save()
  fich = fich_form.save()

On Tuesday, July 29, 2014 10:53:59 AM UTC-5, Devin Cky wrote:
>
>
>
> On Tuesday, July 29, 2014 1:48:00 PM UTC, Tom Evans wrote:
>>
>> On Tue, Jul 29, 2014 at 12:31 PM, Devin Cky  wrote: 
>> > hi i am a beginner in django and I have a problem .. how can I validate 
>> 3 
>> > forms on the same page simultaneously ..please help me 
>> > 
>>
>> If they are different types of forms, you cannot use a formset. 
>>
>> In that case, just test whether all forms are valid. If they are all 
>> valid, save/process the forms. If not, re-render the page with the 
>> bound forms and display the errors. 
>>
>> Eg 
>>
>> def myview(request): 
>>   if request.method == 'POST': 
>> form_a = FormA(request.POST) 
>> form_b = FormB(request.POST) 
>> form_c = FormC(request.POST) 
>> if form_a.is_valid() and form_b.is_valid() and form_c.is_valid(): 
>>   form_a.save() 
>>    
>>   return HttpResponseRedirect(...) 
>>   else: 
>> form_a = FormA() 
>> form_b = FormB() 
>> form_c = FormC() 
>>   return render(...) 
>>
>> Cheers 
>>
>> Tom 
>>
>
>
>
>
>
> ---thank you TOM--- 
>   when I submit my forms .. no field is validated
>
>
> ...view.
>
>
>
> def enregistrer(request):
> if request.method == 'POST': 
> emet_form = EmetteurForm(request.POST, prefix = "emet")
> des_form = DestinataireForm(request.POST, prefix = "des")
> fich_form = FichierForm(request.POST, prefix = "fich")
> if emet_form.is_valid() and des_form.is_valid() and 
> fich_form.is_valid(): 
> civilite = emet_form.cleaned_data.get('civilite')
> nom = emet_form.cleaned_data.get('nom')
> prenom = emet_form.cleaned_data.get('prenom')
> 
> cni = emet_form.cleaned_data.get('cni')
> mail = emet_form.cleaned_data.get('mail')
> telephone = emet_form.cleaned_data.get('telephone')
> pays = emet_form.cleaned_data.get('pays')
> ville = emet_form.cleaned_data.get('ville')
> quartier = emet_form.cleaned_data.get('quartier')
> emet = emet_form.save()
> nom = des_form.cleaned_data.get('nom')
> prenom = des_form.cleaned_data.get('prenom')
> mail = des_form.cleaned_data.get('mail')  
> telephone = des_form.cleaned_data.get('telephone')
> des = des_form.save()
> description_fichier = 
> fich_form.cleaned_data.get('description_fichier')
> date_enregistrement = 
> fich_form.cleaned_data.get('date_enregistrement')
> observation = fich_form.cleaned_data.get('observation')
> montant_prestation = 
> fich_form.cleaned_data.get('montant_prestation')
> fich = fich_form.save()
> else:
> emet_form = EmetteurForm()
> des_form = DestinataireForm()
> fich_form = FichierForm() 
> 
> return 
> render(request,'formulaire/information.html',locals())
> //***please look ..if my view is good***//
>

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


Re: simultaneously submit three forms on the same page

2014-07-29 Thread C. Kirby


They are not getting validated, or validation is failing?
Also, it looks like you are using model forms. You can get rid of all the 
for,.cleaned_data.get lines and just use:

if emet_form.is_valid() and des_form.is_valid() and fich_form.is_valid(): 
  emet = emet_form.save()
  des = des_form.save()
  fich = fich_form.save()


On Tuesday, July 29, 2014 10:53:59 AM UTC-5, Devin Cky wrote:
>
>
>
> On Tuesday, July 29, 2014 1:48:00 PM UTC, Tom Evans wrote:
>>
>> On Tue, Jul 29, 2014 at 12:31 PM, Devin Cky  wrote: 
>> > hi i am a beginner in django and I have a problem .. how can I validate 
>> 3 
>> > forms on the same page simultaneously ..please help me 
>> > 
>>
>> If they are different types of forms, you cannot use a formset. 
>>
>> In that case, just test whether all forms are valid. If they are all 
>> valid, save/process the forms. If not, re-render the page with the 
>> bound forms and display the errors. 
>>
>> Eg 
>>
>> def myview(request): 
>>   if request.method == 'POST': 
>> form_a = FormA(request.POST) 
>> form_b = FormB(request.POST) 
>> form_c = FormC(request.POST) 
>> if form_a.is_valid() and form_b.is_valid() and form_c.is_valid(): 
>>   form_a.save() 
>>    
>>   return HttpResponseRedirect(...) 
>>   else: 
>> form_a = FormA() 
>> form_b = FormB() 
>> form_c = FormC() 
>>   return render(...) 
>>
>> Cheers 
>>
>> Tom 
>>
>
>
>
>
>
> ---thank you TOM--- 
>   when I submit my forms .. no field is validated
>
>
> ...view.
>
>
>
> def enregistrer(request):
> if request.method == 'POST': 
> emet_form = EmetteurForm(request.POST, prefix = "emet")
> des_form = DestinataireForm(request.POST, prefix = "des")
> fich_form = FichierForm(request.POST, prefix = "fich")
> if emet_form.is_valid() and des_form.is_valid() and 
> fich_form.is_valid(): 
> civilite = emet_form.cleaned_data.get('civilite')
> nom = emet_form.cleaned_data.get('nom')
> prenom = emet_form.cleaned_data.get('prenom')
> 
> cni = emet_form.cleaned_data.get('cni')
> mail = emet_form.cleaned_data.get('mail')
> telephone = emet_form.cleaned_data.get('telephone')
> pays = emet_form.cleaned_data.get('pays')
> ville = emet_form.cleaned_data.get('ville')
> quartier = emet_form.cleaned_data.get('quartier')
> emet = emet_form.save()
> nom = des_form.cleaned_data.get('nom')
> prenom = des_form.cleaned_data.get('prenom')
> mail = des_form.cleaned_data.get('mail')  
> telephone = des_form.cleaned_data.get('telephone')
> des = des_form.save()
> description_fichier = 
> fich_form.cleaned_data.get('description_fichier')
> date_enregistrement = 
> fich_form.cleaned_data.get('date_enregistrement')
> observation = fich_form.cleaned_data.get('observation')
> montant_prestation = 
> fich_form.cleaned_data.get('montant_prestation')
> fich = fich_form.save()
> else:
> emet_form = EmetteurForm()
> des_form = DestinataireForm()
> fich_form = FichierForm() 
> 
> return 
> render(request,'formulaire/information.html',locals())
> //***please look ..if my view is good***//
>

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


Re: I don't understand whats wrong with the way im passing django list to json

2014-07-29 Thread G Z
solved
date_values= json.dumps(list(date_values), cls=DjangoJSONEncoder)


var date_values = {{ date_values|safe }};
var lineChartData = {
labels : date_values,
datasets : [
{
label: "CPU Usage in MHZ",
fillColor : "rgba(220,220,220,0.2)",
strokeColor : "rgba(220,220,220,1)",
pointColor : "rgba(220,220,220,1)",
pointStrokeColor : "#fff",
pointHighlightFill : "#fff",
pointHighlightStroke : "rgba(220,220,220,1)",
data : {{cpu_values}}
}
]

}

window.onload = function(){
var ctx = document.getElementById("canvas").getContext("2d");
window.myLine = new Chart(ctx).Line(lineChartData, {
responsive: true
});
}





On Tuesday, July 29, 2014 9:47:40 AM UTC-6, G Z wrote:
>
> the values will show how, but i ran into another problem while trying to 
> input the labels, labels need to be strings so I input them as an array 
> such as the following: ["2014-07-28 14:24:11", "2014-07-28 14:24:11"] I 
> saved it as a simple json in django and pass it to the webbrowser and then 
> conver the json to a javascript value and pass that as the labels. Normally 
> labels is ['sdfsdf','sdfsfs'] which is exactly how I pass mine Ive passed 
> with "" and '' it doesn't matter. I'm trying to use the datetimes as the 
> graph labels.
>
> 
>  
> var dates = JSON.parse("{{ date_values }}");
> var lineChartData = {
> labels : [dates],
> datasets : [
> {
> label: "CPU Usage in MHZ",
> fillColor : "rgba(220,220,220,0.2)",
> strokeColor : "rgba(220,220,220,1)",
> pointColor : "rgba(220,220,220,1)",
> pointStrokeColor : "#fff",
> pointHighlightFill : "#fff",
> pointHighlightStroke : "rgba(220,220,220,1)",
> data : {{cpu_values}}
> }
> ]
>
> }
>
> window.onload = function(){
> var ctx = document.getElementById("canvas").getContext("2d");
> window.myLine = new Chart(ctx).Line(lineChartData, {
> responsive: true
> });
> }
>
> 
>

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


Re: asyncio integration /benefits & performance

2014-07-29 Thread Avraham Serour
I believe this would be out of scope to django.
nginx+uwsgi to serve your django apps is pretty fast, and don't use much
memory or processor, what else do you need?

much of performance problems can be solved by using cache properly


On Tue, Jul 29, 2014 at 8:21 PM, sastry mln  wrote:

> Hi All,
>
>Recently there was a presentation in our company about node.js and
> the success stories of using it in walmart and linkedin (it was 2 years old
> story but news to me). And i started googling about this concept of
> asychronous I/O and bumped into youtube video about *asyncio *by Guido
>
>Can and will django use asyncio or any other asyc framework like
> twisted? will django or django apps benefit by using this new asyncio api?
>
>Was any performance studies done to compare django with node
>
> Please share your experiences in this area
>
> -regards
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/fd3a0745-3766-4fd3-a761-6176850eff38%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

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


Django package to convert Less to CSS

2014-07-29 Thread Chen Xu
Hi, Everyone
I am wondering is there a good django package that can convert less file
into css file?


Thanks


-- 
⚡ Chen Xu ⚡

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


Re: asyncio integration /benefits & performance

2014-07-29 Thread carlos
If you need real time application i thing you need read about gevent
http://www.gevent.org/
other lecture is socketio and exit third app django
https://github.com/stephenmcd/django-socketio
and here other thing
http://www.pixeldonor.com/2014/jan/10/django-gevent-and-socketio/

Cheers


On Tue, Jul 29, 2014 at 2:45 PM, Avraham Serour  wrote:

> I believe this would be out of scope to django.
> nginx+uwsgi to serve your django apps is pretty fast, and don't use much
> memory or processor, what else do you need?
>
> much of performance problems can be solved by using cache properly
>
>
> On Tue, Jul 29, 2014 at 8:21 PM, sastry mln  wrote:
>
>> Hi All,
>>
>>Recently there was a presentation in our company about node.js and
>> the success stories of using it in walmart and linkedin (it was 2 years old
>> story but news to me). And i started googling about this concept of
>> asychronous I/O and bumped into youtube video about *asyncio *by Guido
>>
>>Can and will django use asyncio or any other asyc framework like
>> twisted? will django or django apps benefit by using this new asyncio api?
>>
>>Was any performance studies done to compare django with node
>>
>> Please share your experiences in this area
>>
>> -regards
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at http://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/fd3a0745-3766-4fd3-a761-6176850eff38%40googlegroups.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAFWa6tJHEM7yDoSQy-ZdUgNLsPrWQS6Dh%3DUOdgeihw1RaOP9mw%40mail.gmail.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: Django package to convert Less to CSS

2014-07-29 Thread carlos
https://pypi.python.org/pypi/lesscss

Cheers


On Tue, Jul 29, 2014 at 3:27 PM, Chen Xu  wrote:

> Hi, Everyone
> I am wondering is there a good django package that can convert less file
> into css file?
>
>
> Thanks
>
>
> --
> ⚡ Chen Xu ⚡
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CACac-qbgdcFCkQHUfcV1hh2GNbkZ95j6tjfJ0f%2B1BXExgomRhw%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

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


images umpload prob

2014-07-29 Thread ngangsia akumbo
i have the following

MODEL

from django.db import models

class Timer(models.Model):
title = models.CharField(max_length=100)
slug = models.SlugField(unique=True)
image2 = models.ImageField(upload_to='image2/')
last_seen = models.IntegerField()

def __unicode__(self):
return self.title


URLS
from django.conf.urls import patterns, include, url


from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
 url(r'^testp/', include('testp.urls')),

 url(r'^admin/', include(admin.site.urls)),
)

TESTP/URLS

from django.conf.urls import patterns, url

from django.conf import settings
from django.conf.urls.static import static


from testp import views

urlpatterns = patterns('',
# ex: /testp/
url(r'^$', views.timers, name='timers'),
# ex: /test/5/
url(r'^(?P\d+)/$', views.timers_detail, name='timers_detail'),
)+ static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)


SETTING
# Example: "/home/media/media.lawrence.com/media/"
MEDIA_ROOT = 
'C:/Python27/Scripts/mysite0/Django-1.5/djang/bin/test0/image2/'

# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash.
# Examples: "http://media.lawrence.com/media/";, "http://example.com/media/";
MEDIA_URL = '/media/'

# Absolute path to the directory static files should be collected to.
# Don't put anything in this directory yourself; store your static files
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
# Example: "/home/media/media.lawrence.com/static/"
STATIC_ROOT = 
'C:/Python27/Scripts/mysite0/Django-1.5/djang/bin/test0/image2/static/'

# URL prefix for static files.
# Example: "http://media.lawrence.com/static/";
STATIC_URL = '/static/'

# Additional locations of static files
STATICFILES_DIRS = (
'C:/Python27/Scripts/mysite0/Django-1.5/djang/bin/test0/static/'

TEMPLATE

{{ tis.image2.url}}

WHEN I DISPLAY THE IMAGE IT GIVE ME THE LINK INSTEAD ON THE BROWSER

/media/image2/Desert.jpg

WHERE AM I WRONG

Am using django 1.5

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


update a field of a related table on form save

2014-07-29 Thread Brad Rice
I have three tables. The first one is application which has a flag for if 
an app has been submitted as well as created date and modified date. The 
other two tables relate to the application table. I have two forms that get 
update those tables. What I want to do is update the application modified 
date from the save on the other forms.

I have this in the Application model
modified= models.DateTimeField(auto_now_add=True)

but since it is the other tables I am saving to, I'm not sure how to update 
that field whenever the other two tables update.

My view for one of the forms looks like this:

class AnswersUpdate(UpdateView):
model = Answers
form_class = AnswersForm
slug_field = 'created_by'
template_name = 'requestform/applicant_form.html'

@method_decorator(login_required(login_url='/accounts/login/'))
def dispatch(self, *args, **kwargs):
return super(AnswersUpdate, self).dispatch(*args, **kwargs)

def get_object(self, queryset=None):
return Answers.objects.get(created_by=self.request.user)

def form_valid(self, form):
obj = form.save(commit=False)
obj.created_by = self.request.user
obj.save()
a = Application.objects.get(created_by=self.request.user)
   ## how do I save to the Application here?
return HttpResponseRedirect(reverse('requestform:app_check', 
kwargs={'app_id': obj.id}))

Any help would be appreciated.

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


Django 1.7 - What are you most excited about?

2014-07-29 Thread Ryan Blunden
Hi everyone,

I'm giving a lightening talk at the San Francisco Django meetup tomorrow 
night about some of the awesome new features in Django 1.7.

I wanted to highlight not just what *I think* are the best new features, 
but what members of the community are most excited about.

Would be great to hear from the Django core contributors too.

Thanks also Django Devs for getting RC 2 up in time for my talk, brilliant 
timing there!

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


Re: images umpload prob

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

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

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


Re: Django package to convert Less to CSS

2014-07-29 Thread Chen Xu
I tried this, but I got errors like:

/Library/Ruby/Gems/2.0.0/gems/less-2.4.0/bin/lessc:100:in `read': No such
file or directory -
/Users/xuchen81/Desktop/hw-kkworld/assets/less/kk-less/_global.css
(Errno::ENOENT)

from /Library/Ruby/Gems/2.0.0/gems/less-2.4.0/bin/lessc:100:in `'

from /usr/bin/lessc:23:in `load'

from /usr/bin/lessc:23:in `'

Where I think  "/_global.css" is supposed to be generated. However, it says
no such file.


Thanks


On Tue, Jul 29, 2014 at 9:12 PM, carlos  wrote:

> https://pypi.python.org/pypi/lesscss
>
> Cheers
>
>
> On Tue, Jul 29, 2014 at 3:27 PM, Chen Xu  wrote:
>
>> Hi, Everyone
>> I am wondering is there a good django package that can convert less file
>> into css file?
>>
>>
>> Thanks
>>
>>
>> --
>> ⚡ Chen Xu ⚡
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at http://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CACac-qbgdcFCkQHUfcV1hh2GNbkZ95j6tjfJ0f%2B1BXExgomRhw%40mail.gmail.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAM-7rO1vTyuSdh%3DxvpD1nBPuEUJpdUxupLPQCMbb6F3p6mP8rw%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
⚡ Chen Xu ⚡

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


Re: Django 1.7 - What are you most excited about?

2014-07-29 Thread carlos
Hi maybe you need read the release note Django 1.7 about the new features
https://docs.djangoproject.com/en/dev/releases/1.7/

Cheers :)


On Tue, Jul 29, 2014 at 7:31 PM, Ryan Blunden 
wrote:

> Hi everyone,
>
> I'm giving a lightening talk at the San Francisco Django meetup tomorrow
> night about some of the awesome new features in Django 1.7.
>
> I wanted to highlight not just what *I think* are the best new features,
> but what members of the community are most excited about.
>
> Would be great to hear from the Django core contributors too.
>
> Thanks also Django Devs for getting RC 2 up in time for my talk, brilliant
> timing there!
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/afb4376a-853d-46df-8db3-e37e5740d91b%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

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


writing simple forms

2014-07-29 Thread Dtr Prasad
I want write simple forms like file uploading,sesion tracking using python 
modules.
How can it be done through Django,does not require model 








































































































































































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


Re: writing simple forms

2014-07-29 Thread carlos
Hi, this is for you https://docs.djangoproject.com/en/dev/topics/forms/

Cheers


On Tue, Jul 29, 2014 at 8:52 PM, Dtr Prasad  wrote:

> I want write simple forms like file uploading,sesion tracking using python
> modules.
> How can it be done through Django,does not require model
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/771cda7e-c4e5-41b6-b61e-1bf9d97cdf53%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

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


running script in django database

2014-07-29 Thread alghafli

Hello,
I made a library application using django 1.6. currently I only need to 
populate the database. at the beginning, it is easier to write the 
information in a csv file and import it using a script.


the script is running fine if I use manage.py shell and import the 
necessary file and call the necessary function. however, I want to make 
the script run from the system commandline rather than from the python 
interpreter since it is easier to pass arguments to it. I could not find 
a way in the manage.py documentation page.


Is it possible?

thank you,
Mohammad

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


Re: asyncio integration /benefits & performance

2014-07-29 Thread Russell Keith-Magee
Hi,

On Wed, Jul 30, 2014 at 1:21 AM, sastry mln  wrote:

> Hi All,
>
>Recently there was a presentation in our company about node.js and
> the success stories of using it in walmart and linkedin (it was 2 years old
> story but news to me). And i started googling about this concept of
> asychronous I/O and bumped into youtube video about *asyncio *by Guido
>
>Can and will django use asyncio or any other asyc framework like
> twisted? will django or django apps benefit by using this new asyncio api?
>

That's a difficult question to answer. It depends entirely on what you mean
by "asynchronous".

At the very low level, Async is a way of building *any* system so that
there aren't any blocking operations. This potentially means you can handle
more throughput with less hardware - but at a price. Building asynchronous
systems is much harder than synchronous systems. The simple idea of "do X,
then do Y, then do Z" can be quite complex (or at least, convoluted) with
an asynchronous system because you have to write it as a series of nested
callbacks (which is what Node does), or some other language-level mechanism
(which is what Twisted/asyncio does).

However, if you go asynchronous, *everything* needs to be aynchronous. As
soon as *anything* in your stack is synchronous, you effectively lose the
benefit of having an async system. This is the biggest holdup in the
Django/Python community at the moment - every library that is currently in
existence needs to be updated to be "async compatible". This means database
drivers, File IO libraries, interfaces with memory stores like Memcache and
Redis, and so on. This is, as you might expect, not a small job.

The other way to interpret "asynchronous" is in the context of "web
sockets" - that is, building web pages that continuously update based on
information from the server. There are many ways to implement this sort of
thing, but async frameworks are particularly well suited.

The two topics are related; in order to build a good web socket system,
some asynchronisity is required. However, your entire *stack* doesn't need
to be asynchronous in order to add web sockets.

Aymeric Augustin has dome some exploratory work in this area.

https://github.com/aaugustin/django-c10k-demo

This isn't something that is going to appear in Django 1.8 (or any other
soon-to-be-released version), but it is an area that we are aware of and
are watching keenly.

   Was any performance studies done to compare django with node
>

Not that I'd pay any attention to. It's trivial to make a performance study
say whatever you want it to by manipulating the benchmark.

What is indisputable is that Django is able to run some *very* large
websites. Mozilla, Disqus, Instagram, Pinterest - these are all Django
sites. Yes, they're heavily modified from "stock" Django - but that's
because while the performance characteristics of every small website are
the same, the performance characteristics of every large website are
different.

Suffice to say - it's entirely possible to make a Django site scale to
*very* large traffic levels. If you believe someone who says "Just use Node
and it will solve all your performance problems", then I have a bridge to
sell you. The reason to use Node, Twisted, Django, or anything else for
that matter, shouldn't be made on the basis of a single benchmark. You need
to look at the stability of the platform, the community around it, the long
term support structures that are in place, and much more. Performance isn't
an insignificant concern, but if you know what you're doing, you can make
almost *any* web framework perform well if you actually end up with having
those sort of problems.

Yours,
Russ Magee %-)

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


Re: Django 1.7 - What are you most excited about?

2014-07-29 Thread Russell Keith-Magee
Hi Ryan,

On Wed, Jul 30, 2014 at 9:31 AM, Ryan Blunden 
wrote:

> Hi everyone,
>
> I'm giving a lightening talk at the San Francisco Django meetup tomorrow
> night about some of the awesome new features in Django 1.7.
>
> I wanted to highlight not just what *I think* are the best new features,
> but what members of the community are most excited about.
>
> Would be great to hear from the Django core contributors too.
>

Well, the release notes pretty much highlight the things that the core team
think are big news. For me, the biggest of those are:

 * Schema migration - obviously

 * App loading - because we finally have somewhere to put signal
registrations.

 * The new checks framework - because it's a big internal cleanup, and
opens lots of possibilities for the future

 * Converting custom query sets into managers - because this is repetitive
work that we've been doing since 0.96

 * Custom managers on reverse relations - because it's an obvious thing to
want once you have custom managers.

Yours,
Russ Magee %-)

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


Re: plz help me to learn django

2014-07-29 Thread memilanuk

On 07/29/2014 10:15 AM, François Schiettecatte wrote:

Two great resources:

https://www.djangoproject.com

https://docs.djangoproject.com/en/1.6/intro/tutorial01/

http://www.djangobook.com/en/2.0/index.html


Not sure I'd recommend djangobook.com... from their own site:

"This book was originally published by Apress in 2009 and covered Django 
version 1.0. Since then it has languished and, in places, is extremely 
out of date."


And if you go over their github page... the last updates were about a 
year ago.  Doesn't really look like they're making any progress towards 
updating things.


One site that is reasonably current and very helpful, though:

http://www.tangowithdjango.com/

Written for django 1.5, so it could be a little fresher... but its still 
way more current/relevant than djangobook.com.


Just my point of view as another newbie looking at tutorials out there 
on the great world wild web ;)


YMMV,

Monte


--
Shiny!  Let's be bad guys.

Reach me @ memilanuk (at) gmail dot 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/53D88C1F.9070903%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: update a field of a related table on form save

2014-07-29 Thread Babatunde Akinyanmi
Hi Brad, my response is inline

On 30 Jul 2014 02:26, "Brad Rice"  wrote:
>
> I have three tables. The first one is application which has a flag for if
an app has been submitted as well as created date and modified date. The
other two tables relate to the application table. I have two forms that get
update those tables. What I want to do is update the application modified
date from the save on the other forms.
>
> I have this in the Application model
> modified= models.DateTimeField(auto_now_add=True)
>
> but since it is the other tables I am saving to, I'm not sure how to
update that field whenever the other two tables update.
>
> My view for one of the forms looks like this:
>
> class AnswersUpdate(UpdateView):
> model = Answers
> form_class = AnswersForm
> slug_field = 'created_by'
> template_name = 'requestform/applicant_form.html'
>
> @method_decorator(login_required(login_url='/accounts/login/'))
> def dispatch(self, *args, **kwargs):
> return super(AnswersUpdate, self).dispatch(*args, **kwargs)
>
> def get_object(self, queryset=None):
> return Answers.objects.get(created_by=self.request.user)
>
> def form_valid(self, form):
> obj = form.save(commit=False)
> obj.created_by = self.request.user
> obj.save()
> a = Application.objects.get(created_by=self.request.user)
>## how do I save to the Application here?

#if its a new record, something like 
application =  Application.objects.create(...)

#if you are updating a record, something like...
application = Application.objects.get(...) # can throw exception
application.field_name = something
application.save ()

> return HttpResponseRedirect(reverse('requestform:app_check',
kwargs={'app_id': obj.id}))
>
> Any help would be appreciated.
>
> --
> You received this message because you are subscribed to the Google Groups
"Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/2a2b6f24-b4c2-4575-9a52-85a892256c79%40googlegroups.com
.
> For more options, visit https://groups.google.com/d/optout.

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


(ModelForm) confusion

2014-07-29 Thread Kamal Kaur
Greetings!

What I have done:
There are four tables, from which I have generated ModelForms. Getting
the WorkerDetails from one side, adding the salary and attendance
things from the other side as the view says. If there is at least one
row added in WorkerDetail table, then it directly asks to add the
salary and attendance things. Everything is being added perfectly but
I have to add that "ForeignKey" thing in every form.

Aim:
To design a page like this:
http://tinypic.com/r/feor5h/8

Query:
What I need to do to display forms like this and get the foreign key
attribute directly from the displayed list? Is what I have done right?
Is there some better approach to get this desired layout?

Required code:
models.py: http://pastie.org/9430952
forms.py: http://pastie.org/9430955
views.py: http://pastie.org/9430962



-- 
Kamaljeet Kaur
I'm not what I'm compared to others, I'm what I'm compared to my yesterday.

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