Re: Getting into professional django development

2011-10-18 Thread Kurtis Mullins
I recommend South as well. Also, if you're interested -- I *might* be able
to connect you with some part-time work on a current project. Contact me
privately if want to know more. I need to talk it over with the big-man who
signs the pay-check but I could definitely use the help.

On Tue, Oct 18, 2011 at 10:28 PM, kenneth gonsalves
wrote:

> On Tue, 2011-10-18 at 16:00 +0100, Tom Evans wrote:
> > I can't stand incorrect pedantry - this is my curse.
> >
> > Kenneth actually said that "1.3 is ancient, you should be using
> > trunk", which he corrected to "1.2 is ancient, you should be using
> > trunk". His advice, regardless of which version you look at, is to use
> > trunk - not the latest stable release.
> >
> >
>
> if you are playing around and learning - production is an entirely
> separate issue which depends on many factors, a lot of which are beyond
> the control of the developer.
> --
> regards
> Kenneth Gonsalves
>
> --
> 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: How to access model class for a ModelAdmin?

2011-10-18 Thread Matt Schinckel
If you are in an instance method of a ModelAdmin, you can use `self.model` 
to get the model associated with the ModelAdmin.

Have a look in django.contrib.admin's source for what methods you can 
override, or hook into.

-- 
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/-/fHAVbMmqNqMJ.
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: Getting into professional django development

2011-10-18 Thread kenneth gonsalves
On Tue, 2011-10-18 at 16:00 +0100, Tom Evans wrote:
> I can't stand incorrect pedantry - this is my curse.
> 
> Kenneth actually said that "1.3 is ancient, you should be using
> trunk", which he corrected to "1.2 is ancient, you should be using
> trunk". His advice, regardless of which version you look at, is to use
> trunk - not the latest stable release.
> 
> 

if you are playing around and learning - production is an entirely
separate issue which depends on many factors, a lot of which are beyond
the control of the developer.
-- 
regards
Kenneth Gonsalves

-- 
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: Getting into professional django development

2011-10-18 Thread kenneth gonsalves
On Tue, 2011-10-18 at 16:47 +0200, Paul Menzel wrote:
> > > > 1.3 belongs to the stone age - since you are learning, it would
> be a
> > > > good idea to work with the current svn trunk, updating every
> week or
> > > > so.
> > > > --
> > >
> > > s/1.2/1.3/
> 
> > With all due respect to Mr. Gonsalves, I do not care to work with
> the
> > Django trunk unless I'm just playing around with something.  My goal
> > is always to produce a production quality application.  Even the
> more
> > stable than average Django trunk cannot provide the consistency
> needed
> > to deliver an app to a customer.  Plus, I don't need the extra work
> of
> > basing my code on a moving target.  When trunk becomes v1.4, I will
> > convert my applications and upgrade.
> 
> Please read the message you are referring to again. Kenneth corrected
> the post [2] (although the `sed`-command should be `s/1.3/1.2/`. »The
> latest official version is 1.3.1.« [1], so Kenneth suggested to use
> the
> current stable release. 

not right - I meant to say that 1.2 belongs to the stone age. I think
the sed command is correct.
-- 
regards
Kenneth Gonsalves

-- 
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: Getting into professional django development

2011-10-18 Thread kenneth gonsalves
On Tue, 2011-10-18 at 06:46 -0700, Dan Gentry wrote:
> With all due respect to Mr. Gonsalves, I do not care to work with the
> Django trunk unless I'm just playing around with something. 

with all due respect to Mr. Gentry, I submit that he has not read my
post properly - the relevant part he has missed is: 'since you are
learning'.
-- 
regards
Kenneth Gonsalves

-- 
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.



collectstatic in RPM install

2011-10-18 Thread dmitry b
Hi,

For deployment to production, I package my Django app into an RPM
package.  The install script is responsible for installing
dependencies, copying files, etc.  Now that I've switched to Django
1.3 I also want to run the collectstatic command as part of the
deployment script.  To do this, I've added the following to the spec:

%post
# collect static files
%{__python} %{installpath}/src/scam/manage.py collectstatic --noinput

The problem is that the command doesn't run from inside RPM.  Running
with -vv, I can see python being kicked off and I actually get a
couple of standard warning messages from Django.  That's it, though.
There is no list of files being copied and in the end, the static
directory isn't being created/populated.

Has anyone successfully tried incorporating collectstatic into an RPM-
based deployment?

RHEL 5.5
RPM 4.4.2.3
Python 2.6
Django 1.3.1

Thanks
Dmitry

-- 
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.



Tough problem with m2m field

2011-10-18 Thread John
I have been stymied by this one for a day or two now.
I have a situation where I have a 'reference' copy of an application
which gets deployed as a new django site with it's own database, url's
etc.  I am trying to automate this deployment as follows:  Present a
list of existing sites (there are other options such as disabling the
site etc.) with a button to 'Add New Site'.
In response to add new site, I create a form based on a Client model
in the database which has a m2m relationship with a User model, I also
add 3 other models to the form including the django-site ( A 'year'
and some other basic configuration stuff) by adding to the form Fields
list and by adding a custom save method.
Now the tricky stuff... I want to maintain a master list of the sites
in the reference database but only the active site in the site
specific database, I am doing this via a 2-step process of first
invoking the custom save method with an argument of 'site-only' and
commit=True to add the site record to the reference database, I then
do a custom SQL CREATE DATABASE, GRANT etc., dynamically add the new
database to the DATABASES in the settings, call_command
syncdb(database=new_database) and then call the custom save with
commit=True and database=new_database.
Believe it or not, this is all working perfectly fine EXCEPT for the
m2m relationship with the user (oops, I should have mentioned that I
also select one or more admin users from the reference database to add
to the new database).

Here is the code I have for the custom save method:


def save(self, commit=True, site_only=True, database='default'):
if not self.site:
self.site = Site(name=self.cleaned_data['name'],
 domain='provision.tigertaxanalytics.com/'
+ self.cleaned_data['acronym'])
if site_only:
if commit:
self.site.save(using=database)
return self.site
else:
self.client = super(ClientForm, self).save(commit=False)
if commit:
try:
self.site.save(using=database) # When we create
the client in the new database we also need to save the site with the
already known id
except Exception, e:
pass # Mostly for debugging where we don't have
true multiple sites
self.client.save(using=database)
client_users = super(ClientForm,
self).save_m2m(commit=False)
client_users.save(using=database)
#for user in self.cleaned_data['users']:
#user.save(using=database)
#client_user = Client_Users(client_id =
self.client.pk, user_id = user.pk)
#client_user.save(using=database)
self.provision = Provision(client = self.client,
  title =
self.cleaned_data['provision_title'])
self.provision.save(using=database)
self.tax_year = TaxYear(provision = self.provision,
   tax_year =
self.cleaned_data['tax_year'])
self.tax_year.save(using=database)
self.period = Period(tax_year = self.tax_year)
self.period.save(using=database)
return self.client

the error that I am getting is: " AttributeError: 'super' object has
no attribute 'save_m2m' " when I try and do the .save_m2m,  as far as
I can see I am trying to call save_mm2m of the base Form object after
doing a base Form.save(commit=False)

I guess I have a couple of issues that I haven't seen addressed
anywhere here:
  Is there actually a save_m2m(commit=False) ?  I don't see anyway
around the problem of saving into the new_database
  Is there another way to get at the default 'through' table, as you
see I tried to reproduce what I imagine save_m2m to be doing, but the
Client_Users model isn't present in the models.  If I take out the
save_m2m stuff it all works perfectly (at least from the database
analysis viewpoint) but I can't access the site without a user record
in the new_database.


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.



How to access model class for a ModelAdmin?

2011-10-18 Thread Lee
This must be easy but I'm not finding it in the docs. I need to access
the model class corresponding to the current ModelAdmin instance, so
that I can iterate through its objects. I need to do this generically
so that I can use the routine in all ModelAdmins.

Thanks for any help.

Lee

-- 
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.



[1.3] get_FOO_display() and prepopulated_fields?

2011-10-18 Thread Micky Hulse
Hello,

Are there any tricks to getting the display value of a choice field to
work with prepopulated_fields slug creation in the admin?



class Team(Base):

MALE = 1
FEMALE = 2
GENDER_CHOICES = (
(MALE, u'Men'),
(FEMALE, u'Women'),
)

slug = models.SlugField(_(u'slug'), max_length=100, unique=True,
db_index=True)
gender = models.IntegerField(_(u'gender'), choices=GENDER_CHOICES)

class TeamAdmin(admin.ModelAdmin):

prepopulated_fields = {
'slug': (
'title',
'gender',
)
}



The above (kinda) works, but it returns:

oregon-1
oregon-2

I would prefer if it returned:

oregon-men
oregon-women

Is there anyway for me to use get_gender_display in the admin's
prepopulated_fields?

Thanks!
Micky

-- 
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: cannot concatenate 'str' and 'FilterExpression' objects

2011-10-18 Thread nav
AT,

Thank you very much for your detailed answer. I have managed to get it
to work now and it seemed obvious after your explanation.

Thank you once again.

Yours sincerely,

nav

On Oct 18, 9:11 pm, Andre Terra  wrote:
> Hello, nav
>
> The most relevant lines in your traceback are:
>
> Template error:
>
> In template /home/nandu/django/swanlotus/templates/navigation.html, error at
> line 6
>
>    Caught TypeError while rendering: cannot concatenate 'str' and
> 'FilterExpression' objects
>
>    1 : {% load custom_tags %}
>    2 : {% load url from future %}
>
>    (...)
>
>    6 :   About Us
>
> File "/usr/local/lib/python2.6/dist-packages/django/template/defaulttags.py"
> in render
>   442.                     url = reverse(project_name + '.' + view_name,
>
> Which basically means project_name and view_name cannot be concatenated (as
> attempted on line 442 of defaulttags.py).
>
> If I had to guess, I'd say the problem is due to the fact that you're
> subclassing URLNode to create your custom {% subdomainurl %} tag, but also
> trying to {% load url from future %}.
>
> Loading the new url (which takes a string/variable as the first argument
> rather than a constant [1]) could indeed lead you to believe {% subdomainurl
> %} would behave the same way, but SubdomainURLNode (which is in your
> custom_tags) actually subclasses the "old" (current) URLNode class.
>
> If you want {% subdomainurl %} to be future-proof as well, then you will
> need to either modify it to subclass django.templatetags.future.URLNode [2].
> Another solution would be to create a second {% subdomainurl %}, that
> inherits from future.URLNode. Perhaps you could even split your custom tags
> into two separate libraries (one of them named custom_future or whatever)
> and allow for a syntax similar to the one you use to load {% url %}.
>
> On a side note, I'd recommend choosing a better name than "custom_tags"
> because that sounds too generic. You can have as many templatetags modules
> as you'd like, so don't be afraid to organize your tags in different files!
>
> Let us know if you have any other questions and good luck.
>
> Cheers,
> AT
>
> [1]https://docs.djangoproject.com/en/dev/ref/templates/builtins/?from=ol...
> [2]https://code.djangoproject.com/browser/django/trunk/django/templateta...
>
> On Tue, Oct 18, 2011 at 12:06 PM, nav  wrote:
> > AT,
>
> > Thanks for your email I have posted the custom template tag code and
> > the traceback at dpaste. The template code is at:
>
> >http://dpaste.com/636570/
>
> > the traceback is at:
>
> >http://dpaste.com/636571/
>
> > Please do let me know if anything else is required.
>
> > Thanks,
> > nav
>
> > On Oct 18, 5:20 pm, Andre Terra  wrote:
> > > Please post your code again on something likehttp://dpaste.comandI'll
> > > gladly take a look
>
> > > Cheers,
> > > AT
>
> > > On Tue, Oct 18, 2011 at 9:43 AM, nav  wrote:
> > > > If anyone has any pointers as to what might be the problem please
> > > > answer. I would greatly appreciate any help you maybe able to provide.
>
> > > > Thanks.
> > > > nav
>
> > > > On Oct 17, 11:44 pm, nav  wrote:
> > > > > Dear Folks,
>
> > > > > I am using a number of subdomains for my website and decided to
> > create
> > > > > a custom url tag and try as shown on
>
> >http://stackoverflow.com/questions/3461806/django-subdomains-and-mod-...
>
> > > > > My template tag being used in my template like this:
> > > > > About
> > > > > Us
>
> > > > > My template tags functions looks like this:
>
> > > > > class SubdomainURLNode(URLNode):
> > > > >     def render(self, context):
> > > > >         request = context['request']
> > > > >         domain = request.get_host()
> > > > >         subdomain = re.sub(r'^www\.','',domain).split('.')[0]
> > > > >         path = super(SubdomainURLNode, self).render(context)
> > > > >         return "%s/%s" % (str(request.get_host()), path)
>
> > > > > @register.tag
> > > > > def subdomainurl(parser, token, node_cls=SubdomainURLNode):
> > > > >     """Just like {% url %} but checks for a subdomain."""
> > > > >     node_instance = url(parser, token)
> > > > >     return node_cls(view_name=node_instance.view_name,
> > > > >         args=node_instance.args,
> > > > >         kwargs=node_instance.kwargs,
> > > > >         asvar=node_instance.asvar)
>
> > > > > While trying to render the template tag it comes back saying:
>
> > > > > TemplateSyntaxError at /
>
> > > > > Caught TypeError while rendering: cannot concatenate 'str' and
> > > > > 'FilterExpression' objects
>
> > > > > My template tag function does not return the path value from the
> > > > > statement:
> > > > > path = super(SubdomainURLNode, self).render(context)
>
> > > > > because the URLNode function fails on line 442 because of a type
> > > > > mismatch:
> > > > > url = reverse(project_name + '.' + view_name,
>
> > > > > I just tried using the standard url 

Re: Iteration over queryset in a model

2011-10-18 Thread eyscooby
Ok, this is helping, believe it or not your are helping, I'm probably
confusing myself mostly.

So the model method explanation was very helpful and you are correct
that works great, as long as all dates have a completion_date.  If a
new ticket is entered it will fail due to a "NoneType field with
DateField".
That line in my model is as such  "completed_date =
DateField(blank=True, null=True)".

The Manager is doing nothing more than returning data from the
database as a query so that makes sense also.

Step two .. is it because of the NULL=True?  can't subtract date field
from null field (which makes sense), is there a way around that?
I think this is why i was trying to calculate on a specific filter.


On Oct 18, 3:47 am, Daniel Roseman  wrote:
> On Monday, 17 October 2011 20:28:47 UTC+1, eyscooby wrote:
>
> > Ok, sorry I thought I was starting to understand it a little better,
> > but now I think I took a step backwards, so if it is ok with you let's
> > step back and take it a step at a time.
>
> > So, my first step is wondering if I really need a manager or not??
> > I was thinking from your first response to me that you might be
> > suggesting that I did.  Let's start there.
> > If I understand it correctly the Manager is a way of retrieving
> > specific information.
>
> > thanks
>
> Sorry for confusing you. There are two things going on here.
>
>  A Manager is for making custom queries to the database, to return new
> objects - either one or a queryset of many. Your original code was using
> `Model.filter()` and modifying the result, so I suggested that it belonged
> in a manager.
>
> A model method is useful when you want to do a separate, non-database,
> operation on a single object. That's what you really want to do here - given
> an instance of RequestTicket, calculate how old it is. There's no iteration
> contained in the method - you iterate through your existing queryset
> elsewhere (say in the template) and call days_old on each instance:
>
>     {% for ticket in completed_tickets %}
>        {{ ticket.name }}: {{ ticket.days_old }}
>     {% endif %}
>
> Or, in your particular circumstance, you simply give the `days_old` method
> as one of the elements of the `list_display` tuple, and Django takes care of
> the iterating, calling `days_old` on each row in the changelist.
>
> So in both of these circumstances, `days_old` simply needs to look like
> this:
>
>     def days_old(self):
>         return self.competion_date - self.issued_date
>
> - so it returns a single value, for the one particular ticket instance which
> it has been called on.
>
> Hope that helps.
> --
> DR.

-- 
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: cannot concatenate 'str' and 'FilterExpression' objects

2011-10-18 Thread Andre Terra
Hello, nav

The most relevant lines in your traceback are:


Template error:

In template /home/nandu/django/swanlotus/templates/navigation.html, error at
line 6



   Caught TypeError while rendering: cannot concatenate 'str' and
'FilterExpression' objects

   1 : {% load custom_tags %}
   2 : {% load url from future %}

   (...)

   6 :   About Us



File "/usr/local/lib/python2.6/dist-packages/django/template/defaulttags.py"
in render
  442. url = reverse(project_name + '.' + view_name,


Which basically means project_name and view_name cannot be concatenated (as
attempted on line 442 of defaulttags.py).

If I had to guess, I'd say the problem is due to the fact that you're
subclassing URLNode to create your custom {% subdomainurl %} tag, but also
trying to {% load url from future %}.

Loading the new url (which takes a string/variable as the first argument
rather than a constant [1]) could indeed lead you to believe {% subdomainurl
%} would behave the same way, but SubdomainURLNode (which is in your
custom_tags) actually subclasses the "old" (current) URLNode class.

If you want {% subdomainurl %} to be future-proof as well, then you will
need to either modify it to subclass django.templatetags.future.URLNode [2].
Another solution would be to create a second {% subdomainurl %}, that
inherits from future.URLNode. Perhaps you could even split your custom tags
into two separate libraries (one of them named custom_future or whatever)
and allow for a syntax similar to the one you use to load {% url %}.

On a side note, I'd recommend choosing a better name than "custom_tags"
because that sounds too generic. You can have as many templatetags modules
as you'd like, so don't be afraid to organize your tags in different files!

Let us know if you have any other questions and good luck.


Cheers,
AT

[1]
https://docs.djangoproject.com/en/dev/ref/templates/builtins/?from=olddocs#url
[2]
https://code.djangoproject.com/browser/django/trunk/django/templatetags/future.py#L37



On Tue, Oct 18, 2011 at 12:06 PM, nav  wrote:

> AT,
>
> Thanks for your email I have posted the custom template tag code and
> the traceback at dpaste. The template code is at:
>
> http://dpaste.com/636570/
>
> the traceback is at:
>
> http://dpaste.com/636571/
>
> Please do let me know if anything else is required.
>
> Thanks,
> nav
>
> On Oct 18, 5:20 pm, Andre Terra  wrote:
> > Please post your code again on something likehttp://dpaste.comand I'll
> > gladly take a look
> >
> > Cheers,
> > AT
> >
> > On Tue, Oct 18, 2011 at 9:43 AM, nav  wrote:
> > > If anyone has any pointers as to what might be the problem please
> > > answer. I would greatly appreciate any help you maybe able to provide.
> >
> > > Thanks.
> > > nav
> >
> > > On Oct 17, 11:44 pm, nav  wrote:
> > > > Dear Folks,
> >
> > > > I am using a number of subdomains for my website and decided to
> create
> > > > a custom url tag and try as shown on
> >
> > > >
> http://stackoverflow.com/questions/3461806/django-subdomains-and-mod-...
> >
> > > > My template tag being used in my template like this:
> > > > About
> > > > Us
> >
> > > > My template tags functions looks like this:
> >
> > > > class SubdomainURLNode(URLNode):
> > > > def render(self, context):
> > > > request = context['request']
> > > > domain = request.get_host()
> > > > subdomain = re.sub(r'^www\.','',domain).split('.')[0]
> > > > path = super(SubdomainURLNode, self).render(context)
> > > > return "%s/%s" % (str(request.get_host()), path)
> >
> > > > @register.tag
> > > > def subdomainurl(parser, token, node_cls=SubdomainURLNode):
> > > > """Just like {% url %} but checks for a subdomain."""
> > > > node_instance = url(parser, token)
> > > > return node_cls(view_name=node_instance.view_name,
> > > > args=node_instance.args,
> > > > kwargs=node_instance.kwargs,
> > > > asvar=node_instance.asvar)
> >
> > > > While trying to render the template tag it comes back saying:
> >
> > > > TemplateSyntaxError at /
> >
> > > > Caught TypeError while rendering: cannot concatenate 'str' and
> > > > 'FilterExpression' objects
> >
> > > > My template tag function does not return the path value from the
> > > > statement:
> > > > path = super(SubdomainURLNode, self).render(context)
> >
> > > > because the URLNode function fails on line 442 because of a type
> > > > mismatch:
> > > > url = reverse(project_name + '.' + view_name,
> >
> > > > I just tried using the standard url method in django {% url
> > > > "app.views.view_decider" "about" %} and this works. I would like to
> > > > know where I am going wrong with my function so I can get this to
> > > > work.
> >
> > > > The full traceback of the error is below:
> >
> > > > Thanks in advance.
> > > > nav
> >
> > > > The full traceback of the error is below:
> > > > 

ModelClass Form Help

2011-10-18 Thread Vishnu vg
Hi Friends,

Iam a beginner in django. I am developoing a contact form page. I created a
modelclass called 'contacts' and then created a a modelFormClass from that
model. I have two comboboxes in form called 'state' and 'city'. While
selecting state it should display all city beloing to that particular
selected state. How can i create that. Right now I created three tables :ie
(1). State Table (2) City table (3). Contacts table. In contacts table i
created two foreign keys(one for state , and other for city). Then i created
a modelformclass and the state and city are coming fine in form in
comboboxes. But client says that he want to select state and then the city
should list according to the state selected. How can i implement this using
ModelFormClass. Is any ajax fucntionality required. If anyone know s it
please help me . I would be a greate help..

Also one more doubt. Is there any need in this situatoin to use
ModelFormclass. I mean isntaed of usign modalForm class i think we can
create a html form and populate combobox and textfield using django
model.objects.get method . But in taht case also i dont know how can i save
the values. Please help me how i save custom fields in database..





-- 
Regards

Vishnu V.G
Software Programmer/ IT Consultant
Mobile : 9544455735

-- 
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: PUNTARE CON DJANGO SU BILANCIATORE ORACLE ATTRAVERSO IL TSNAME

2011-10-18 Thread Ian
On Oct 18, 5:17 am, Maksymus007  wrote:
> englishoo speakino list only.

That was rude and uncalled for.

-- 
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: PUNTARE CON DJANGO SU BILANCIATORE ORACLE ATTRAVERSO IL TSNAME

2011-10-18 Thread Ian
On Oct 18, 2:37 am, mxm982  wrote:
> Ciao ragazzi ho realizzato una piccola applicazione in Django che
> aggiorna delle tabelle di uno schema gia preesistente. Ora ho la
> necessita di puntare al rach della db attraverso appunto il tsname non
> tramite sid come viene richiesto dal file setting.py potete aiutarmi

If you don't have a TNS name, you can identify the database by
hostname, listener port, and SID.  See the second example at:
https://docs.djangoproject.com/en/1.3/ref/databases/#id11

Cheers,
Ian

-- 
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.



Facebook Authentication: Client side vs. Server side

2011-10-18 Thread Vijay Khemlani
Hello,

I'm just starting with a project that requires users to be able to
authenticate directly using their Facebook accounts.

I know this is an old problem, but I noticed there are two quite distinct
ways to solve it, and I wanted to ask for the group's opinion

1. Using FB JavaScript SDK
=

That is, following the code shown here

http://developers.facebook.com/docs/guides/web/#login

and setting a JavaScript function as a callback that redirects to a specific
URL in the project that checks that the auth cookie exists and creates (or
fetches an existing) user in the typical Django auth system.

2. Using a Django app with OAuth2
==

The second option is using an app such as django-social-auth

https://github.com/omab/django-social-auth

That executes the whole authentication in the server



Which one is better from a "pythonic" perspective? I also need to be able to
test the login process using Selenium, which one is better suited for
testing?

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: Getting into professional django development

2011-10-18 Thread Paul Menzel
Am Dienstag, den 18.10.2011, 16:00 +0100 schrieb Tom Evans:
> On Tue, Oct 18, 2011 at 3:47 PM, Paul Menzel  wrote:
> > Dear Dan,
> >
> >
> > [Reordering the message so that it is easier to see the connection.]
> >
> > Am Dienstag, den 18.10.2011, 06:46 -0700 schrieb Dan Gentry:
> >
> >> On Oct 18, 3:10 am, kenneth gonsalves  wrote:
> >> > On Tue, 2011-10-18 at 12:36 +0530, kenneth gonsalves wrote:
> >> > > On Mon, 2011-10-17 at 23:45 -0700, Kevin wrote:
> >> > > > Currently I have been focusing on the following:
> >> >
> >> > > > * Django 1.2
> >> >
> >> > > 1.3 belongs to the stone age - since you are learning, it would be a
> >> > > good idea to work with the current svn trunk, updating every week or
> >> > > so.
> >> > > --
> >> >
> >> > s/1.2/1.3/
> >
> >> With all due respect to Mr. Gonsalves, I do not care to work with the
> >> Django trunk unless I'm just playing around with something.  My goal
> >> is always to produce a production quality application.  Even the more
> >> stable than average Django trunk cannot provide the consistency needed
> >> to deliver an app to a customer.  Plus, I don't need the extra work of
> >> basing my code on a moving target.  When trunk becomes v1.4, I will
> >> convert my applications and upgrade.
> >
> > Please read the message you are referring to again. Kenneth corrected
> > the post [2] (although the `sed`-command should be `s/1.3/1.2/`. »The
> > latest official version is 1.3.1.« [1], so Kenneth suggested to use the
> > current stable release.
> >
> 
> I can't stand incorrect pedantry - this is my curse.
> 
> Kenneth actually said that "1.3 is ancient, you should be using
> trunk", which he corrected to "1.2 is ancient, you should be using
> trunk". His advice, regardless of which version you look at, is to use
> trunk - not the latest stable release.

You are right. I am sorry.

[…]


Thanks,

Paul


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


Re: Getting into professional django development

2011-10-18 Thread Donald Stufft
+1 for Always Develop against a Release, and if you are forced to use a VCS 
checkout, at least use pip and pin your requirements to a specific point in the 
history for that VCS.

On Tuesday, October 18, 2011 at 11:00 AM, Tom Evans wrote:

> On Tue, Oct 18, 2011 at 3:47 PM, Paul Menzel  (mailto:pm.deb...@googlemail.com)> wrote:
> > Dear Dan,
> >  
> >  
> > [Reordering the message so that it is easier to see the connection.]
> >  
> > Am Dienstag, den 18.10.2011, 06:46 -0700 schrieb Dan Gentry:
> >  
> > > On Oct 18, 3:10 am, kenneth gonsalves  > > (http://thenilgiris.com)> wrote:
> > > > On Tue, 2011-10-18 at 12:36 +0530, kenneth gonsalves wrote:
> > > > > On Mon, 2011-10-17 at 23:45 -0700, Kevin wrote:
> > > > > > Currently I have been focusing on the following:
> > > > >  
> > > > >  
> > > >  
> > > >  
> > > > > > * Django 1.2
> > > >  
> > > > > 1.3 belongs to the stone age - since you are learning, it would be a
> > > > > good idea to work with the current svn trunk, updating every week or
> > > > > so.
> > > > > --
> > > > >  
> > > >  
> > > >  
> > > > s/1.2/1.3/
> >  
> > > With all due respect to Mr. Gonsalves, I do not care to work with the
> > > Django trunk unless I'm just playing around with something.  My goal
> > > is always to produce a production quality application.  Even the more
> > > stable than average Django trunk cannot provide the consistency needed
> > > to deliver an app to a customer.  Plus, I don't need the extra work of
> > > basing my code on a moving target.  When trunk becomes v1.4, I will
> > > convert my applications and upgrade.
> > >  
> >  
> >  
> > Please read the message you are referring to again. Kenneth corrected
> > the post [2] (although the `sed`-command should be `s/1.3/1.2/`. »The
> > latest official version is 1.3.1.« [1], so Kenneth suggested to use the
> > current stable release.
> >  
>  
>  
> I can't stand incorrect pedantry - this is my curse.
>  
> Kenneth actually said that "1.3 is ancient, you should be using
> trunk", which he corrected to "1.2 is ancient, you should be using
> trunk". His advice, regardless of which version you look at, is to use
> trunk - not the latest stable release.
>  
> I agree with Dan, you should always develop against a release -
> although I am also a dinosaur. The cool kids these days are happy to
> work against github projects, usually master, or randomly forked from
> master. It is beyond me how you are supposed to know what caused the
> breakage if you have no clue about what changes have been made.
>  
> A good part of my job relates to SCM, and once you have taught
> yourself the good practices of SCM, you can clearly see the downsides
> of not following them; this is one of them. Control change to manage
> risk.
>  
> 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 
> (mailto:django-users@googlegroups.com).
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com 
> (mailto: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: Getting into professional django development

2011-10-18 Thread Tom Evans
On Tue, Oct 18, 2011 at 3:47 PM, Paul Menzel  wrote:
> Dear Dan,
>
>
> [Reordering the message so that it is easier to see the connection.]
>
> Am Dienstag, den 18.10.2011, 06:46 -0700 schrieb Dan Gentry:
>
>> On Oct 18, 3:10 am, kenneth gonsalves  wrote:
>> > On Tue, 2011-10-18 at 12:36 +0530, kenneth gonsalves wrote:
>> > > On Mon, 2011-10-17 at 23:45 -0700, Kevin wrote:
>> > > > Currently I have been focusing on the following:
>> >
>> > > > * Django 1.2
>> >
>> > > 1.3 belongs to the stone age - since you are learning, it would be a
>> > > good idea to work with the current svn trunk, updating every week or
>> > > so.
>> > > --
>> >
>> > s/1.2/1.3/
>
>> With all due respect to Mr. Gonsalves, I do not care to work with the
>> Django trunk unless I'm just playing around with something.  My goal
>> is always to produce a production quality application.  Even the more
>> stable than average Django trunk cannot provide the consistency needed
>> to deliver an app to a customer.  Plus, I don't need the extra work of
>> basing my code on a moving target.  When trunk becomes v1.4, I will
>> convert my applications and upgrade.
>
> Please read the message you are referring to again. Kenneth corrected
> the post [2] (although the `sed`-command should be `s/1.3/1.2/`. »The
> latest official version is 1.3.1.« [1], so Kenneth suggested to use the
> current stable release.
>

I can't stand incorrect pedantry - this is my curse.

Kenneth actually said that "1.3 is ancient, you should be using
trunk", which he corrected to "1.2 is ancient, you should be using
trunk". His advice, regardless of which version you look at, is to use
trunk - not the latest stable release.

I agree with Dan, you should always develop against a release -
although I am also a dinosaur. The cool kids these days are happy to
work against github projects, usually master, or randomly forked from
master. It is beyond me how you are supposed to know what caused the
breakage if you have no clue about what changes have been made.

A good part of my job relates to SCM, and once you have taught
yourself the good practices of SCM, you can clearly see the downsides
of not following them; this is one of them. Control change to manage
risk.

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: Getting into professional django development

2011-10-18 Thread Tim Chase

On 10/18/11 08:46, Dan Gentry wrote:

With all due respect to Mr. Gonsalves, I do not care to work
with the Django trunk unless I'm just playing around with
something.  My goal is always to produce a production quality
application.  Even the more stable than average Django trunk
cannot provide the consistency needed to deliver an app to a
customer.  Plus, I don't need the extra work of basing my code
on a moving target.  When trunk becomes v1.4, I will convert
my applications and upgrade.


I often have both in parallel. Using git (or mercurial...I use 
both/either) makes it fast & easy to switch between trunk and the 
latest stable version to see what breaks.


For my personal/development projects I tend to develop against 
trunk but test against 1.3; and I flip that for my 
production/professional projects, developing against 1.3 but 
testing occasionally against a checkout of trunk in an effort to 
prepare for the next release.


One of the other areas I hear a lot about but haven't tinkered 
with is learning to work well with virtualenv and pip.  I tend to 
run stock Debian(Stable) and just use whatever comes with the 
setup, but a number of folks sandbox their dev efforts into a 
virtualenv playground.


-tim


--
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.



Doing a relationship lookup from within a model.

2011-10-18 Thread Jack Morgan
I've got 2 tables that are related to each other. Orders and History.
Inside the History table is the 'status' column. Like so..

class Orders(models.Model):
  'order info'

class History(models.Model):
timestamp = models.DateTimeField(auto_add_now = True)
order = models.ForeignKey(Orders)
user = models.ForeignKey(User)
comment = models.TextField()
status = models.CharField(max_length = 20)


I'm storing the status in the History table right now because I need to keep
track of who is moving the orders along.  However, I need to do a lookup on
orders based on their current(most recent) status.  For simplicities purpose
it seems a good idea would be to just put a status field in the Orders table
and update as the Order advances through the stages. However, that creates
duplicate data, which my client has expressed an extreme hatred for.

What It's like to be able to do is something like:
o = Orders.filter(status = 'new')

I'm not entirely sure how or when relationship managers are brought in, so I
was thinking something like this in the Orders model:
status = self.history_set.values('status').order_by('-id')[0]['status']

But that wouldn't let me do a lookup by state.

What's a good Django way to handle this issue?

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: Getting into professional django development

2011-10-18 Thread Paul Menzel
Dear Dan,


[Reordering the message so that it is easier to see the connection.]

Am Dienstag, den 18.10.2011, 06:46 -0700 schrieb Dan Gentry:

> On Oct 18, 3:10 am, kenneth gonsalves  wrote:
> > On Tue, 2011-10-18 at 12:36 +0530, kenneth gonsalves wrote:
> > > On Mon, 2011-10-17 at 23:45 -0700, Kevin wrote:
> > > > Currently I have been focusing on the following:
> >
> > > > * Django 1.2
> >
> > > 1.3 belongs to the stone age - since you are learning, it would be a
> > > good idea to work with the current svn trunk, updating every week or
> > > so.
> > > --
> >
> > s/1.2/1.3/

> With all due respect to Mr. Gonsalves, I do not care to work with the
> Django trunk unless I'm just playing around with something.  My goal
> is always to produce a production quality application.  Even the more
> stable than average Django trunk cannot provide the consistency needed
> to deliver an app to a customer.  Plus, I don't need the extra work of
> basing my code on a moving target.  When trunk becomes v1.4, I will
> convert my applications and upgrade.

Please read the message you are referring to again. Kenneth corrected
the post [2] (although the `sed`-command should be `s/1.3/1.2/`. »The
latest official version is 1.3.1.« [1], so Kenneth suggested to use the
current stable release.

> I know - I'm a dinosaur.

That has nothing to do with this.


Thanks,

Paul


[1] https://www.djangoproject.com/download/
[2] http://en.opensuse.org/openSUSE:Mailing_list_netiquette


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


Re: Looking for a good Document Management System (DMS) to plug into my Django app

2011-10-18 Thread Walt
You should check out integrating with the Box.net API. I've written a
number
of applications for their site. They support previews of most common
file types.

Feel free to contact me directly if you want to see some simple code
examples
-- tufelkinder (at) gmail (dot) com


Walt

-- 
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.



recent 1.3.1 upgrade - admin panel throwing NoReverseMatch error now

2011-10-18 Thread Nick Nachefski
Hello,



I've recently upgraded to 1.3.1 and am getting a NoReverseMatch exception with 
piston when attempting to view my admin panel.  Has anyone else seen this with 
1.3.1?



Here is the relevant url.py config for my piston:



blah_resource = Resource(handler=BLAH)

urlpatterns = patterns('',

   url(r'^status$', blah_resource, { 'emitter_format': 'json' }),

   )





Traceback (most recent call last):



  File "/usr/lib/python2.6/dist-packages/django/core/handlers/base.py", line 
111, in get_response

response = callback(request, *callback_args, **callback_kwargs)



  File "/usr/lib/python2.6/dist-packages/django/contrib/admin/sites.py", line 
209, in wrapper

return self.admin_view(view, cacheable)(*args, **kwargs)



  File "/usr/lib/python2.6/dist-packages/django/utils/decorators.py", line 91, 
in _wrapped_view

response = view_func(request, *args, **kwargs)



  File "/usr/lib/python2.6/dist-packages/django/views/decorators/cache.py", 
line 88, in _wrapped_view_func

response = view_func(request, *args, **kwargs)



  File "/usr/lib/python2.6/dist-packages/django/contrib/admin/sites.py", line 
192, in inner

return view(request, *args, **kwargs)



  File "/usr/lib/python2.6/dist-packages/django/views/decorators/cache.py", 
line 88, in _wrapped_view_func

response = view_func(request, *args, **kwargs)



  File "/usr/lib/python2.6/dist-packages/django/contrib/admin/sites.py", line 
345, in index

'admin_url': reverse('admin:%s_%s_changelist' % info, 
current_app=self.name),



  File "/usr/lib/python2.6/dist-packages/django/core/urlresolvers.py", line 
473, in reverse

(prefix, resolver.reverse(view, *args, **kwargs)))



  File "/usr/lib/python2.6/dist-packages/django/core/urlresolvers.py", line 
392, in reverse

"arguments '%s' not found." % (lookup_view_s, args, kwargs))



NoReverseMatch: Reverse for 'piston_token_changelist' with arguments '()' and 
keyword arguments '{}' not found.


Any help would be greatly appreciated.


Note: This email is for the confidential use of the named addressee(s) only and 
may contain proprietary, confidential or privileged information. If you are not 
the intended recipient, you are hereby notified that any review, dissemination 
or copying of this email is strictly prohibited, and to please notify the 
sender immediately and destroy this email and any attachments. Email 
transmission cannot be guaranteed to be secure or error-free. Jump Trading, 
therefore, does not make any guarantees as to the completeness or accuracy of 
this email or any attachments. This email is for informational purposes only 
and does not constitute a recommendation, offer, request or solicitation of any 
kind to buy, sell, subscribe, redeem or perform any type of transaction of a 
financial product.

-- 
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: cannot concatenate 'str' and 'FilterExpression' objects

2011-10-18 Thread nav
AT,

Thanks for your email I have posted the custom template tag code and
the traceback at dpaste. The template code is at:

http://dpaste.com/636570/

the traceback is at:

http://dpaste.com/636571/

Please do let me know if anything else is required.

Thanks,
nav

On Oct 18, 5:20 pm, Andre Terra  wrote:
> Please post your code again on something likehttp://dpaste.comand I'll
> gladly take a look
>
> Cheers,
> AT
>
> On Tue, Oct 18, 2011 at 9:43 AM, nav  wrote:
> > If anyone has any pointers as to what might be the problem please
> > answer. I would greatly appreciate any help you maybe able to provide.
>
> > Thanks.
> > nav
>
> > On Oct 17, 11:44 pm, nav  wrote:
> > > Dear Folks,
>
> > > I am using a number of subdomains for my website and decided to create
> > > a custom url tag and try as shown on
>
> > >http://stackoverflow.com/questions/3461806/django-subdomains-and-mod-...
>
> > > My template tag being used in my template like this:
> > > About
> > > Us
>
> > > My template tags functions looks like this:
>
> > > class SubdomainURLNode(URLNode):
> > >     def render(self, context):
> > >         request = context['request']
> > >         domain = request.get_host()
> > >         subdomain = re.sub(r'^www\.','',domain).split('.')[0]
> > >         path = super(SubdomainURLNode, self).render(context)
> > >         return "%s/%s" % (str(request.get_host()), path)
>
> > > @register.tag
> > > def subdomainurl(parser, token, node_cls=SubdomainURLNode):
> > >     """Just like {% url %} but checks for a subdomain."""
> > >     node_instance = url(parser, token)
> > >     return node_cls(view_name=node_instance.view_name,
> > >         args=node_instance.args,
> > >         kwargs=node_instance.kwargs,
> > >         asvar=node_instance.asvar)
>
> > > While trying to render the template tag it comes back saying:
>
> > > TemplateSyntaxError at /
>
> > > Caught TypeError while rendering: cannot concatenate 'str' and
> > > 'FilterExpression' objects
>
> > > My template tag function does not return the path value from the
> > > statement:
> > > path = super(SubdomainURLNode, self).render(context)
>
> > > because the URLNode function fails on line 442 because of a type
> > > mismatch:
> > > url = reverse(project_name + '.' + view_name,
>
> > > I just tried using the standard url method in django {% url
> > > "app.views.view_decider" "about" %} and this works. I would like to
> > > know where I am going wrong with my function so I can get this to
> > > work.
>
> > > The full traceback of the error is below:
>
> > > Thanks in advance.
> > > nav
>
> > > The full traceback of the error is below:
> > > --
> > > Environment:
>
> > > Request Method: GET
> > > Request URL:http://localhost:8000/
>
> > > Django Version: 1.3.1
> > > Python Version: 2.6.6
> > > Installed Applications:
> > > ['django.contrib.auth',
> > >  'django.contrib.contenttypes',
> > >  'django.contrib.sessions',
> > >  'django.contrib.sites',
> > >  'django.contrib.messages',
> > >  'django.contrib.staticfiles',
> > >  'django.contrib.admin',
> > >  'swanlotus_site',
> > >  'south']
> > > Installed Middleware:
> > > ('django.middleware.common.CommonMiddleware',
> > >  'django.contrib.sessions.middleware.SessionMiddleware',
> > >  'django.middleware.csrf.CsrfViewMiddleware',
> > >  'django.contrib.auth.middleware.AuthenticationMiddleware',
> > >  'django.contrib.messages.middleware.MessageMiddleware',
> > >  'middleware.SubdomainMiddleware')
>
> > > Template error:
> > > In template /home/nandu/django/swanlotus/templates/navigation.html,
> > > error at line 6
> > >    Caught TypeError while rendering: cannot concatenate 'str' and
> > > 'FilterExpression' objects
> > >    1 : {% load custom_tags %}
>
> > >    2 : {% load url from future %}
>
> > >    3 : 
>
> > >    4 :     http://localhost:8000/;>Home
>
> > >    5 :     
>
> > >    6 :     About Us
>
> > >    7 :         
>
> > >    8 :             http://chandra.localhost:
> > > 8000">Chandra
>
> > >    9 :         
>
> > >    10 :     
>
> > >    11 :     http://downloads.localhost:8000;>Downloads > > a>
>
> > >    12 :         {% if thesis and phd_guide%}
>
> > >    13 :             
>
> > >    14 :                 http://downloads.localhost:8000/
> > > #thesis">Thesis Writing
>
> > >    15 :                 http://downloads.localhost:8000/
> > > #phd">PhD Guide
>
> > >    16 :             {% if calculus_sheet and app_maths_sheet %}
>
> > > Traceback:
> > > File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/
> > > base.py" in get_response
> > >   111.                         response = callback(request,
> > > *callback_args, **callback_kwargs)
> > > File "/home/nandu/django/swanlotus/swanlotus_site/views.py" in
> > > view_decider
> > >   21.     return render(request, template, context)
> > > File "/usr/local/lib/python2.6/dist-packages/django/shortcuts/

Re: Getting into professional django development

2011-10-18 Thread Dan Gentry
With all due respect to Mr. Gonsalves, I do not care to work with the
Django trunk unless I'm just playing around with something.  My goal
is always to produce a production quality application.  Even the more
stable than average Django trunk cannot provide the consistency needed
to deliver an app to a customer.  Plus, I don't need the extra work of
basing my code on a moving target.  When trunk becomes v1.4, I will
convert my applications and upgrade.

I know - I'm a dinosaur.

Best of luck to all!

On Oct 18, 3:10 am, kenneth gonsalves  wrote:
> On Tue, 2011-10-18 at 12:36 +0530, kenneth gonsalves wrote:
> > On Mon, 2011-10-17 at 23:45 -0700, Kevin wrote:
> > > Currently I have been focusing on the following:
>
> > > * Django 1.2
>
> > 1.3 belongs to the stone age - since you are learning, it would be a
> > good idea to work with the current svn trunk, updating every week or
> > so.
> > --
>
> s/1.2/1.3/
> --
> regards
> Kenneth Gonsalves

-- 
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: Getting into professional django development

2011-10-18 Thread Cal Leeming [Simplicity Media Ltd]
Nice - didn't know about TastyPie, I've tended to always write my own :)

Ty

2011/10/18 Andre Terra 

> Here's my to-do list for you:
>
> * Build a REST API using django-tastypie
> * Master caching, cache invalidation, etc
> * Celery (asynchronous tasks!)
> * Learn to profile django apps, including finding bottlenecks
> * Write raw SQL
> * If you have a lot of corporate clients, serialize data and export to
> excel (I've needed that more often than I'd like to)
> * Browse the django source code. Find open tickets, write patches and
> documentation.
>
> Learn more about the framework and the apps will come naturally.
>
> This should keep you busy for at least a few months!
>
>
> Cheers,
> AT
>
>
> On Tue, Oct 18, 2011 at 6:34 AM, Иван Иванов wrote:
>
>> It's better to learn on a project basis. Every client has different
>> scope and interest and you cannot predict which apps you will need or
>> not. Some barely used apps may be essential for you…
>>
>> But, when you ask… You may need to integrate django-registration with
>> your django-cms, so you can manage systems, where each user has his own
>> profile.
>>
>> На Mon, 17 Oct 2011 23:45:09 -0700 (PDT)
>> Kevin  написа:
>>
>> > Hello everyone!
>> >
>> >   I have been using Django for about a year now and feel that I want
>> > to take my experience to the next level.  I have created a few website
>> > using Django to test my skills, although not for anyone specific.  I
>> > am creating this thread as I will like to ask current Django website
>> > developers what tools and apps are crucial to be learned.
>> >
>> > Currently I have been focusing on the following:
>> >
>> > * Django 1.2
>> > * Django-guardian
>> > * JQuery(although not specific to django)
>> > * Pyjamas(nice alternative to GWT and works with django)
>> > * Began learning Pinax(based on Django 1.1)
>> > * Began learning Django-cms
>> > * A few other, but cannot remember off the top of my head.
>> >
>> > The problem is that I'm not really sure what Django apps to learn due
>> > to the overwhelming amount of apps that do the same thing, just
>> > differently.  I choose Django-guardian over Django-authority, for
>> > example.
>> >
>> > The next django app I plan on learning is Djax and Djaxice.
>> >
>> > Which Django apps does everyone use in their Django projects for your
>> > company/clients?  I'd rather not learn something which is either going
>> > out of style, out of style, out dated, or barely used.  I cannot take
>> > this type of experience with me to work on a larger scale project.
>> >
>> > You must agree that when you look at the djangopackages website, there
>> > are an overwhelming amount of apps which do almost the exact same
>> > thing.  I'm not sure how it feels the download counts, or the other
>> > data.  I would hope from PIP, but not sure if it has an open API for
>> > polling download counts and such data about packages.
>> >
>>
>> --
>> 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.
>

-- 
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 on cleaning ModelForms

2011-10-18 Thread Tom Evans
On Tue, Oct 18, 2011 at 2:00 PM, Jeff Heard  wrote:
> But I want to be able to invalidate my form if geocoding fails...  Can I
> still do that in the save method?
>

No, save() is not part of validation. However, it is not hard to
combine the two:

In the clean() method, calculate the geocoding point and store it in
an attribute of the form. In the save() method, populate the field as
shown by Daniel, but use the stored attribute value.

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: Question on cleaning ModelForms

2011-10-18 Thread Jeff Heard
But I want to be able to invalidate my form if geocoding fails...  Can I still 
do that in the save method?



On Oct 18, 2011, at 4:52 AM, Daniel Roseman  wrote:

> On Monday, 17 October 2011 20:30:35 UTC+1, Jefferson Heard wrote:
> class FarmersMarket(ModelForm):
>class Meta:
>   model = models.FarmersMarket
>   exclude = ('location',)
>def clean(self):
>   place, (lat, lng) = _g.geocode(self.cleaned_data['address'])
>   self.cleaned_data['location'] = Point(lng,lat)
>   return self.cleaned_data
> 
> 
> 
> Here's my code minus the exception handling.  Now what I *want* to
> have happen is that the models.FarmersMarket.location field on the
> model is set sometime shortly after the form is submitted by the user,
> by way of geocoding the data, rather than having them tediously enter
> a POINT wkt string in the textarea field.  So my idea was to put a
> call to geopy.Google.geocode in FarmersMarket.self.clean.  I can
> confirm clean() is getting called, but for some reason, the 'location'
> field isn't being set in the model.  I get a whine from Django that
> the location field cannot be NULL (which is true, it can't).
> 
> Can anyone tell me how I'm supposed to be doing this? I want them to
> enter an address on the form, not a latitude/longitude pair.
> 
> -- Jeff
> 
> 
> The point is, you've told Django that `location` isn't a field on this form, 
> by specifying it in `exclude`. So Django doesn't take any notice of the extra 
> element you've added in cleaned_data.
> 
> The way to do this is to override the form's save method and do it there:
> 
> def save(self, commit=False):
> market = super(FarmersMarket, self).save(commit=False)
> place, (lat, lng) = _g.geocode(market.address)
> market.location = Point(lng,lat)
> if commit:
> market.save()
> return market
> 
> --
> DR.
>  
> -- 
> 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/-/3LiBsqFIJYoJ.
> 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: Getting into professional django development

2011-10-18 Thread Andre Terra
Here's my to-do list for you:

* Build a REST API using django-tastypie
* Master caching, cache invalidation, etc
* Celery (asynchronous tasks!)
* Learn to profile django apps, including finding bottlenecks
* Write raw SQL
* If you have a lot of corporate clients, serialize data and export to excel
(I've needed that more often than I'd like to)
* Browse the django source code. Find open tickets, write patches and
documentation.

Learn more about the framework and the apps will come naturally.

This should keep you busy for at least a few months!


Cheers,
AT

On Tue, Oct 18, 2011 at 6:34 AM, Иван Иванов wrote:

> It's better to learn on a project basis. Every client has different
> scope and interest and you cannot predict which apps you will need or
> not. Some barely used apps may be essential for you…
>
> But, when you ask… You may need to integrate django-registration with
> your django-cms, so you can manage systems, where each user has his own
> profile.
>
> На Mon, 17 Oct 2011 23:45:09 -0700 (PDT)
> Kevin  написа:
>
> > Hello everyone!
> >
> >   I have been using Django for about a year now and feel that I want
> > to take my experience to the next level.  I have created a few website
> > using Django to test my skills, although not for anyone specific.  I
> > am creating this thread as I will like to ask current Django website
> > developers what tools and apps are crucial to be learned.
> >
> > Currently I have been focusing on the following:
> >
> > * Django 1.2
> > * Django-guardian
> > * JQuery(although not specific to django)
> > * Pyjamas(nice alternative to GWT and works with django)
> > * Began learning Pinax(based on Django 1.1)
> > * Began learning Django-cms
> > * A few other, but cannot remember off the top of my head.
> >
> > The problem is that I'm not really sure what Django apps to learn due
> > to the overwhelming amount of apps that do the same thing, just
> > differently.  I choose Django-guardian over Django-authority, for
> > example.
> >
> > The next django app I plan on learning is Djax and Djaxice.
> >
> > Which Django apps does everyone use in their Django projects for your
> > company/clients?  I'd rather not learn something which is either going
> > out of style, out of style, out dated, or barely used.  I cannot take
> > this type of experience with me to work on a larger scale project.
> >
> > You must agree that when you look at the djangopackages website, there
> > are an overwhelming amount of apps which do almost the exact same
> > thing.  I'm not sure how it feels the download counts, or the other
> > data.  I would hope from PIP, but not sure if it has an open API for
> > polling download counts and such data about packages.
> >
>
> --
> 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: cannot concatenate 'str' and 'FilterExpression' objects

2011-10-18 Thread Andre Terra
Please post your code again on something like http://dpaste.com and I'll
gladly take a look


Cheers,
AT

On Tue, Oct 18, 2011 at 9:43 AM, nav  wrote:

> If anyone has any pointers as to what might be the problem please
> answer. I would greatly appreciate any help you maybe able to provide.
>
> Thanks.
> nav
>
> On Oct 17, 11:44 pm, nav  wrote:
> > Dear Folks,
> >
> > I am using a number of subdomains for my website and decided to create
> > a custom url tag and try as shown on
> >
> > http://stackoverflow.com/questions/3461806/django-subdomains-and-mod-...
> >
> > My template tag being used in my template like this:
> > About
> > Us
> >
> > My template tags functions looks like this:
> >
> > class SubdomainURLNode(URLNode):
> > def render(self, context):
> > request = context['request']
> > domain = request.get_host()
> > subdomain = re.sub(r'^www\.','',domain).split('.')[0]
> > path = super(SubdomainURLNode, self).render(context)
> > return "%s/%s" % (str(request.get_host()), path)
> >
> > @register.tag
> > def subdomainurl(parser, token, node_cls=SubdomainURLNode):
> > """Just like {% url %} but checks for a subdomain."""
> > node_instance = url(parser, token)
> > return node_cls(view_name=node_instance.view_name,
> > args=node_instance.args,
> > kwargs=node_instance.kwargs,
> > asvar=node_instance.asvar)
> >
> > While trying to render the template tag it comes back saying:
> >
> > TemplateSyntaxError at /
> >
> > Caught TypeError while rendering: cannot concatenate 'str' and
> > 'FilterExpression' objects
> >
> > My template tag function does not return the path value from the
> > statement:
> > path = super(SubdomainURLNode, self).render(context)
> >
> > because the URLNode function fails on line 442 because of a type
> > mismatch:
> > url = reverse(project_name + '.' + view_name,
> >
> > I just tried using the standard url method in django {% url
> > "app.views.view_decider" "about" %} and this works. I would like to
> > know where I am going wrong with my function so I can get this to
> > work.
> >
> > The full traceback of the error is below:
> >
> > Thanks in advance.
> > nav
> >
> > The full traceback of the error is below:
> > --
> > Environment:
> >
> > Request Method: GET
> > Request URL:http://localhost:8000/
> >
> > Django Version: 1.3.1
> > Python Version: 2.6.6
> > Installed Applications:
> > ['django.contrib.auth',
> >  'django.contrib.contenttypes',
> >  'django.contrib.sessions',
> >  'django.contrib.sites',
> >  'django.contrib.messages',
> >  'django.contrib.staticfiles',
> >  'django.contrib.admin',
> >  'swanlotus_site',
> >  'south']
> > Installed Middleware:
> > ('django.middleware.common.CommonMiddleware',
> >  'django.contrib.sessions.middleware.SessionMiddleware',
> >  'django.middleware.csrf.CsrfViewMiddleware',
> >  'django.contrib.auth.middleware.AuthenticationMiddleware',
> >  'django.contrib.messages.middleware.MessageMiddleware',
> >  'middleware.SubdomainMiddleware')
> >
> > Template error:
> > In template /home/nandu/django/swanlotus/templates/navigation.html,
> > error at line 6
> >Caught TypeError while rendering: cannot concatenate 'str' and
> > 'FilterExpression' objects
> >1 : {% load custom_tags %}
> >
> >2 : {% load url from future %}
> >
> >3 : 
> >
> >4 : http://localhost:8000/;>Home
> >
> >5 : 
> >
> >6 : About Us
> >
> >7 : 
> >
> >8 : http://chandra.localhost:
> > 8000">Chandra
> >
> >9 : 
> >
> >10 : 
> >
> >11 : http://downloads.localhost:8000;>Downloads > a>
> >
> >12 : {% if thesis and phd_guide%}
> >
> >13 : 
> >
> >14 : http://downloads.localhost:8000/
> > #thesis">Thesis Writing
> >
> >15 : http://downloads.localhost:8000/
> > #phd">PhD Guide
> >
> >16 : {% if calculus_sheet and app_maths_sheet %}
> >
> > Traceback:
> > File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/
> > base.py" in get_response
> >   111. response = callback(request,
> > *callback_args, **callback_kwargs)
> > File "/home/nandu/django/swanlotus/swanlotus_site/views.py" in
> > view_decider
> >   21. return render(request, template, context)
> > File "/usr/local/lib/python2.6/dist-packages/django/shortcuts/
> > __init__.py" in render
> >   44. return HttpResponse(loader.render_to_string(*args,
> > **kwargs),
> > File "/usr/local/lib/python2.6/dist-packages/django/template/
> > loader.py" in render_to_string
> >   188. return t.render(context_instance)
> > File "/usr/local/lib/python2.6/dist-packages/django/template/base.py"
> > in render
> >   123. return self._render(context)
> > File 

Re: cannot concatenate 'str' and 'FilterExpression' objects

2011-10-18 Thread nav
If anyone has any pointers as to what might be the problem please
answer. I would greatly appreciate any help you maybe able to provide.

Thanks.
nav

On Oct 17, 11:44 pm, nav  wrote:
> Dear Folks,
>
> I am using a number of subdomains for my website and decided to create
> a custom url tag and try as shown on
>
> http://stackoverflow.com/questions/3461806/django-subdomains-and-mod-...
>
> My template tag being used in my template like this:
> About
> Us
>
> My template tags functions looks like this:
>
> class SubdomainURLNode(URLNode):
>     def render(self, context):
>         request = context['request']
>         domain = request.get_host()
>         subdomain = re.sub(r'^www\.','',domain).split('.')[0]
>         path = super(SubdomainURLNode, self).render(context)
>         return "%s/%s" % (str(request.get_host()), path)
>
> @register.tag
> def subdomainurl(parser, token, node_cls=SubdomainURLNode):
>     """Just like {% url %} but checks for a subdomain."""
>     node_instance = url(parser, token)
>     return node_cls(view_name=node_instance.view_name,
>         args=node_instance.args,
>         kwargs=node_instance.kwargs,
>         asvar=node_instance.asvar)
>
> While trying to render the template tag it comes back saying:
>
> TemplateSyntaxError at /
>
> Caught TypeError while rendering: cannot concatenate 'str' and
> 'FilterExpression' objects
>
> My template tag function does not return the path value from the
> statement:
> path = super(SubdomainURLNode, self).render(context)
>
> because the URLNode function fails on line 442 because of a type
> mismatch:
> url = reverse(project_name + '.' + view_name,
>
> I just tried using the standard url method in django {% url
> "app.views.view_decider" "about" %} and this works. I would like to
> know where I am going wrong with my function so I can get this to
> work.
>
> The full traceback of the error is below:
>
> Thanks in advance.
> nav
>
> The full traceback of the error is below:
> --
> Environment:
>
> Request Method: GET
> Request URL:http://localhost:8000/
>
> Django Version: 1.3.1
> Python Version: 2.6.6
> Installed Applications:
> ['django.contrib.auth',
>  'django.contrib.contenttypes',
>  'django.contrib.sessions',
>  'django.contrib.sites',
>  'django.contrib.messages',
>  'django.contrib.staticfiles',
>  'django.contrib.admin',
>  'swanlotus_site',
>  'south']
> Installed Middleware:
> ('django.middleware.common.CommonMiddleware',
>  'django.contrib.sessions.middleware.SessionMiddleware',
>  'django.middleware.csrf.CsrfViewMiddleware',
>  'django.contrib.auth.middleware.AuthenticationMiddleware',
>  'django.contrib.messages.middleware.MessageMiddleware',
>  'middleware.SubdomainMiddleware')
>
> Template error:
> In template /home/nandu/django/swanlotus/templates/navigation.html,
> error at line 6
>    Caught TypeError while rendering: cannot concatenate 'str' and
> 'FilterExpression' objects
>    1 : {% load custom_tags %}
>
>    2 : {% load url from future %}
>
>    3 : 
>
>    4 :     http://localhost:8000/;>Home
>
>    5 :     
>
>    6 :     About Us
>
>    7 :         
>
>    8 :             http://chandra.localhost:
> 8000">Chandra
>
>    9 :         
>
>    10 :     
>
>    11 :     http://downloads.localhost:8000;>Downloads a>
>
>    12 :         {% if thesis and phd_guide%}
>
>    13 :             
>
>    14 :                 http://downloads.localhost:8000/
> #thesis">Thesis Writing
>
>    15 :                 http://downloads.localhost:8000/
> #phd">PhD Guide
>
>    16 :             {% if calculus_sheet and app_maths_sheet %}
>
> Traceback:
> File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/
> base.py" in get_response
>   111.                         response = callback(request,
> *callback_args, **callback_kwargs)
> File "/home/nandu/django/swanlotus/swanlotus_site/views.py" in
> view_decider
>   21.     return render(request, template, context)
> File "/usr/local/lib/python2.6/dist-packages/django/shortcuts/
> __init__.py" in render
>   44.     return HttpResponse(loader.render_to_string(*args,
> **kwargs),
> File "/usr/local/lib/python2.6/dist-packages/django/template/
> loader.py" in render_to_string
>   188.         return t.render(context_instance)
> File "/usr/local/lib/python2.6/dist-packages/django/template/base.py"
> in render
>   123.             return self._render(context)
> File "/usr/local/lib/python2.6/dist-packages/django/template/base.py"
> in _render
>   117.         return self.nodelist.render(context)
> File "/usr/local/lib/python2.6/dist-packages/django/template/base.py"
> in render
>   744.                 bits.append(self.render_node(node, context))
> File "/usr/local/lib/python2.6/dist-packages/django/template/debug.py"
> in render_node
>   73.             result = node.render(context)
> File "/usr/local/lib/python2.6/dist-packages/django/template/
> loader_tags.py" in render
>   127.         

Re: PUNTARE CON DJANGO SU BILANCIATORE ORACLE ATTRAVERSO IL TSNAME

2011-10-18 Thread Maksymus007
englishoo speakino list only.
18-10-2011 13:15 użytkownik "mxm982"  napisał:

> Ciao ragazzi ho realizzato una piccola applicazione in Django che
> aggiorna delle tabelle di uno schema gia preesistente. Ora ho la
> necessita di puntare al rach della db attraverso appunto il tsname non
> tramite sid come viene richiesto dal file setting.py potete aiutarmi
>
> --
> 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.



PUNTARE CON DJANGO SU BILANCIATORE ORACLE ATTRAVERSO IL TSNAME

2011-10-18 Thread mxm982
Ciao ragazzi ho realizzato una piccola applicazione in Django che
aggiorna delle tabelle di uno schema gia preesistente. Ora ho la
necessita di puntare al rach della db attraverso appunto il tsname non
tramite sid come viene richiesto dal file setting.py potete aiutarmi

-- 
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: models.Model

2011-10-18 Thread Daniel Roseman
On Monday, 17 October 2011 15:00:09 UTC+1, youpsla wrote:
>
> Hello Daniel
> thanks for your answer and sorry for my english. As you said, it could be a 
> problem of translation !!! :-)
>
> I really appreciate your help, I'm doing lots of progress in my python 
> object programming curve ...
>
> OK, then to be sure how Python works ... let see this code:
>
> 1 from django.db import models 
> 2 
> 3 class Person(models.Model): 
> 4 first_name = models.CharField(max_length=30) 
> 5 last_name = models.CharField(max_length=30) 
>
> Ligne 1 imports module "models". I've browse the source code of Django. In 
> the "models" folder, there is a __init__.py file and a lots of .py other 
> files.
> There is folders too and specially one called "fields".
>
> Here is my question :
>
>- When importing models on line 1, doest it import all the .py files in 
>this module, then  all classes, Class, functions, variables at the top 
> level 
>of each .py are available for use ? Or there is only an automatic import 
> of 
>the __init__.py ?
>
> Only the __init__.py. But... 

Line 4 : : The CharField Class definition is in models/fields/__init__.py. 
> In the code above, there nowhere a reference at "fields". But the line 10 of 
> the the __init__.py in models is " This file is automatically loaded by 
> Python. In this file on line 10, there is "from django.db.models.fields 
> import *". "
>
> Here is my question :
>
>- Does it means that the CharField Class is available inside Person 
>Class because there is a cascading import following this way:
>   - models contains an __init__.py wich import fields and __init.py in 
>   fields has a definition of Class CharField on line 601
>
>
Yes, this is exactly right.
 

> Hope it's enugh clear ... don't spend much time when it is not and just ask 
> for reformulation, I'll dot it ...
> Regards
>
> Alain
>
>
>
You might like to read the effbot's explanation of the different import 
methods:
http://effbot.org/zone/import-confusion.htm

--
DR. 

-- 
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/-/AVl4aUs9D-oJ.
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 on cleaning ModelForms

2011-10-18 Thread Daniel Roseman
On Monday, 17 October 2011 20:30:35 UTC+1, Jefferson Heard wrote:
>
> class FarmersMarket(ModelForm):
>class Meta:
>   model = models.FarmersMarket
>   exclude = ('location',)
>
>def clean(self):
>   place, (lat, lng) = _g.geocode(self.cleaned_data['address'])
>   self.cleaned_data['location'] = Point(lng,lat)
>   return self.cleaned_data
>
> 
>
> Here's my code minus the exception handling.  Now what I *want* to
> have happen is that the models.FarmersMarket.location field on the
> model is set sometime shortly after the form is submitted by the user,
> by way of geocoding the data, rather than having them tediously enter
> a POINT wkt string in the textarea field.  So my idea was to put a
> call to geopy.Google.geocode in FarmersMarket.self.clean.  I can
> confirm clean() is getting called, but for some reason, the 'location'
> field isn't being set in the model.  I get a whine from Django that
> the location field cannot be NULL (which is true, it can't).
>
> Can anyone tell me how I'm supposed to be doing this? I want them to
> enter an address on the form, not a latitude/longitude pair.
>
> -- Jeff
>

The point is, you've told Django that `location` isn't a field on this form, 
by specifying it in `exclude`. So Django doesn't take any notice of the 
extra element you've added in cleaned_data.

The way to do this is to override the form's save method and do it there:

def save(self, commit=False):
market = super(FarmersMarket, self).save(commit=False)
place, (lat, lng) = _g.geocode(market.address)
market.location = Point(lng,lat)
if commit:
market.save()
return market

--
DR.
 

-- 
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/-/3LiBsqFIJYoJ.
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: Blank output from treemenus under nginx

2011-10-18 Thread Alastair Campbell
Hi Kevin,

Thanks for the tips, unfortunately I think the problem is trickier than that.

The output HTML is different, because the treemenu template tags don't
output anything.

I.e. within a template that is otherwise working fine, you have:

{% load tree_menu_tags %}
{% show_menu "ukwa" %}

And that doesn't output anything. No error message, no assets needed
or anything, just no HTML output.

The installed apps match local between local and live, and I'm getting
no errors reported in the nginx logs.

Apologies, it is running fastcgi not mod_wsgi, it's a while since I
configured the server and I assumed it was mod_wsgi.

Does fastcgi typically have an error log somewhere?

-Alastair

-- 
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: Iteration over queryset in a model

2011-10-18 Thread Daniel Roseman
On Monday, 17 October 2011 20:28:47 UTC+1, eyscooby wrote:
>
> Ok, sorry I thought I was starting to understand it a little better, 
> but now I think I took a step backwards, so if it is ok with you let's 
> step back and take it a step at a time. 
>
> So, my first step is wondering if I really need a manager or not?? 
> I was thinking from your first response to me that you might be 
> suggesting that I did.  Let's start there. 
> If I understand it correctly the Manager is a way of retrieving 
> specific information. 
>
> thanks 
>

Sorry for confusing you. There are two things going on here.

 A Manager is for making custom queries to the database, to return new 
objects - either one or a queryset of many. Your original code was using 
`Model.filter()` and modifying the result, so I suggested that it belonged 
in a manager.

A model method is useful when you want to do a separate, non-database, 
operation on a single object. That's what you really want to do here - given 
an instance of RequestTicket, calculate how old it is. There's no iteration 
contained in the method - you iterate through your existing queryset 
elsewhere (say in the template) and call days_old on each instance:

{% for ticket in completed_tickets %}
   {{ ticket.name }}: {{ ticket.days_old }}
{% endif %}

Or, in your particular circumstance, you simply give the `days_old` method 
as one of the elements of the `list_display` tuple, and Django takes care of 
the iterating, calling `days_old` on each row in the changelist.

So in both of these circumstances, `days_old` simply needs to look like 
this:

def days_old(self):
return self.competion_date - self.issued_date 

- so it returns a single value, for the one particular ticket instance which 
it has been called on.

Hope that helps.
--
DR.

-- 
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/-/8Mn1EJ4QdtAJ.
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: Getting into professional django development

2011-10-18 Thread Иван Иванов
It's better to learn on a project basis. Every client has different
scope and interest and you cannot predict which apps you will need or
not. Some barely used apps may be essential for you…

But, when you ask… You may need to integrate django-registration with
your django-cms, so you can manage systems, where each user has his own
profile.

На Mon, 17 Oct 2011 23:45:09 -0700 (PDT)
Kevin  написа:

> Hello everyone!
> 
>   I have been using Django for about a year now and feel that I want
> to take my experience to the next level.  I have created a few website
> using Django to test my skills, although not for anyone specific.  I
> am creating this thread as I will like to ask current Django website
> developers what tools and apps are crucial to be learned.
> 
> Currently I have been focusing on the following:
> 
> * Django 1.2
> * Django-guardian
> * JQuery(although not specific to django)
> * Pyjamas(nice alternative to GWT and works with django)
> * Began learning Pinax(based on Django 1.1)
> * Began learning Django-cms
> * A few other, but cannot remember off the top of my head.
> 
> The problem is that I'm not really sure what Django apps to learn due
> to the overwhelming amount of apps that do the same thing, just
> differently.  I choose Django-guardian over Django-authority, for
> example.
> 
> The next django app I plan on learning is Djax and Djaxice.
> 
> Which Django apps does everyone use in their Django projects for your
> company/clients?  I'd rather not learn something which is either going
> out of style, out of style, out dated, or barely used.  I cannot take
> this type of experience with me to work on a larger scale project.
> 
> You must agree that when you look at the djangopackages website, there
> are an overwhelming amount of apps which do almost the exact same
> thing.  I'm not sure how it feels the download counts, or the other
> data.  I would hope from PIP, but not sure if it has an open API for
> polling download counts and such data about packages.
> 

-- 
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: Getting into professional django development

2011-10-18 Thread kenneth gonsalves
On Tue, 2011-10-18 at 12:36 +0530, kenneth gonsalves wrote:
> On Mon, 2011-10-17 at 23:45 -0700, Kevin wrote:
> > Currently I have been focusing on the following:
> > 
> > * Django 1.2 
> 
> 1.3 belongs to the stone age - since you are learning, it would be a
> good idea to work with the current svn trunk, updating every week or
> so.
> -- 

s/1.2/1.3/
-- 
regards
Kenneth Gonsalves

-- 
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: Getting into professional django development

2011-10-18 Thread kenneth gonsalves
On Mon, 2011-10-17 at 23:45 -0700, Kevin wrote:
> Currently I have been focusing on the following:
> 
> * Django 1.2 

1.3 belongs to the stone age - since you are learning, it would be a
good idea to work with the current svn trunk, updating every week or so.
-- 
regards
Kenneth Gonsalves

-- 
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.



Getting into professional django development

2011-10-18 Thread Kevin
Hello everyone!

  I have been using Django for about a year now and feel that I want
to take my experience to the next level.  I have created a few website
using Django to test my skills, although not for anyone specific.  I
am creating this thread as I will like to ask current Django website
developers what tools and apps are crucial to be learned.

Currently I have been focusing on the following:

* Django 1.2
* Django-guardian
* JQuery(although not specific to django)
* Pyjamas(nice alternative to GWT and works with django)
* Began learning Pinax(based on Django 1.1)
* Began learning Django-cms
* A few other, but cannot remember off the top of my head.

The problem is that I'm not really sure what Django apps to learn due
to the overwhelming amount of apps that do the same thing, just
differently.  I choose Django-guardian over Django-authority, for
example.

The next django app I plan on learning is Djax and Djaxice.

Which Django apps does everyone use in their Django projects for your
company/clients?  I'd rather not learn something which is either going
out of style, out of style, out dated, or barely used.  I cannot take
this type of experience with me to work on a larger scale project.

You must agree that when you look at the djangopackages website, there
are an overwhelming amount of apps which do almost the exact same
thing.  I'm not sure how it feels the download counts, or the other
data.  I would hope from PIP, but not sure if it has an open API for
polling download counts and such data about packages.

-- 
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: Blank output from treemenus under nginx

2011-10-18 Thread Kevin
This is rather common when moving over from the dev server to a
production environment.  Sometimes it can be tricky to map all the
static URL paths in the web server serving the static content, such as
the JavaScripts which treemenus uses.  I haven't used treemenus
before, but from past experiences with working with different apps and
moving over to a production environment, I can advise the following
steps to troubleshoot.

* Compare the output HTML from both the dev server and the production
server.
* Make sure all the resources pointed to by the production server
exist, eg. /media/js/mycode.js, in Firefox you can click these
resources in the source view.
* If any resources return a Django error, or a 404 page, that's where
your problem lies.  You will need to create a few location {} blocks
in nginx to point to the resources on the production server.  You
should have already done this for the admin app.
* Make sure you have everything needed installed on the production
server, although if anything was missing Django would have gave an
ImportError exception, it's still good to check.
* Be sure that nginx is passing all the header information to the
application, I'm not sure how wsgi works, I personally use FastCGI
with Django and Nginx.
* Check the nginx log files to see if there are any 404 or 500 error
messages, the page won't display these for resources such as a missing
JS/CSS file.

Hope this helps in your troubleshooting efforts.

On Oct 17, 5:40 pm, Alastair Campbell  wrote:
> Hi everyone,
>
> I got a surprise when using treemenus, where it worked really well on
> my local dev (django-server) , but disappeared on live (nginx using
> mod_wsgi on debian).
>
> I installed the treemenu app, imported the data (menu items) from a
> datadump of my local app, and uploaded the templates that use
> treemenu.
>
> No error, but no output either.
>
> When I went to the Admin, the menus were there, but editing the items
> resulted in a blank editing area.
> I switched on debug briefly on live (in maintenance mode), but no
> error was reported.
>
> Has anyone else experienced blank output under mod_wsgi but not local dev?
>
> If not, could someone suggest where I could start debugging? Usually I
> check logs for errors or use the django error page, but both are blank
> :-(
>
> I've had to hard-code the navigation across the site in the meantime,
> which is going to get time consuming very quickly!
>
> Kind regards,
>
> -Alastair
>
> PS. a belated thank you to Bruno Desthuilliers for help with my
> category question before, it worked!

-- 
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.