this is how to do it if you are new to Django [Was: Django docs and GSoC doc summit]

2011-08-05 Thread Mike Dewhirst
I've been using the docs and haunting this list for a while and I
think I have a more-or-less new-user perspective. First of all, the
docs are great especially when compared to other stuff out there for
other kit. But if we (er, not necessarily me) are going to hack on the
docs we need an objective. There is so much there which is valuable as-
is it would be best to try for something which isn't there at the
moment.

The community benefits and the Django Foundation benefits if the
community grows. It can only grow if it is easy to get started for
newbies. Hence, I'm thinking they should be the target audience for
any new docs.

We already have the mindset that flexibility is king and that is
sufficient to draw gurus from other languages/frameworks. Now we need
a parallel mindset which says "easy" is super-cool too. I know that
all the answers for newbies are already out there for the googling but
it would be nice to say in one place "this is how to do it if you are
new to Django". So nice in fact that this could be the objective for
any new docs.

If we started with some common-ish real-world scenarios and associated
user requirements and did a standardised chapter on each scenario I
believe new users would fall in love with Django in droves.

Most gurus would hate to convert such scenarios into sets of howto
instructions because there would be too many imponderables which might
influence design and how they might do it. However, new users need to
get started and that is the sole objective proposed here.

These docs should therefore advertise a fixed, standard set of
assumptions which sit between trivial and massive in order to reduce
those imponderables and thus allow sensible, easy, non-magical, DRY
approaches to each scenario.

The last section of each scenario should be a list of suggested google
phrases or search queries to acquire more information on other
potential solutions for this and similar topics. In addition to
specific references, this means new stuff should turn up as time
passes.

The nice thing about such a set of docs is that everything has been
done properly already by someone on this list. It is just a matter of
nominating a scenario and asking for contributed solutions.

This means the docs proposed here only needs an editor pick the eyes
out of contributed solutions and minimally write them up so newbies
can understand what is happening. The entire list can technically
review each chapter.

Just a thought

Mike


On Aug 3, 9:44 am, Russell Keith-Magee 
wrote:
> On Tue, Aug 2, 2011 at 6:43 PM, eset  wrote:
> > hi,
>
> > I am new to the Django list but I am a django fan (we dev with Django
> > forwww.booki.cc)... anyways I wanted to encourage the Doc team and
> > individuals on the list to apply for the GSoC Documentation Summit
> > (details below):
> >https://sites.google.com/site/docsprintsummit/
>
> > You can apply as an individual or a group.  Applications close Friday
> > (5th), application process takes about 2-5 mins :)
>
> Hi Adam,
>
> Thanks for drawing our attention to this. This sounds like a great
> opportunity to hack on Django's docs -- I'll see if we can shake loose
> some volunteers to attend.
>
> For anyone
>
> Yours,
> Russ Magee %-)

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



Re: django-registration - stuck at Required templates topic

2011-08-05 Thread Eyad Al-Sibai
I had the same thing...

all what you need is to add " {% csrf_token %}" in each template for Post
form

it will solve your issue

On Sat, Aug 6, 2011 at 7:42 AM, bob gailer  wrote:

> I have stumbled around following various pieces of advice:
>
> added to views:
>from django.core.context_processors import csrf
>
> modified views to end with:
>form = ContactForm()
>c = {}
>c.update(csrf(request))
>c['form'] = form
>return render_to_response('contact_form.html', c)
>
> modified contact_form.html:
>  {% csrf_token %}
>
> The first bullet in the error message:
> The view function uses RequestContext for the template, instead of
> Context.
>   makes no sense - even after attempting to read what the
> RequestContext link points to.
> |
> now what?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: django-registration - stuck at Required templates topic

2011-08-05 Thread bob gailer
I have stumbled around following various pieces of advice:

added to views:
from django.core.context_processors import csrf

modified views to end with:
form = ContactForm()
c = {}
c.update(csrf(request))
c['form'] = form
return render_to_response('contact_form.html', c)

modified contact_form.html:
  {% csrf_token %}

The first bullet in the error message:
The view function uses RequestContext for the template, instead of
Context.
  makes no sense - even after attempting to read what the
RequestContext link points to.
|
now what?

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



Re: How to use less css in mac?

2011-08-05 Thread Eugene Lazutkin
Inline.

On 08/03/2011 08:21 AM, francescortiz wrote:
> LESS combines CSS and javascript which I think that goes beyond the

What does it mean? Care to give an example? Like textually combining
both languages? Or does it produces both JavaScript and CSS files?

Last time I checked (today) it is a simple preprocessor, which produces
pure CSS files. It can be run statically, or dynamically in a browser.

> safe line, so I vote for SCSS ( http://sass-lang.com/ ) that also has
> a python version ( http://github.com/Kronuz/pyScss ).
> 
> LESS is based on an "older" version of SCSS that didn't follow CSS
> syntax (SASS).

LESS follows CSS rules, in fact any CSS is a valid LESS --- that was the
whole idea of LESS as a superset of CSS.

And could you give me a reference for my own education on "LESS is based
on older version of SCSS"?

Cheers,

Eugene

> 
> On Aug 3, 1:52 pm, Tom Evans  wrote:
>> On Wed, Aug 3, 2011 at 10:10 AM, Jithin Emmanuel  
>> wrote:
>>> Can some one please point out how to use less css along with compressor
>>> extension?
>>> I use mac 10.6.8 and I am trying to use an existing project which was
>>> initially setup in windows.
>>> I am trying to figure out what I should give here.
>>> COMPRESS_PRECOMPILERS = (
>>
>>> ('text/less',""),
>>> )
>>> Any help appreciated.
>>
>> Hadn't come across less css before, looks interesting - well, looks
>> how I wanted CSS to behave 10 years ago.
>>
>> Does this help? Seems to have examples for less
>>
>> http://django_compressor.readthedocs.org/en/latest/settings/#compress...
>>
>> Cheers
>>
>> Tom
> 

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



Re: Django can't see my static files

2011-08-05 Thread Ванин Владимир Евгеньевич
Hello,
I tried click. Error 404.
Vladimir

06.08.2011, 07:31, django-users@googlegroups.com:
> I am out of office right now and will get back to you when I return. If you 
> don't hear from me, my assistant should contact you shortly. In the meantime, 
> you should take a look at this product I have been using..Click Here
>
> Enable images or click here
>
> Let me know what you think after you have a chance to review.
> Cheers!
>
> If you no longer wish to receive emails, please unsubscribe
>
> 866-288-1880
> 5150 yarmouth ave, Encino, CA 91316
> On Fri, 5 Aug 2011 20:30:18 -0700 (PDT), "veva...@yandex.ru" wrote:

-- 
С уважением, Ванин Владимир Евгеньевич

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



Re: Django can't see my static files

2011-08-05 Thread veva...@yandex.ru
Hello,
I can't use static files too.
urls:
urlpatterns = patterns('',
(r'^', 'testjquery.views.first'),
)
if settings.DEBUG:
urlpatterns += patterns('django.views.static',
(r'^%s/(?P.*)$' % settings.STATIC_URL[1:], 'serve',
{ 'document_root': settings.STATIC_ROOT }),
)

settings:
def rel(*x):
return os.path.join(os.path.abspath(os.path.dirname(__file__)),
*x)
DEBUG = True
TEMPLATE_DEBUG = DEBUG
STATICFILES_DIRS = DEBUG and (rel('static'),) or None
STATIC_ROOT = rel('static')
STATIC_URL='/static/'
TEMPLATE_CONTEXT_PROCESSORS =
('django.core.context_processors.static',)
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
)


test

{% load static %}






Vladimir
Moscow, Russia

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



Re: Best practice when testing form values in a template?

2011-08-05 Thread Joshua Russo
Ok, I apologize. Here is a fuller representation of what I'm doing. I had a 
hard time figuring out how much was enough versus too much. This is 
simplified, but I think it represents what I'm trying to do. For instance, 
don't pay too much attention to the save logic in the view, I haven't 
actually really worked on it much yet.

To restate my scenario, I want to carry information in hidden fields of a 
form that determine how the form is displayed and functions. I realize I do 
have access to the self.Initial values in the form itself but I don't think 
that there's easy access to those values in the template. The value that I 
want seems to be the value() method of the BoundField, but run through the 
to_python() method of the field. I actually solved this by adding a 
to_python() method to the BoundField that does just this, but I would like 
to solve this without modifying the Django code. The samples below do not 
reflect my added to_python() method.

# Form class (I use the self["multiLineInfo"] pattern instead of 
self.fields["multiLineInfo"] 
# because the former gives a BoundField which merges the Field and the 
post/initial data)
class OrganizationItemForm(ModelForm):
selected  = forms.BooleanField(required=False)  
extraRequired = forms.BooleanField(required=False, 
widget=forms.HiddenInput)
multiLineInfo = forms.BooleanField(required=False, 
widget=forms.HiddenInput)

def __init__(self, *args, **kwargs):
super(AuditModelForm, self).__init__(*args, **kwargs)
if self["multiLineInfo"].value():
self.fields["descr"].widget = 
forms.Textarea(attrs={"class":"descriptionEdit"})
else:
self.fields["descr"].widget = 
forms.TextInput(attrs={"class":"itemDescrEdit"}) 
self.fields["descr"].required = self["extraRequired"].value() and 
self["selected"].value()

class Meta:
model = OrganizationItem

# Model classes

class OrganizationItem(models.Model):
organization = models.ForeignKey(Organization)
item   = models.ForeignKey(ListItem)
descr  = models.TextField("Description", blank=True)

class ListItem(models.Model):
category = models.ForeignKey(ListCategory)
name = models.CharField("Name", max_length=200)
order= models.IntegerField("Order")
extraInfo = models.BooleanField("Requires extra information")
multiLineInfo = models.BooleanField("The display should use a multi-line 
edit box instead of a single line edit")
descrLabel= models.CharField("Extra information label", 
max_length=50,
blank=True)

class ListCategory(modelUtils.MyModelAudit):
catId = models.CharField("Category identifier", max_length=15,
primary_key=True)
name  = models.CharField("Name", max_length=100)
order = models.IntegerField("Order")
group = models.ForeignKey(ListGroup)
organization = models.BooleanField("Should this be associated with an 
organization?")
twoColumn= models.BooleanField("Should the current list span 2 
columns?")

class ListGroup(modelUtils.MyModelAudit):
name = models.CharField("Name", max_length=15)
descr = models.CharField("Description", max_length=100, blank=True)
order = models.IntegerField("Order")

# View example
def organizationAdd(request):

OrganizationItemFormSet = formset_factory(OrganizationItemForm)

if request.method == 'POST':
orgItemFormSet = OrganizationItemFormSet(request.POST)
orgItemFormSetIsValid = orgItemFormSet.is_valid()
if orgItemFormSetIsValid:
orgItemFormSet.save(commit=False)
else:
orgItemFormSet = OrganizationItemFormSet() 
listItems = CreateItemsSection(orgItemFormSet, "organization", 
category__organization=True)

context = {
'listItems': listItems, 
'listItemsManagementForm': orgItemFormSet.management_form}

return render_to_response('organizationEdit.html', context,
context_instance=RequestContext(request))


def CreateItemsSection(formset, idField="", objId=None, relation=None, 
**kwargs):
"""Construct the list of selectable items"""

qs = ListItem.objects.filter(**kwargs)

# Get the appliable list of groups
groups = qs.values(
"category__group", "category__group__descr"
).order_by(
"category__group__order"
).distinct()

# Convert the items relation into a dictionary of ListItem PK and 
XItems.descr
selectedData = {}
if relation is not None:
selectedData = dict([(item.item__id, item.descr) for item in 
relation])

retVal = []

# Track the current form to display when the formset is populated from a 
postback
formIndex = 0;
postedData = len(formset) > 0

# Assemble the information for each category group
for grp in groups:
# The current group's description
curGrpDescr = grp["category__group__descr"]
# 

RE: Question about imports..Python Dejango and Models

2011-08-05 Thread Hayyan Rafiq

are  you referring to the models.py which is present in every app created by 
python manage.py startapp books ??

# Create your models here.
from django.db import models

class Publisher(models.Model):
name = models.CharField(max_length=30)
address = models.CharField(max_length=50)
city = models.CharField(max_length=60)
state_province = models.CharField(max_length=30)
country = models.CharField(max_length=50)
website = models.URLField()

class Author(models.Model):
first_name = models.CharField(max_length=30)
last_name = models.CharField(max_length=40)
email = models.EmailField()

class Book(models.Model):
title = models.CharField(max_length=100)
authors = models.ManyToManyField(Author)
publisher = models.ForeignKey(Publisher)
publication_date = models.DateField()


 "I meant Models is defined inside models.py. ??" .. still not clear

Date: Fri, 5 Aug 2011 21:33:26 -0400
Subject: Re: RE: Question about imports..Python Dejango and Models
From: sh...@milochik.com
To: django-users@googlegroups.com

Sorry, typo. I meant Models is defined inside models.py. 



-- 

You received this message because you are subscribed to the Google Groups 
"Django users" group.

To post to this group, send email to django-users@googlegroups.com.

To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.


For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.
  

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



Re: RE: Question about imports..Python Dejango and Models

2011-08-05 Thread Shawn Milochik
Sorry, typo. I meant Models is defined inside models.py.

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



RE: Question about imports..Python Dejango and Models

2011-08-05 Thread Hayyan Rafiq

wait... every app has its own models.py...  and in models.py it says something 
like

from django.db import models
class Publisher(models.Model):
name = models.CharField(max_length=30)
address = models.CharField(max_length=50)
city = models.CharField(max_length=60)
state_province = models.CharField(max_length=30)
country = models.CharField(max_length=50)
website = models.URLField()

I need Models.py where is that?? 

Date: Fri, 5 Aug 2011 21:15:01 -0400
Subject: Re: Question about imports..Python Dejango and Models
From: sh...@milochik.com
To: django-users@googlegroups.com

The model class is defined *inside* Models.py.



-- 

You received this message because you are subscribed to the Google Groups 
"Django users" group.

To post to this group, send email to django-users@googlegroups.com.

To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.


For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.
  

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



Re: Question about imports..Python Dejango and Models

2011-08-05 Thread Shawn Milochik
The model class is defined *inside* Models.py.

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



Question about imports..Python Dejango and Models

2011-08-05 Thread Adam Zedan
Hi while going through the Django Book I ran into the following code
Being fairly new to Python the code kind of confused me

from django.db import models --->lineA
class Publisher(models.Model):  --->line B

Consider line A
 from django.db import models
This means that in the django directory therewill be a subdirectory of
db from in which either you'll find a file called models.py or a
directory called models??Rite?? so there is a directory called
models..great Let me know if what i said was correct.

Moving on to Line B
class Publisher(models.Model):
i am more interested in the models.Model.
does that mean in the models folder youll find a Model.py ??  I cant
seem to find Model.py then?? could anyone please clear this
concept..why cant i find this file ?? I would like to take a look at
the base class models.Model.
I have checked a couple of sites on python tutorial and they dont
cover imports in that much detail

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



Re: Calculation for each object in a QuerySet

2011-08-05 Thread nixlists
On Fri, Aug 5, 2011 at 5:14 PM, Subhranath Chunder  wrote:
> Your model declarations are very confusing for me, and seems to be running
> around in circles. Very difficult to follow for me.
> The logical relationships are not clear. So, how to arrive at the
> 'rebate_pct' and 'wac' as you actually intend, is a mystery in itself for
> me.

Every contract has many products, and each product has 'rebate_pct'
and several 'wac's, so there's the intermediary ContractProduct table
that contains as many rows per contract as there are associated
products (ndcs). 'ndc' and 'wac' are foreign keys to Product and
Pricing.

"id""contract_id"   "ndc_id""wac_id""rebate_pct"
"admin_pct"
"1""1" "1" "1"  
"0.22035578""0."
"2""1"  "2""2"   "0.22035578"   
"0."

So given a 'contract_id', I am currently finding those like this:

c = Contract.objects.filter(id = contract_id)
cps = c[0].contractproduct_set.filter(contract=contract_id)

c_dict = dict(cps.values_list('ndc', 'rebate_pct'))
p_dict = dict(cps.values_list('ndc', 'wac__wac'))

for cp in cps:

  cset = Claim.objects.filter(contract = contract_id, ndc=cp.ndc_id)
  ...
  rebate = quantity * p_dict[cp.ndc_id] * c_dict[cp.ndc_id]


Is there a way to do this easier and better?

Is it possible to write a model method to access those values from
inside of 'Claim'?

Thanks.

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



Re: I've upgraded python from 2.5 to 2.7 do I need to reinstall django?

2011-08-05 Thread kierang
That worked perfect, just had to reinstall MySQL-python-1.2.3 and all 
modules

Didn't have to do anything to the existing Django projects

thanks again for the help

Cheers
Kieran

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/_bB860eFfWIJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: I've upgraded python from 2.5 to 2.7 do I need to reinstall django?

2011-08-05 Thread kierang
Great thanks Bill for the quick response.
I did install it with no special instructions so I'll just reinstall to 2.7


Thanks again
Kieran

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/rIGcAu4ruu8J.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: I've upgraded python from 2.5 to 2.7 do I need to reinstall django?

2011-08-05 Thread Bill Freeman
Probably.  Depends on how you installed it.

If django was installed somewhere like /usr/lib/python2.5/... then, yes, the
new python install won't have access to it.  That would be if you used
pip, eacy_install, or python setup.py as root to install it, and didn't give
any special arguments to install it elsewhere.

It's probably best to reinstall with the new python anyway, since there can
be dependencies that vary based on python version.  Note that the .pyc
files in you project are only compatible with one version.  2.7 might deal
with this for you automatically, but it is probably best to remove them and
let 2.7 build its own.

2.7, IIRC, comes with sqlite, but if you are using, say, psycopg2 or mysql,
you will probably need to install the python packages for that as well.
The underlying lib files and DB installation should be fine as they are.

Bill

On Fri, Aug 5, 2011 at 5:23 PM, kierang  wrote:
> Hi all couldn't find this posted apologies if its been answered.
>
> I have just installed python 2.7, there's packages I wat to use that
> are reliant on json.
>
> I have been using Django installed in 2.5 packages on my local
> machine.
> To get Django now working with 2.7 do I need to install Django and the
> sql lib to 2.7?
> Is that the correct thing to do?
>
>
> Any advice would be great
>
> Thanks
> Kieran
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: Count users joined ordered by month

2011-08-05 Thread Simon Zimmermann


On Aug 5, 9:33 pm, Subhranath Chunder  wrote:
> Not the exact answer you were looking for, but I was only wondering, if you
> have already figured the actual SQL query then why not simply use that
> instead.

You loose many things by not using the ORM. Currently I use raw() SQL
for making these kind of queries, but I would like to use the ORM for
it. Sadly, the GROUP BY support is rather limited as far as I can see.
I mostly posted this to see if anyone had any suggestions to solving
these kind of GROUP BY `problems` with the current django ORM.

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



I've upgraded python from 2.5 to 2.7 do I need to reinstall django?

2011-08-05 Thread kierang
Hi all couldn't find this posted apologies if its been answered.

I have just installed python 2.7, there's packages I wat to use that
are reliant on json.

I have been using Django installed in 2.5 packages on my local
machine.
To get Django now working with 2.7 do I need to install Django and the
sql lib to 2.7?
Is that the correct thing to do?


Any advice would be great

Thanks
Kieran

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



Re: Calculation for each object in a QuerySet

2011-08-05 Thread Subhranath Chunder
Your model declarations are very confusing for me, and seems to be running
around in circles. Very difficult to follow for me.
The logical relationships are not clear. So, how to arrive at the
'rebate_pct' and 'wac' as you actually intend, is a mystery in itself for
me.

If you have the relationships clear in your mind, then you access the
related data from a model instance like as mentioned in
https://docs.djangoproject.com/en/dev/topics/db/queries/#related-objects

Else, as suggested, you can go for raw sql queries, if the query itself is
getting too complex.


On Sat, Aug 6, 2011 at 12:19 AM, nixlists  wrote:

> On Fri, Aug 5, 2011 at 7:51 AM, bruno desthuilliers
>  wrote:
> > Without more informations about your models (and specially the
> > relationships), it's going to be rather difficult. As a general
> > consideration, if your Claim model can access these other models thru
> > relationships, well you just have to follow the relationships. This is
> > basic Django ORM stuff, well explained in the FineManual.
>
> Hi
>
> I have:
>
> class Product(models.Model):
>ndc = models.CharField(max_length=50)
>product_name = models.CharField(max_length=50)
>quantity = models.IntegerField()
>...
>
> class Pricing(models.Model):
>ndc = models.ForeignKey(Product)
># wholesale acquisition cost
>wac = models.DecimalField(max_digits=17, decimal_places=8)
>...
> class Contract(models.Model):
>name =  models.CharField(max_length=100)
>products = models.ManyToManyField(Product, through='ContractProduct')
>
> class ContractProduct(models.Model):
> contract = models.ForeignKey(Contract)
>ndc = models.ForeignKey(Product)
> wac = models.ForeignKey(Pricing)
>rebate_pct = models.DecimalField(max_digits=17, decimal_places=8)
>admin_pct = models.DecimalField(max_digits=17, decimal_places=8)
>
> class Claim(models.Model):
>contract = models.ForeignKey(Contract)
>ndc = models.ForeignKey(Product)
>quantity = models.IntegerField(blank=True, null=True)
>
> I need a view where for every row returned from Claim I make a
> calculation based on quantity from the Claim, rebate_pct and wac. Is
> it possible to write a model method that would access these fields
> from the other tables?
>
> Thanks.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: splitting uploaded CSV data

2011-08-05 Thread Subhranath Chunder
Instead of writing:
f = csv.reader(open(fname, 'rb'), delimiter=',', quotechar='"')

you could have written only:
f = csv.reader(open(fname, 'rb'))

The 'delimiter' and 'quotechar' defaults to the ones you've specified.
But, it's nothing wrong to be explicit, rather than to rely on the implicit
values.


On Sat, Aug 6, 2011 at 1:47 AM, Vasu Nagalingam wrote:

> Thanks. I am on it. Info below for future readers.
>
> What I did was:
> 1) set the order of the upload file handing in the settings.py so that
> default behavior in Django will always be to save the file to drive
> instead of keeping it in memory (for files under 2.5M)
> FILE_UPLOAD_HANDLERS = (
>'django.core.files.uploadhandler.TemporaryFileUploadHandler',
>'django.core.files.uploadhandler.MemoryFileUploadHandler',
> )
>
> 2) in my post upload routine, I opened the file using Python's CSV
> manipulation library.
> import csv
>
> fname = uploaded_data_file.temporary_file_path()
> f = csv.reader(open(fname, 'rb'), delimiter=',', quotechar='"')
> for line in f:
>   co_id = line[0]
>   co_name = line[1]
>   co_addr1 = line[2]
> and so forth.
>
>
>
> On Aug 5, 4:01 pm, Subhranath Chunder  wrote:
> > Using the string split on CSV like this is bad in practice. Prefer using
> CSV
> > manipulation library instead. Like,
> http://docs.python.org/library/csv.html
> >
> > You can use the CSV reader module for your purpose.
> >
> > On Sat, Aug 6, 2011 at 1:13 AM, Vasu Nagalingam  >wrote:
> >
> >
> >
> >
> >
> >
> >
> > > Hi - I am in implementing a batch file import function where the data
> file
> > > is in CSV format. The data file is uploaded (InMemoryFileHandler)
> > > successfully, but I am having trouble parsing the CSV data correctly.
> >
> > > My code:
> > > for line in imported_data:
> > >line = line.split(',')
> >
> > > My data is organized in this
> > > format: ,
> > > 0001,"google","123 Main St","san francisco","CA",94000
> > > 0002,"microsoft","1 Main St, 9th Floor","Boston","MA",17000
> >
> > > The code works fine for the first row (google). Due to the extra comma
> in
> > > the address 1 element for Microsoft, the import of row is mucked up. Is
> > > there a way to indicate the text delimiter as well as data delimiter
> for the
> > > split function? Or, any other options?
> >
> > >  --
> > > You received this message because you are subscribed to the Google
> Groups
> > > "Django users" group.
> > > To view this discussion on the web visit
> > >https://groups.google.com/d/msg/django-users/-/F0cKmlxJTW8J.
> > > To post to this group, send email to django-users@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > > django-users+unsubscr...@googlegroups.com.
> > > For more options, visit this group at
> > >http://groups.google.com/group/django-users?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: splitting uploaded CSV data

2011-08-05 Thread Vasu Nagalingam
Thanks. I am on it. Info below for future readers.

What I did was:
1) set the order of the upload file handing in the settings.py so that
default behavior in Django will always be to save the file to drive
instead of keeping it in memory (for files under 2.5M)
FILE_UPLOAD_HANDLERS = (
'django.core.files.uploadhandler.TemporaryFileUploadHandler',
'django.core.files.uploadhandler.MemoryFileUploadHandler',
)

2) in my post upload routine, I opened the file using Python's CSV
manipulation library.
import csv

fname = uploaded_data_file.temporary_file_path()
f = csv.reader(open(fname, 'rb'), delimiter=',', quotechar='"')
for line in f:
   co_id = line[0]
   co_name = line[1]
   co_addr1 = line[2]
and so forth.



On Aug 5, 4:01 pm, Subhranath Chunder  wrote:
> Using the string split on CSV like this is bad in practice. Prefer using CSV
> manipulation library instead. Like,http://docs.python.org/library/csv.html
>
> You can use the CSV reader module for your purpose.
>
> On Sat, Aug 6, 2011 at 1:13 AM, Vasu Nagalingam wrote:
>
>
>
>
>
>
>
> > Hi - I am in implementing a batch file import function where the data file
> > is in CSV format. The data file is uploaded (InMemoryFileHandler)
> > successfully, but I am having trouble parsing the CSV data correctly.
>
> > My code:
> > for line in imported_data:
> >    line = line.split(',')
>
> > My data is organized in this
> > format: ,
> > 0001,"google","123 Main St","san francisco","CA",94000
> > 0002,"microsoft","1 Main St, 9th Floor","Boston","MA",17000
>
> > The code works fine for the first row (google). Due to the extra comma in
> > the address 1 element for Microsoft, the import of row is mucked up. Is
> > there a way to indicate the text delimiter as well as data delimiter for the
> > split function? Or, any other options?
>
> >  --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To view this discussion on the web visit
> >https://groups.google.com/d/msg/django-users/-/F0cKmlxJTW8J.
> > To post to this group, send email to django-users@googlegroups.com.
> > To unsubscribe from this group, send email to
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/django-users?hl=en.

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



Re: splitting uploaded CSV data

2011-08-05 Thread Subhranath Chunder
Using the string split on CSV like this is bad in practice. Prefer using CSV
manipulation library instead. Like,
http://docs.python.org/library/csv.html

You can use the CSV reader module for your purpose.


On Sat, Aug 6, 2011 at 1:13 AM, Vasu Nagalingam wrote:

> Hi - I am in implementing a batch file import function where the data file
> is in CSV format. The data file is uploaded (InMemoryFileHandler)
> successfully, but I am having trouble parsing the CSV data correctly.
>
> My code:
> for line in imported_data:
>line = line.split(',')
>
> My data is organized in this
> format: ,
> 0001,"google","123 Main St","san francisco","CA",94000
> 0002,"microsoft","1 Main St, 9th Floor","Boston","MA",17000
>
> The code works fine for the first row (google). Due to the extra comma in
> the address 1 element for Microsoft, the import of row is mucked up. Is
> there a way to indicate the text delimiter as well as data delimiter for the
> split function? Or, any other options?
>
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/F0cKmlxJTW8J.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

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



splitting uploaded CSV data

2011-08-05 Thread Vasu Nagalingam
Hi - I am in implementing a batch file import function where the data file 
is in CSV format. The data file is uploaded (InMemoryFileHandler) 
successfully, but I am having trouble parsing the CSV data correctly.  

My code: 
for line in imported_data: 
   line = line.split(',') 

My data is organized in this 
format: , 
0001,"google","123 Main St","san francisco","CA",94000
0002,"microsoft","1 Main St, 9th Floor","Boston","MA",17000

The code works fine for the first row (google). Due to the extra comma in 
the address 1 element for Microsoft, the import of row is mucked up. Is 
there a way to indicate the text delimiter as well as data delimiter for the 
split function? Or, any other options? 



-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/F0cKmlxJTW8J.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Count users joined ordered by month

2011-08-05 Thread Subhranath Chunder
Not the exact answer you were looking for, but I was only wondering, if you
have already figured the actual SQL query then why not simply use that
instead.

It's not mandatory to use the model query APIs, if your query is complex.
Using the raw() API would still yield you model querysets or instances.
https://docs.djangoproject.com/en/dev/topics/db/sql/


On Fri, Aug 5, 2011 at 11:21 PM, Simon Zimmermann wrote:

> In SQL we can do
>
> SELECT MONTH(date_joined), YEAR(date_joined), COUNT(id) as
> joined_month
> FROM auth_user
> GROUP BY MONTH(date_joined), YEAR(date_joined)
> ORDER BY YEAR(date_joined), MONTH(date_joined)
>
> Which yields a table like this
>
> MONTH(date_joined)  YEAR(date_joined)   joined_month
> 3   200124
> 4   200186
> 5   2001133
> 6   200161
>
> Is it possible to do this with the Django ORM? So far I only got half
> of it with the following
>
> User.objects.all().extra({'month_joined':
>
> 'month(date_joined)'}).values('month_joined').annotate(created_count=Count('id'))
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: Calculation for each object in a QuerySet

2011-08-05 Thread Jacob Kaplan-Moss
On Fri, Aug 5, 2011 at 1:49 PM, nixlists  wrote:
> I need a view where for every row returned from Claim I make a
> calculation based on quantity from the Claim, rebate_pct and wac. Is
> it possible to write a model method that would access these fields
> from the other tables?

If I was in your shoes, I'd use Claim.objects.raw() and just write a
raw SQL query (see http://django.me/raw).

Jacob

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



Re: Calculation for each object in a QuerySet

2011-08-05 Thread nixlists
On Fri, Aug 5, 2011 at 7:51 AM, bruno desthuilliers
 wrote:
> Without more informations about your models (and specially the
> relationships), it's going to be rather difficult. As a general
> consideration, if your Claim model can access these other models thru
> relationships, well you just have to follow the relationships. This is
> basic Django ORM stuff, well explained in the FineManual.

Hi

I have:

class Product(models.Model):
ndc = models.CharField(max_length=50)
product_name = models.CharField(max_length=50)
quantity = models.IntegerField()
...

class Pricing(models.Model):
ndc = models.ForeignKey(Product)
# wholesale acquisition cost
wac = models.DecimalField(max_digits=17, decimal_places=8)
...
class Contract(models.Model):
name =  models.CharField(max_length=100)
products = models.ManyToManyField(Product, through='ContractProduct')

class ContractProduct(models.Model):
contract = models.ForeignKey(Contract)
ndc = models.ForeignKey(Product)
wac = models.ForeignKey(Pricing)
rebate_pct = models.DecimalField(max_digits=17, decimal_places=8)
admin_pct = models.DecimalField(max_digits=17, decimal_places=8)

class Claim(models.Model):
contract = models.ForeignKey(Contract)
ndc = models.ForeignKey(Product)
quantity = models.IntegerField(blank=True, null=True)

I need a view where for every row returned from Claim I make a
calculation based on quantity from the Claim, rebate_pct and wac. Is
it possible to write a model method that would access these fields
from the other tables?

Thanks.

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



Re: Django for a front end designer

2011-08-05 Thread Doug Ballance
I don't think it's necessarily a choice between learning php or
learning python.  Most programming languages are fairly similar in
concept, and once you've mastered one it's reasonably easy to pick up
a new one.  Python is a great language, but I think it's especially
great as a first language. Your time spent learning python and django
will not be wasted if you also choose to learn/use php.  I think it's
much easier to learn good methodology and practices with python, and
then carry those practices over to php than than the other way
around.

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



Count users joined ordered by month

2011-08-05 Thread Simon Zimmermann
In SQL we can do

SELECT MONTH(date_joined), YEAR(date_joined), COUNT(id) as
joined_month
FROM auth_user
GROUP BY MONTH(date_joined), YEAR(date_joined)
ORDER BY YEAR(date_joined), MONTH(date_joined)

Which yields a table like this

MONTH(date_joined)  YEAR(date_joined)   joined_month
3   200124
4   200186
5   2001133
6   200161

Is it possible to do this with the Django ORM? So far I only got half
of it with the following

User.objects.all().extra({'month_joined':
'month(date_joined)'}).values('month_joined').annotate(created_count=Count('id'))

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



Upload Multiple Images App ?

2011-08-05 Thread fire_water
I am writing my first Django application and one feature I want to
include is the ability for each registered user to be able to upload
multiple images. (By registered user, I just mean a typical "create
username/password, wait for email notice, activate account".)

Each image would be automatically resized and a thumbnail created. I
should also be able to edit and delete the image(s) in the admin.

I like the simplicity of django-stdimage but it lacks multiple image
support and has a http://code.google.com/p/django-stdimage/
issues/detail?id=22">known bug that does not delete images when
its object/row is deleted.

Photologue looks massive but according to this post, the author of Photologue recommends using django-imagekit in this
situation because it was meant to be integrated into other
applications as opposed to being a standalone application.

According to django-imagekit's github.com page, it has the same https://github.com/jdriscoll/django-imagekit/issues/16;>bug
as django-stdimage.

…ugh. Any recommendations, considering my requirements?

Thank you :)

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



RE: Django for a front end designer

2011-08-05 Thread Sells, Fred
I think many of the members of this group have a pro-python bias for a
good reason.  Most of us have had to work with many other frameworks and
languages and Python is the only one I would use to "unwind".

Sometimes it's worth "paying your dues"

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



Re: How to delete data table at command line

2011-08-05 Thread Matt Mansour
If you want to alter your schema (remove a field from the table, or
remove the entire table), first remove the field from your model, or
remove the entire model. Then make the change in your database.

Or you can look into using 'south' for schema changes. After you spend
a little time learning it you'll love it.

If you just want or remove all the data from your table, and all
foreign relations, you can use
Model.objects.all().delete()

On Fri, Aug 5, 2011 at 9:45 AM, Le Huu Nghia  wrote:
> Dear all,
> I'm new at Django . i have got a trouble with delete table.
> I want to delete my table that is wrong field , but i can 't figure out how
> to do that.
>
> Pls , Help me
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

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



How to delete data table at command line

2011-08-05 Thread Le Huu Nghia
Dear all,

I'm new at Django . i have got a trouble with delete table.

I want to delete my table that is wrong field , but i can 't figure out how
to do that.

Pls , Help me

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



django-admin-tools column module placement

2011-08-05 Thread ironfroggy
Does anyone know how to control which column a module appears in,
using django-admin-tools?

it seems to just split the modules up into even numbers of modules per
column, but they aren't all the same size and some i want in specific
columns so they appear at the top, as alerts. Anyone know how to do
this?

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



Re: Django table with checkboxes

2011-08-05 Thread Stanislav Nedelchev
Sorry for my late response.
I found a way how to do it.
My fist mistake was that I creat a view fo deleting books.
And my form action is pointing this url.
Afrer I changed it to point to "."
But I search for more pythonic way.
This is how i get checked checkboxes;
try:
ch = []
if request.method == 'POST':
  ch = request.POST.getlist('checkbox')
#assert False

This is part of  my template.




input type="submit" value="Send me">
But I read that I can generate form from model and add checkbox.
https://docs.djangoproject.com/en/dev/topics/forms/modelforms/
But at the moment I don't know how to implement it .
https://docs.djangoproject.com/en/dev/topics/forms/formsets/#manually-rendered-can-delete-and-can-order

On 2 Авг, 00:34, Sophie Hume  wrote:
> Hi Stanislav
>
> I think there's two ways you can do this... if you want to go down the
> Forms route you actually want to be looking at Formsets [1], which
> allow you to have a 'grid' of forms in atablewith one row
> representing each object.
>
> If that seems like a steep learning curve to get your head around, and
> you just want to try a quick-and-dirty approach, then you'd want a
> loop in your template like {% for book in books %} ... {% endfor %}
> then inside the loop build a  for each item. If you make the first
> tag in each row something like  name="selected_book_id" value="{{ book.id }}" /> then follow it with
> the other data fields, and have all of that wrapped in  ...  form> tags, obviously, then you should be able to get the list of
> checked options in your view by reading
> request.POST.getlist(selected_book_id).
>
> Hope this helps!
> Sophie
>
> [1]https://docs.djangoproject.com/en/dev/topics/forms/formsets/
>
> On Aug 1, 1:35 pm, jocke khazad  wrote:
>
>
>
>
>
>
>
> > Hi Stanislav,
>
> > I would sugest to create your own form object instead of creating input tags
> > directly in your template.
>
> > Read this page which also explains how to validate your form on the
> > serverside:https://docs.djangoproject.com/en/dev/topics/forms/
>
> > Use a boolean field to generate a checkbox.
>
> > Best regards,
> > Joakim
>
> > On Mon, Aug 1, 2011 at 10:08 AM, Stanislav Nedelchev 
> > wrote:
>
> > > Hi everyone,
> > > I'm quite new to django and still learning.
> > > But I face a problem that i can't solve.
> > > I have the following very simple example.
> > > Let say that I have one model for Books.
>
> > > class Book(models.Model):
> > >    name = models.CharField(max_length=50,unique = True)
> > >    description = models.TextField(blank = True)
> > >    status = models.CharField(max_length=50,unique = True)
> > >    created_on = models.DateTimeField(auto_now=True)
> > >    def __unicode__(self):
> > >        return self.name
>
> > > If I search for all books for example.
> > > I want to displaytablewith result where first column is checkbox.
> > > And if I check some books and hit button delete to be able to delete
> > > them.
> > > Also I what to have one input field or drop down where i can choose
> > > "out of order" and click button update to change status of all slected
> > > books to "out of order"
> > > I'm reading the documentaion but I can't find how to do it.
> > > I made one template where I generatetablewith results.But I can't
> > > process checked books.
> > > I added manually delete button and form in template.
> > > But maybe I must use Forms instead.
> > > Any hint or example how to acomplish this will be very usefull.
>
> > > And sorry for my bad english.
> > > Best regards
>
> > > --
> > > You received this message because you are subscribed to the Google Groups
> > > "Django users" group.
> > > To post to this group, send email to django-users@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > > django-users+unsubscr...@googlegroups.com.
> > > For more options, visit this group at
> > >http://groups.google.com/group/django-users?hl=en.

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



Admin: prepolulated foreign keys in inline

2011-08-05 Thread Tobias Ottenweller

Hi,

what I'm trying to do seems to be a little hard. I've got three 
model-classes:


class A(models.Model):
...

class B(models.Model):
...

class C(models.Model):
a = models.ForeignKey(A)
b = models.ForeignKey(B)
...

class Meta:
unique_together = ('a', 'b')
...


In admin.py C is defined as a inline of B. I'm now trying to add inlines 
of C for each instance of A (that already works). Plus I want to preset 
the foreign keys to A in the inline forms & make it the only available 
choice - each inline gets it's own instance of A.

Here is want I already did in admin.py:

class CInline(admin.TabularInline):
model = C
...

def formfield_for_foreignkey(self, db_field, request, **kwargs):
if db_field.name == 'a':
a = self.as[self.a_counter]
self.a_counter = (self.a_counter + 1) % len(self.as)

kwargs["queryset"] = A.objects.filter(pk=a.id) # bad for 
performance

db_field.default = a


return super(CInline, self).formfield_for_foreignkey(db_field, 
request, **kwargs)



class BAdmin(admin.ModelAdmin):
model = B
inlines = ( CInline, )

def add_view(self, request, form_url='', extra_context=None):

inline = self.inlines[0]
inline.max_num = len(a.objects.all())
inline.extra = len(a.objects.all())

inline.language_counter = 0
inline.languages = a.objects.all()

return super(BAdmin, self).add_view(request, form_url, 
extra_context)



Problem is that formfield_for_foreign doesn't seem to be called for all 
foreign_keys in each inline element of the add page. Or maybe the 
formfield gets reused.
The result is that all inline elements get the same queryset and default 
value.


I'm a lithe bit stuck here. Maybe there is a complete other way to solve 
my problem.


Cheers


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



django-php 0.1

2011-08-05 Thread rei
I accidentally PHP support for the Django template language.

No support yet for cookies, headers or event GET / POST, but otherwise
functional. See the source code for usage examples.

Link: http://animuchan.net/django_php/

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



Re: onmouseover in JavaScript not working

2011-08-05 Thread Josh

>
> >Basically, unless you inserted your js code (or any other markup) 
> >using a {{ var }} or {% tag %}, there is NO "restrictions on these 
> >blocks with javascript". 
>
> >Did you at least inspected the *rendered* template to see how what 
> >your HTML and js looks like ? 
>

Thanks for pointing these things out about js. At least I know now that it 
isn't Django-related.

I checked the source and the relevant html and js is the same. I diffed the 
rendered js and there were no differences. Real strange though. I'll skip 
this thing and continue with some other js to see if this also gives 
problems.



-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/b-KhM81tEccJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: [Commercial] Freelance developer looking for long-term/contract based work

2011-08-05 Thread Subhranath Chunder
Have updated my Linkedin profile with project details.
 On Jul 29, 2011 7:41 PM, "Subhranath Chunder"  wrote:
> Hi,
>
> I'm an experienced Django developer, with good experience in web
application
> development using Django as the underlying backbone. Have done numerous
> projects in this, and my entire work experience is also build around it.
>
> Summary: I love to work on challenging Django/Python projects, which
> involves working and experimenting with new and interesting ideas and
> technologies.
> Fancy my chances to work on performance enhancements and optimizations of
> web applications, along with architectural designs of web products.
>
> Skillset: Web application development, Django/Python, GAE, jQuery,
Facebook
> Application Development
>
> Links to some publicly available code snippets of mine:
> http://scratch-blog.appspot.com
> https://github.com/subhranath
>
> LinkedIn profile (Needs to update the projects section soon):
> http://in.linkedin.com/pub/subhranath-chunder/24/50/a01
>
> Currently, I'm switching work from a full-time employee to a full-time
> freelancer.
> Thus, I'm looking for some nice and interesting long-term or contractual
> opportunity for work engagement.
>
> I could surely use some help to get some project, to get me started on my
> freelancer career.
> Please let me know if anyone is interested, or need any more details.
>
> Thanks,
> Subhranath Chunder.

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



Re: Django 1.4?

2011-08-05 Thread Russell Keith-Magee
On Fri, Aug 5, 2011 at 9:01 PM, Littke  wrote:
> Hi.
>
> Is there a schedule/roadmap for the release of Django 1.4?
>
> If not, how far away would you guesstimate it is?

Hi,

We haven't made any formal announcements about release plans for
Django 1.4 as yet.

If I had to guess, a release is still several months off. Even if we
were to cut an alpha right now, we'd still need a couple of months to
shake the bugs out, and we're not quite at the point of being able to
cut an alpha.

Yours,
Russ Magee %-)

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



Trying to understand db.reset_queries()

2011-08-05 Thread bax...@gretschpages.com
With debug = False, under what circumstances (if any) should I have
db.reset_queries()? I understand from docs that queries are cleared in
the request cycle, but can anyone give me an example of what sort of
thing would require it being done manually?

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



Re: Django - modifying navigation design

2011-08-05 Thread bax...@gretschpages.com
I'm betting it's just sitting in the template as plain HTML.

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



Re: Django for a front end designer

2011-08-05 Thread bax...@gretschpages.com
I came into Django as a designer. It can be done, just take baby
steps. The more python you learn, the happier you'll be, and the more
productive. But in the mean time, you can do a lot with generic views
and reusable apps that would keep you from having to write much code
at all. I would suggest finding Jeff Croft's Django for designers blog
post from a few years back. It's a little out of date, but still worth
reading.

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



Re: Django for a front end designer

2011-08-05 Thread Peter Murphy
If you are thinking about diving into PHP, I suggest you read this
first:

http://www.tbray.org/ongoing/When/200x/2006/02/17/PHP

It's five years old, but it contains a lot of links to pro- and anti-
PHP rants, which you should consider. (Consider also that there's no
good Unicode support inside PHP even after this time.) Personally,
reading it was enough for me to dive into Python instead. But you may
feel differently.

Another thing you should consider: sometimes programming languages
such as Python can be used for web-related things that aren't just
running a web server. Take screen-scraping: taking an existing website
of a client, and extracting its content for your use. There are
libraries available with Python like BeautifulSoup that allow you to
handle malformed HTML and scrape it into what ever file format you
want. Then you can use Django's admin functionality to load the file
into your database, making a new Django-powered website for your
client!

How would you screen-scrape in PHP? Is it even possible?

Before reading the Django tutorial, read the Python tutorial, and see
if the language is right for you or not:

http://docs.python.org/tutorial/

Whatever your decision, good luck!

Best regards,
Peter

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



Re: Django 1.4?

2011-08-05 Thread Herman Schistad
On Fri, Aug 5, 2011 at 15:01, Littke  wrote:
> Hi.
> Is there a schedule/roadmap for the release of Django 1.4?
> If not, how far away would you guesstimate it is?

Here is the roadmap wiki:
https://code.djangoproject.com/wiki/Version1.4Roadmap

Which is pretty empty, but you can sort the tickets by milestone and
get an overview:
https://code.djangoproject.com/query?milestone=1.4=id=summary=status=owner=type=milestone=priority

Also, 1.2 was released May 17th 2010
1.3 was released March 23rd 2011 ... so almost a year (although that
may not happen 1.3 -> 1.4)

-- 
With regards, Herman Schistad

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



Re: onmouseover in JavaScript not working

2011-08-05 Thread bruno desthuilliers
On Aug 5, 3:22 pm, Josh  wrote:
> I'm new at Django and am experimenting with JavaScript in templates.
>
> I've put JavaScript from Google Charts in a block and it is displaying the
> chart properly. The onmouseover should display the details of elements in
> the chart, but that isn't working in Django. In a plain html-page it is
> displayed, so I guess it is being blocked by Django and I should enable
> this.

Django doesn't "block" javascript, and is totally agnostic about
javascript FWIW.

> I've tried the {% autoescape on/off %} tag,

Escaping considerations only apply to dynamic content (=> content
inserted by the template system using either a {{ var }} or a {% tag
%}). See the "safe" (IIRC) filter to disable escaping on dynamic
content.

> but that doesn't solve it. How
> can I activate this?

There's nothing to "activate".


> Basically I want no restrictions on these blocks with
> JavaScript.

Basically, unless you inserted your js code (or any other markup)
using a {{ var }} or {% tag %}, there is NO "restrictions on these
blocks with javascript".

Did you at least inspected the *rendered* template to see how what
your HTML and js looks like ?

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



Re: Start to get error after modifying models

2011-08-05 Thread Shawn Milochik
What did you change? Hopefully you're using version control and can do a 
diff.


The traceback you provided isn't very helpful to most people because 
it's from Django's internals instead of your own code.


In any case, you need to do more work before you'll get much help, 
unless someone's specifically seen this traceback before and solved it 
and feels super helpful.


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



Re: Run an application periodically on django

2011-08-05 Thread sedl...@gmail.com
Hi,
just one thought - if the update is not much time-consuming, you can
write your view which allways parses the data and then cache the view
for 30 seconds. That way if nobody looks at your page, you won't do
useless work in the background.

See https://docs.djangoproject.com/en/dev/topics/cache/

Regards,
Filip

On 5 srp, 13:02, Mohamed Ghoneim  wrote:
> Thanks guys,
> That was really helpful, have a nice day
>
> --
> Mohamed Sayed Ghoneim
>
>
>
> On Fri, Aug 5, 2011 at 4:37 AM,  wrote:
> > I am out of office right now and will get back to you when I return. If you
> > don't hear from me, my assistant should contact you shortly. Check out this
> > massage chair that I just bought to help relax me after work!.Click 
> > Here
>
> > Enable images or click 
> > here
>
> > 
> > Let me know what you think after you have a chance to review.
> > Cheers!
>
> > If you no lon ger wish to receive emails, please 
> > unsubscribe
>
> > 866-288-1880
> > 5150 yarmouth ave, Encino, CA 91316
>
> > On Thu, 4 Aug 2011 08:12:21 +0300, Mohamed Ghoneim ** wrote:
> > Hey guys,
>
> > I am new to djnago and I have= heard a lot about its powerful capabilities,
> > so I=A0preferred=A0it over ot= her web frameworks.
>
> > My problem is I have a webpage= that its content should be updated
> > automatically every 30 seconds as I bui= ld an app that gets data from
> > another web page
> > and parse it and then updates my webpage.
>
> > My = problem is how can I schedule this this app to run every 30 seconds?
> > and ca= n I do this on a hosting website?
> > -- Mohamed Sayed Ghoneim
>
> >  --
> > You received this message because you are subscribed to the Google Groups
> > "= Django users" group.
> > To post to this group, send email to django-users@googlegroups.com.
> > To unsubscribe from this group, send email to django-users+unsubscribe@goog=
> > legroups.com.
> > For more options, visit this group athttp://groups.google.com/group/django=
> > -users?hl=3Den .– 
> > Skrýt citovaný text –
>
> – Zobrazit citovaný text –

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



Django 1.4?

2011-08-05 Thread Littke
Hi.

Is there a schedule/roadmap for the release of Django 1.4?

If not, how far away would you guesstimate it is?

Thanks.

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



Start to get error after modifying models

2011-08-05 Thread ozgur yilmaz
Hi,

After i modified some models, i started to get following errors:

Traceback (most recent call last):

  File "C:\Python26\lib\site-packages\django\core\servers\basehttp.py",
line 280, in run
self.result = application(self.environ, self.start_response)

  File "C:\Python26\lib\site-packages\django\core\servers\basehttp.py",
line 674, in __call__
return self.application(environ, start_response)

  File "C:\Python26\lib\site-packages\django\core\handlers\wsgi.py",
line 241, in __call__
response = self.get_response(request)

  File "C:\Python26\lib\site-packages\django\core\handlers\base.py",
line 141, in get_response
return self.handle_uncaught_exception(request, resolver, sys.exc_info())

  File "C:\Python26\lib\site-packages\django\core\handlers\base.py",
line 165, in handle_uncaught_exception
return debug.technical_500_response(request, *exc_info)

  File "C:\Python26\lib\site-packages\django\views\debug.py", line 58,
in technical_500_response
html = reporter.get_traceback_html()

  File "C:\Python26\lib\site-packages\django\views\debug.py", line
109, in get_traceback_html
frames = self.get_traceback_frames()

  File "C:\Python26\lib\site-packages\django\views\debug.py", line
228, in get_traceback_frames
pre_context_lineno, pre_context, context_line, post_context =
self._get_lines_from_file(filename, lineno, 7, loader, module_name)

  File "C:\Python26\lib\site-packages\django\views\debug.py", line
209, in _get_lines_from_file
context_line = source[lineno].strip('\n')

IndexError: list index out of range

--

First of all, i deleted *.pyc files and restarted the server. But
nothing changed. Do you have any suggestions?

Thanks,

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



onmouseover in JavaScript not working

2011-08-05 Thread Josh
I'm new at Django and am experimenting with JavaScript in templates. 

I've put JavaScript from Google Charts in a block and it is displaying the 
chart properly. The onmouseover should display the details of elements in 
the chart, but that isn't working in Django. In a plain html-page it is 
displayed, so I guess it is being blocked by Django and I should enable 
this.

I've tried the {% autoescape on/off %} tag, but that doesn't solve it. How 
can I activate this? Basically I want no restrictions on these blocks with 
JavaScript.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/7U106vpYmIAJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django - modifying navigation design

2011-08-05 Thread bruno desthuilliers
On Aug 5, 5:49 am, Daniel  wrote:
> Hi,
>
> I'm working on a Django website made by someone else and I'm trying to
> change how the navigation on the left looks.
(snip)

Programming by accident won't get you very far. You should either
contact the original developper or, if not possible, find out which of
the django apps is responsible for the menus (looks like some django-
cms stuff but I may be wrong) and read the doc if any. If by then you
still havent found out, try asking on the app's newsgroup (if any), or
go and read the source code until you understand enough of it to solve
your problem.

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



Re: Request for new user account via email Django

2011-08-05 Thread Sheogora
There was a different problem actually,
RequestContext(request) was never called

I removed that line and put it in the above return.
Worked fine :)
thank you for the effort tho

On Aug 4, 5:58 pm, Shawn Milochik  wrote:
> In your view you should be instantiating the form with the data from
> request.POST instead of reading the values directly.
>
> Also, you mention that you get a 403 error when you post your name and
> password, but the form and template you pasted don't include password,
> so I suspect the error is coming from elsewhere.

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



Re: Run an application periodically on django

2011-08-05 Thread Mohamed Ghoneim
Thanks guys,
That was really helpful, have a nice day

--
Mohamed Sayed Ghoneim



On Fri, Aug 5, 2011 at 4:37 AM,  wrote:

> I am out of office right now and will get back to you when I return. If you
> don't hear from me, my assistant should contact you shortly. Check out this
> massage chair that I just bought to help relax me after work!.Click 
> Here
>
> Enable images or click 
> here
>
> 
> Let me know what you think after you have a chance to review.
> Cheers!
>
> If you no lon ger wish to receive emails, please 
> unsubscribe
>
> 866-288-1880
> 5150 yarmouth ave, Encino, CA 91316
>
> On Thu, 4 Aug 2011 08:12:21 +0300, Mohamed Ghoneim ** wrote:
> Hey guys,
>
> I am new to djnago and I have= heard a lot about its powerful capabilities,
> so I=A0preferred=A0it over ot= her web frameworks.
>
> My problem is I have a webpage= that its content should be updated
> automatically every 30 seconds as I bui= ld an app that gets data from
> another web page
> and parse it and then updates my webpage.
>
> My = problem is how can I schedule this this app to run every 30 seconds?
> and ca= n I do this on a hosting website?
> -- Mohamed Sayed Ghoneim
>
>  --
> You received this message because you are subscribed to the Google Groups
> "= Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to django-users+unsubscribe@goog=
> legroups.com.
> For more options, visit this group at http://groups.google.com/group/django=
> -users?hl=3Den .
>

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



Django - modifying navigation design

2011-08-05 Thread Daniel
Hi,

I'm working on a Django website made by someone else and I'm trying to
change how the navigation on the left looks.

Currently it shows links to pages on the current level and any child
pages, but we're looking to have it more traditional where it shows
parent and child pages (to a certain extent).
For example from the homepage you can go to Products and Products has
child pages and those child pages may have child pages etc.

If you go into Home>Products>Transportation>Flight on the left hand
side we want it to show:

 - Products
  - Transportation
 - Flight
 - Driving
  - Engineering
 - Blah


Instead it currently shows:

- Transportation
- Flight
- Driving
- Engineering
- Blah

I've tried looking into Django Administration for any way of editing
it but the best i can come up with is if I go into the Menus link it
shows an added menu called 'Left Menu' which when clicked on doesn't
give you anything really to change.

Otherwise in the ftp server I've gone into themes and found the
template html file which has amonst other things:

{% show_menu "left_menu" "leftmenuinner" "parent" 0 100 0 1 %}

If I try modifying the four parameters (start_level, end_level, etc.)
nothing happens (even removing them completely doesn't change
anything).

Removing "parent" makes it just show the initial page links (Products,
About Us, etc).
Removing "leftmenuinner" removes the css from the links.
Of course removing "left_menu" makes it so no links appear as they're
all connected to that menu name.

Would anyone know where I should go to modify how it the links show up?

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



Re: Calculation for each object in a QuerySet

2011-08-05 Thread bruno desthuilliers
On Aug 5, 12:42 am, nixlists  wrote:
> On Thu, Aug 4, 2011 at 5:31 PM, Javier Guerra Giraldez
>
>  wrote:
> > On Thu, Aug 4, 2011 at 3:53 PM, nixlists  wrote:
> >> What's the correct way to write the view then? Any work-arounds?
>
> > - collect the modified objects to a list, don't rely on the queryset
> > to store them
>
> > or
>
> > - add a method to the model, as i mentioned originally.
>
> Thanks. I'd prefer to add a method to the model, I just don't know how
> to make it find the values for fields that are in other models.

Without more informations about your models (and specially the
relationships), it's going to be rather difficult. As a general
consideration, if your Claim model can access these other models thru
relationships, well you just have to follow the relationships. This is
basic Django ORM stuff, well explained in the FineManual.

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



Google AppEngine vs. dedicated hosting (Pros/cons)

2011-08-05 Thread Herman Schistad
Hello.

I'm developing a site with approx. 500 visits per day, mainly from
Norway (Europe).

Now I'm trying to find the best possible way to host this site.
Earlier I've used dedicated hosts like WebFaction and Djangoeurope,
and this has worked pretty well.
However Google AppEnginge is free and provides a really reliable
server (as far as I can tell). But I'm no expert on this matter and
therefore come to you guys.

What is the tradeoff between using Google AppEngine (with
django-nonrel [1]), learning this, and writing my application for the
Google datastore versus using a traditional host.
Are there any big challanges by using AppEngine?

A third alternative would to maybe invest in e.g. dedicated virtual
machine at MediaTemple[2] or something.

So what it all boils down to: which is your preffered hosting method,
and why/why not?
- Google AppEngine
- Dedicated django hosting (e.g. WebFaction[3])
- Virtual server/dedicated server (e.g. MediaTemple)

tl;dr: pros/cons with Google AppEngine, and which hosting method is
your preferred method?

[1]: http://code.google.com/appengine/articles/django.html
[2]: http://mediatemple.net/webhosting/dv/
[3]: http://www.webfaction.com/

-- 
With regards, Herman Schistad

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



Re: Django docs and GSoC doc summit

2011-08-05 Thread adam

last day today :)

https://sites.google.com/site/docsprintsummit/

adam



On 08/03/2011 01:44 AM, Russell Keith-Magee wrote:

On Tue, Aug 2, 2011 at 6:43 PM, eset  wrote:

hi,

I am new to the Django list but I am a django fan (we dev with Django
for www.booki.cc)... anyways I wanted to encourage the Doc team and
individuals on the list to apply for the GSoC Documentation Summit
(details below):
https://sites.google.com/site/docsprintsummit/

You can apply as an individual or a group.  Applications close Friday
(5th), application process takes about 2-5 mins :)


Hi Adam,

Thanks for drawing our attention to this. This sounds like a great
opportunity to hack on Django's docs -- I'll see if we can shake loose
some volunteers to attend.

For anyone

Yours,
Russ Magee %-)



--

--
Adam Hyde
Founder, FLOSS Manuals
Project Manager, Booki
Book Sprint Facilitator
mobile :+ 49 177 4935122
identi.ca : @eset
booki.flossmanuals.net : @adam

http://www.flossmanuals.net
http://www.booki.cc
http://www.booksprints.net

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



Re: django-registration - stuck at Required templates topic

2011-08-05 Thread Bruce Dou
I also think that should be a default simple template in the package.

On Fri, Aug 5, 2011 at 12:52 PM, Phang Mulianto  wrote:

> well..like the error said..you need to put {% csrf_token %} inside your
> form.. do you read the tutorial? you should read it if you serious getting
> in django. . it helps you alot as it help me too..
> On Aug 5, 2011 12:12 PM, "bob gailer"  wrote:
> >
> >
> > On Aug 4, 11:47 pm, Mario Gudelj  wrote:
> >> Hey Bob,
> >>
> >> You can download some basic templates for this pagehttp://
> devdoodles.wordpress.com/2009/02/16/user-authentication-with-d...
> >
> > OK - did that - now what? I can get the login form displayed - when I
> > click get:
> >
> > Forbidden (403)
> >
> > CSRF verification failed. Request aborted.
> > Help
> >
> > Reason given for failure:
> >
> > CSRF token missing or incorrect.
> >
> >
> > In general, this can occur when there is a genuine Cross Site Request
> > Forgery, or when Django's CSRF mechanism has not been used correctly.
> > For POST forms, you need to ensure:
> >
> > The view function uses RequestContext for the template, instead of
> > Context.
> > In the template, there is a {% csrf_token %} template tag inside
> > each POST form that targets an internal URL.
> > If you are not using CsrfViewMiddleware, then you must use
> > csrf_protect on any views that use the csrf_token template tag, as
> > well as those that accept the POST data.
> >
> > I have no idea what to do with that message.
> >
> > I need a lot more hand-holding, since I am VERY new to django.
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> "Django users" group.
> > To post to this group, send email to django-users@googlegroups.com.
> > To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
> >
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
A decathlon Developer & programmer
http://blog.eood.cn/

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