FieldError in model form with "GenericRelation" field

2011-12-07 Thread eprikazc
Hi everyone,
What is the correct way of working with generic.GenericRelation in
forms? I suspect that I am missing something in django docs. Say I
have modelForm

class ArticleForm(forms.ModelForm):
class Meta:
model = Article
fields = ["title", "body", "attachments"]

where "attachments" field is of generic.GenericRelation type:

from django.contrib.contenttypes import generic
class Article(models.Model):
title = models.CharField(max_length=100)
body = models.TextField()
attachments = generic.GenericRelation(Attachment)
created = models.DateField(auto_now_add=True)

When instantiating the ArticleForm I get following error:
Django Version: 1.3.1
Exception Type: FieldError
Exception Value:Unknown field(s) (attachments) specified for Article

-- 
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: URL Issue - Slugged Url with Custom IDs

2011-12-07 Thread mattym
I found an article that described how theonion.com did something
similar. Their url is the slug and an ID separated by a comma. The
article said pulling by ID gives a performance gain. But they wanted
to keep the seo friendly url as well.

http://www.theonion.com/articles/secretary-of-agriculture-attends-diplomatic-meetin,26822/

With that idea I implemented a solution that I like:

My path resolves to: /,/foo

#urls.py
urlpatterns = patterns('app.views',
   (r'^(?P[\w-]+),(?P.*)/foo/$', 'viewfunction'),
)

#views.py
def viewfunction(request, api_id, pageslug):
 if pageslug != themodel.slug:
return
HttpResponsePermanentRedirect(thebattle.get_absolute_url())
else:
themodel = get_object_or_404(MyModel, custom_id=api_id)
...

#models.py
set get_absolute_url() in models.py accordingly.

~Matt

On Dec 7, 1:36 pm, mattym  wrote:
> Hi all -
>
> Question. I would love to use a slug in the usual way for nice urls:
>
> #urls.py
> urlpatterns = patterns('app.views',
>     (r'^(?P.*)/foo/$', 'viewfunction'),
> )
>
> #views.py
> def viewfunction(request, myslug):
>     themodel = get_object_or_404(MyModel, slug=myslug)
>
> However, due to requirements 'themodel' will have to be pulled by a
> custom id that is retrieved via an API.  From there to get proper
> routing I had to chang urls.py and views.py to.
>
> #urls.py
> urlpatterns = patterns('app.views',
>     (r'^(?P.*)/foo/$', 'viewfunction'),
> )
>
> #views.py
> def viewfunction(request, api_id):
>     themodel = get_object_or_404(MyModel, custom_id=api_id)
>
> This works. But with ugly URLS:
>
> What is the cleanest way to pull mymodel with the custom api_id, and
> still have a slug/seo friendly url?
>
> This seems simple but my mind is trying to make it complex.
>
> Thanks,
> Matt

-- 
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: slow function

2011-12-07 Thread kenneth gonsalves
On Wed, 2011-12-07 at 05:48 -0800, Derek wrote:
> > I make similar names - although frankly I do not know where I got
> the
> > impression from and whether it is correct or not.
> 
> Yes, I would agree with that.  So code like:
> 
> scrs = Score.objects.all()
> 
> could then be written as:
> 
> scores = Score.objects.all()
> 
> so it will then be fairly obvious (downstream of the assignment) that
> `scores` contains data from the `Score` model.
> 
> 

makes sense - and saves the time spent cooking up names.
-- 
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.



Python2.7.2 with MySQL documentation conflict

2011-12-07 Thread sturdyworks
The same MySQL-python file (MySQL-python-1.2.3.tar.gz) is available
from both PyPI and the projects SourceForge site, BUT...

sourceforge.net/projects/mysql-python says "Python versions 2.3-2.6
are supported"
and
pypi.python.org/pypi/MySQL-python says "Python-2.3 through 2.7 are
currently supported"

I hope the later is true--I sure want to use Python 2.7.2 with Django
and MySQL.

Does any one know if this is ok? I think the Source Forge site might
need updating.

-Sturdyworks

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



Re: Django E-Commerce Framework

2011-12-07 Thread Martin Tiršel
On Tue, 06 Dec 2011 22:45:05 +0100, Stuart Laughlin  
 wrote:



I have firsthand experience implementing satchmo for a very large
storefront, and I can heartily recommend it. People who recommend
writing your own ecommerce platform have an overly romanticized
perspective. In my opinion ecommerce is not where you want to make
your own mistakes and go by trial and error. Better to benefit from
the experience, mistakes, and corrections of others when it comes to
ecommerce. Leave the wheel reinventing for your blog. :)

Another advantage of satchmo (and please forgive the self-promotion)
is that you can purchase a companion mobile application that extends
your website to iphones, ipads, android devices, and the like via apps
native to each platform. Preliminary information is at
http://www.johnheerman.com./portfolio/ with a dedicated site coming
Real Soon Now.



Hi,

I would not recommend the Satchmo although it is a great project and you  
can learn a lot from it. Reasons:


1.) very very very bad documentation, you have to search a lot in the  
Satchmo code (good for somebody who wants to learn :). And for some  
features you don't even know how to use them.


2.) heavyweight - for a page to loat you need 200-300 SQL queries

3.) Django admin interface is not suited for such application

Reagards,
Martin

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



Re: Django E-Commerce Framework

2011-12-07 Thread mattym
If the shop does not need to be majorly customized I also recommend
Satchmo.
If it is going to be a large store you might have to research
implementing Custom Products with Satchmo.  And do a little work
making Custom Products as friendly to administrate and track in the
store admin as Configurable Products are. However, the project I was
on used an older version: .9.0




On Dec 6, 4:55 am, Reinout van Rees  wrote:
> On 06-12-11 06:40, Md,Mehedi Hasan Kabir(Tanim) wrote:
>
>
>
> > Can anyone give me some suggestion/link for Django E-Commerce Framework?
>
> No personal experience, but the one I see mentioned most often: django
> lightning fast shop.http://www.getlfs.com/
>
> Reinout
>
> --
> Reinout van Rees                    http://reinout.vanrees.org/
> rein...@vanrees.org            http://www.nelen-schuurmans.nl/
> "If you're not sure what to do, make something. -- Paul Graham"

-- 
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: custom attributes of model field

2011-12-07 Thread trubliphone
Thanks very much for this.

This looks very promising.  And I know that it may seem inappropriate
to mix presentation logic with application logic, but I plan on doing
other things on the model based on these field types.  So your second
example should fit well.

On Dec 7, 1:22 am, Doug Ballance  wrote:
> Just to clarify that last bit about a mapping on the model since it's
> closest to what you originally described.  Just pseudo-code, but you
> can see the idea.
>
> class Model1(models.Model):
>    FIELD_DISPLAY={
>       'foo': ['a'],
>       'bar': ['b','c']
>    }
>    a = models.CharField()
>    b = models.ForeignKey('Model2')
>    c = models.IntegerField()
>
> {% for field in form|field_type:"foo" %}{{field}}{% endfor %}
> {% for field in form|field_type:"bar" %}{{field}}{% endfor %}
>
> @register.filter
> def form_field(form,key):
>     fields=form.Meta.model.FIELD_DISPLAY[key]
>     return [form.fields[fn] for f in fields]

-- 
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: Query with no-correspondence results

2011-12-07 Thread Ian Clelland
On Wed, Dec 7, 2011 at 7:54 AM, wgis  wrote:

> First, thank you both for your answers. I'm now realizing that doing
> this with the ORM is not so easy as I thought it would be to others
> django fellows (it's my first django project, but I'm nailing it =P).
> I saw your RAW SQL solution and it looked genius-simple. I have short
> experience with the JOIN operation but that make sense to me. Yet, I
> tested, and I still get
> (Carrot, Flavour, 2.0)
> and just
> (Cars, Smell, 4.2) (Cars, Usability, 4.9)without the other contexts.
> If I remove the WHEREs (not filtering by user or thing), it still
> presents without nulls (or 0.0)
> Is there other way you can see?
> Again, thanks
> On 6 Dez, 21:48, Ian Clelland  wrote:
> > On Tue, Dec 6, 2011 at 1:35 PM, Reinout van Rees  >wrote:
> >
> > > Ah! Now I get your point. You also want the "empty" results for which
> > > there's no SQL data. Sorry, but I don't see a way in which you can do
> that
> > > with an SQL query (and so also not with a Django query).
> >
> > > In case you want all contexts, you'll have to query for those
> > > specifically. And afterwards grab the results belonging to that
> context. So
> > > you won't escape a for loop and some manual work, I'm afraid.
> >
> > Raw SQL:
> > select thing, name, vote from mydatabase_votecontext left join
> > mydatabase_vote on (mydatabase_vote.context_id =
> mydatabase_votecontext.id)
> > where thing='Carrot' and user='Me'
> >
> > That should return null if there is no vote. If you'd rather have zeros,
> > then use this:
> >
> > select thing, name, ifnull(vote, 0.0) from mydatabase_votecontext left
> join
> > mydatabase_vote on (mydatabase_vote.context_id =
> mydatabase_votecontext.id)
> > where thing='Carrot' and user='Me'
> >
> > There still might be a way to do it with the ORM; but you can definitely
> > use raw sql for this.
> >
> > --
> > Regards,
> > Ian Clelland
> > 
>
>
You're right -- it's the 'and user='Me' bit that is messing it up. I know
you left the id columns out to simplify the problem, but without a full
table structure, it's harder for me to visualize the join and the rows that
are getting selected.

Try this:
select thing, name, vote from mydatabase_votecontext left
join mydatabase_vote on (mydatabase_vote.context_id =
mydatabase_votecontext.id and thing='Carrots' and user='me')

With that statement, the left join should produce:
(votecontext.id, name, vote.id, thing, context_id, user, vote)
(1, Flavour, 4, Carrots, 1, Me, 3.0)
(2, Smell, NULL, NULL, NULL, NULL)
(3, Usability, NULL, NULL, NULL, NULL)
(4, Size, NULL, NULL, NULL, NULL)

And the select columns should reduce the width, to this:
(thing, name, vote)
(Carrots, Flavour, 3.0)
(NULL, Smell, NULL)
(NULL, Usability, NULL)
(NULL, Size, NULL)

If you absolutely need 'Carrots' in the first column (and you might not;
you should have it in the template context anyway, when you need to display
it), then you would have to duplicate it in the query, and use another
ifnull, like this:

select ifnull(thing, 'Carrots'), name, vote from mydatabase_votecontext
left join mydatabase_vote on (mydatabase_vote.context_id =
mydatabase_votecontext.id and thing='Carrots' and user='me')

(Or try Tom's secret sauce, and see if that works :) )


-- 
Regards,
Ian Clelland


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



URL Issue - Slugged Url with Custom IDs

2011-12-07 Thread mattym
Hi all -

Question. I would love to use a slug in the usual way for nice urls:

#urls.py
urlpatterns = patterns('app.views',
(r'^(?P.*)/foo/$', 'viewfunction'),
)

#views.py
def viewfunction(request, myslug):
themodel = get_object_or_404(MyModel, slug=myslug)

However, due to requirements 'themodel' will have to be pulled by a
custom id that is retrieved via an API.  From there to get proper
routing I had to chang urls.py and views.py to.

#urls.py
urlpatterns = patterns('app.views',
(r'^(?P.*)/foo/$', 'viewfunction'),
)

#views.py
def viewfunction(request, api_id):
themodel = get_object_or_404(MyModel, custom_id=api_id)

This works. But with ugly URLS:

What is the cleanest way to pull mymodel with the custom api_id, and
still have a slug/seo friendly url?

This seems simple but my mind is trying to make it complex.

Thanks,
Matt

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



custom view in admin

2011-12-07 Thread TeenSpirit83
i'm customizing the django admin with custom views
for a model i need to create a  custom view which is a little
different frome the default changelist
we all know clicking on the records in the default changelist just to
open the object detail page , the django admin calls an url like this
admin/site/model/objectID

so i created a custom changelist-like view and specified its pattern
into the get_urls method so i can call it with
site/model/custompattern
but if i click on the records to open the object detail page django
admin calls an url like this
site/model/custompattern/objectID
the admin goes into ValueError
invalid literal for int() with base 10: 'inattivi/4692'

How can I arrange the url pattern and the view just to make it work
like the original changelist ?

-- 
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: Query with no-correspondence results

2011-12-07 Thread Tom Evans
On Wed, Dec 7, 2011 at 5:09 PM, Tom Evans  wrote:
> Isn't this the secret sauce he is looking for?
>

Of course, I forget that the OP also wants to filter by a specific user:


>>> qs = VoteContext.objects.filter((Q(vote__thing=carrot) | 
>>> Q(vote__isnull=True)) & (Q(vote__user=u) | Q(vote__isnull=True)))
>>> qs = qs.annotate(vote_value=Sum('vote__vote'))
>>> for vote_ctxt in qs: print vote_ctxt.name, vote_ctxt.vote_value
...
Flavour 2.0
Smell None
Usability None
Size None
>>> qs = VoteContext.objects.filter((Q(vote__thing=carrot) | 
>>> Q(vote__isnull=True)) & (Q(vote__user=u2) | Q(vote__isnull=True)))
>>> qs = qs.annotate(vote_value=Sum('vote__vote'))
>>> for vote_ctxt in qs: print vote_ctxt.name, vote_ctxt.vote_value
...
Flavour 4.0
Smell None
Usability None
Size None

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: Query with no-correspondence results

2011-12-07 Thread Tom Evans
On Tue, Dec 6, 2011 at 9:35 PM, Reinout van Rees  wrote:
> On 06-12-11 21:11, wgis wrote:
>>
>> I get
>> (Carrots, Flavor,2.0)
>>
>> I want to list all the contexts in the "Carrot template", withou
>> having to search and merge the ones missing.
>> So if the result was
>>
>> (Carrots, Flavour, 2.0)
>> (Carrots, Smell, 0.0)
>> (Carrots, Usability, 0.0)
>> (Carrots, Size, 0.0)
>> or
>> (Carrots, Flavour, 2.0)
>> (Carrots, Smell, null)
>> (Carrots, Usability, null)
>> (Carrots, Size, null)
>
>
> Ah! Now I get your point. You also want the "empty" results for which
> there's no SQL data. Sorry, but I don't see a way in which you can do that
> with an SQL query (and so also not with a Django query).
>
> In case you want all contexts, you'll have to query for those specifically.
> And afterwards grab the results belonging to that context. So you won't
> escape a for loop and some manual work, I'm afraid.
>

Isn't this the secret sauce he is looking for?

>>> from django.db.models import Q, Sum
>>> qs = VoteContext.objects.filter(Q(vote__thing=carrot) | 
>>> Q(vote__isnull=True))
>>> qs = qs.annotate(vote_value=Sum('vote__vote'))
>>> for vote_ctxt in qs: print vote_ctxt.name, vote_ctxt.vote_value
...
Flavour 2.0
Smell None
Usability None
Size None


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: Query with no-correspondence results

2011-12-07 Thread wgis
First, thank you both for your answers. I'm now realizing that doing
this with the ORM is not so easy as I thought it would be to others
django fellows (it's my first django project, but I'm nailing it =P).
I saw your RAW SQL solution and it looked genius-simple. I have short
experience with the JOIN operation but that make sense to me. Yet, I
tested, and I still get
(Carrot, Flavour, 2.0)
and just
(Cars, Smell, 4.2) (Cars, Usability, 4.9)without the other contexts.
If I remove the WHEREs (not filtering by user or thing), it still
presents without nulls (or 0.0)
Is there other way you can see?
Again, thanks
On 6 Dez, 21:48, Ian Clelland  wrote:
> On Tue, Dec 6, 2011 at 1:35 PM, Reinout van Rees wrote:
>
> > Ah! Now I get your point. You also want the "empty" results for which
> > there's no SQL data. Sorry, but I don't see a way in which you can do that
> > with an SQL query (and so also not with a Django query).
>
> > In case you want all contexts, you'll have to query for those
> > specifically. And afterwards grab the results belonging to that context. So
> > you won't escape a for loop and some manual work, I'm afraid.
>
> Raw SQL:
> select thing, name, vote from mydatabase_votecontext left join
> mydatabase_vote on (mydatabase_vote.context_id = mydatabase_votecontext.id)
> where thing='Carrot' and user='Me'
>
> That should return null if there is no vote. If you'd rather have zeros,
> then use this:
>
> select thing, name, ifnull(vote, 0.0) from mydatabase_votecontext left join
> mydatabase_vote on (mydatabase_vote.context_id = mydatabase_votecontext.id)
> where thing='Carrot' and user='Me'
>
> There still might be a way to do it with the ORM; but you can definitely
> use raw sql for this.
>
> --
> Regards,
> Ian Clelland
> 

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



Re: Django E-Commerce Framework

2011-12-07 Thread bobhaugen
I'm guessing that the OP wanted to develop a "standard" e-commerce
site for a single company, in which case I agree with Stuart and Andre
that the way to go is a well-tested e-commerce framework.

I had to roll my own because I was doing something very different: B2B
e-commerce with an efficient order form (order from a grid combining
many products, not one-product-per-page adding to a shopping cart one
at a time) and order line items from many producers where the payment
from the customer needs to get allocated to each producer.  But had a
well-tested framework for that kind of thing been available, I would
have grabbed it.

As it is, I did use django-paypal with some customizations, which is
its own kind of pain in the butt.  (Not django-paypal, the
customizations, because now I am stuck with the version of django-
paypal that I customized...)  Eventually I'll take another look at
payment apps and some of the newer e-commerce frameworks that are more
modular.

-- 
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: urlresolver and custom Site model?

2011-12-07 Thread Andres Reyes
Also you can use
FORCE_SCRIPT_NAMEin
your settings

2011/12/7 Daniel Roseman 

> On Wednesday, 7 December 2011 12:49:47 UTC, aleksandra...@googlemail.comwrote:
>>
>> Hello everyone
>>
>> Becuase I do not use django database at all my application currently
>> can't be deployed to a custom location different from "/" quite
>> simply. I use {% url ... %} template tags within templates and
>> django.core.urlresolvers.**reverse to populate urls. The problem is that
>> if I deploy myapp under http://host:port/MYSAPCE/myapp and site_id is
>> not defined in db the url is not picking "MYSAPCE".
>>
>> What I am trying to do now is to write my own site model (without
>> using django database) that would be used by urlresolver. I was
>> wondering if someone could point me how that should be done.
>>
>> Thanks
>> Alex
>>
>
> How are you deploying your application? There should be no need for a
> custom urlresolver - Django uses the SCRIPT_NAME value which should be set
> by your webserver. If that's not working for you, you may have something
> wrong in your hosting setup.
> --
> 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/-/IF09jV7YDwkJ.
>
> 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.
>



-- 
Andrés Reyes Monge
armo...@gmail.com
+(505)-8873-7217

-- 
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: urlresolver and custom Site model?

2011-12-07 Thread Daniel Roseman
On Wednesday, 7 December 2011 12:49:47 UTC, aleksandra...@googlemail.com 
wrote:
>
> Hello everyone
>
> Becuase I do not use django database at all my application currently
> can't be deployed to a custom location different from "/" quite
> simply. I use {% url ... %} template tags within templates and
> django.core.urlresolvers.reverse to populate urls. The problem is that
> if I deploy myapp under http://host:port/MYSAPCE/myapp and site_id is
> not defined in db the url is not picking "MYSAPCE".
>
> What I am trying to do now is to write my own site model (without
> using django database) that would be used by urlresolver. I was
> wondering if someone could point me how that should be done.
>
> Thanks
> Alex
>

How are you deploying your application? There should be no need for a 
custom urlresolver - Django uses the SCRIPT_NAME value which should be set 
by your webserver. If that's not working for you, you may have something 
wrong in your hosting setup.
--
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/-/IF09jV7YDwkJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django E-Commerce Framework

2011-12-07 Thread CrabbyPete
There are lots of good payment packages you can use. I'm using this
one https://bitbucket.org/adroll/authorize/wiki/Home for CIM services
with Authorize.Net, but
there are lots of good packages you can use and its really very easy
to implement them. Satchmo is great, but if you really want to
understand and have controll roll your own.  I've also used
https://github.com/johnboxall/django-paypal and it really not hard at
all. I would also like to try this one https://github.com/abunsen/Paython



On Dec 6, 2:50 pm, Denhua  wrote:
> Hi Pete,
>
> Do you mean django-authorizenet?
> I can't find a django-authorize.
>
> Thanks,
> Dennis
>
> On Dec 6, 9:04 am, CrabbyPete  wrote:
>
>
>
>
>
>
>
> > Roll your own and use packages like django-authorize and django-paypal
> > they are easy to use and don't bring along lots of baggage.
>
> > On Dec 6, 8:19 am, Andre Terra  wrote:
>
> > > I haven't worked with either one of them, but satchmo[1] is also often
> > > mentioned.
>
> > > Django packages also has a list of e-commerce tools for django [2].
>
> > > Hope that helps!
>
> > > Cheers,
> > > AT
>
> > > [1]http://www.satchmoproject.com/
> > > [2]http://djangopackages.com/grids/g/ecommerce/
>
> > > On Tue, Dec 6, 2011 at 10:55 AM, Reinout van Rees 
> > > wrote:
>
> > > > On 06-12-11 06:40, Md,Mehedi Hasan Kabir(Tanim) wrote:
>
> > > >> Can anyone give me some suggestion/link for Django E-Commerce 
> > > >> Framework?
>
> > > > No personal experience, but the one I see mentioned most often: django
> > > > lightning fast shop.http://www.getlfs.com/
>
> > > > Reinout
>
> > > > --
> > > > Reinout van Rees                    http://reinout.vanrees.org/
> > > > rein...@vanrees.org            
> > > > http://www.nelen-schuurmans.**nl/
> > > > "If you're not sure what to do, make something. -- Paul Graham"
>
> > > > --
> > > > You received this message because you are subscribed to the Google 
> > > > Groups
> > > > "Django users" group.
> > > > To post to this group, send email to django-users@googlegroups.com.
> > > > To unsubscribe from this group, send email to 
> > > > django-users+unsubscribe@**
> > > > googlegroups.com .
> > > > For more options, visit this group athttp://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: slow function

2011-12-07 Thread Derek
On Dec 6, 12:34 pm, kenneth gonsalves  wrote:
> On Tue, 2011-12-06 at 02:15 -0800, Derek wrote:
> > Another side comment would be a suggestion to avoid "old skl vrbl nms"
> > - in other words, use "player" for "ply", "month" for "mnth", "scores"
> > for "scrs", "form" for "fm" and so on.  It may seem obvious right now
> > what those mean, but you (or someone else?) comes back in six months
> > or a year's time...
>
> 'player', 'score' etc are names used in my models/fields, I was under
> the impression that instances should bear the same name as the models so
> I make similar names - although frankly I do not know where I got the
> impression from and whether it is correct or not.

Yes, I would agree with that.  So code like:

scrs = Score.objects.all()

could then be written as:

scores = Score.objects.all()

so it will then be fairly obvious (downstream of the assignment) that
`scores` contains data from the `Score` model.

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



Re: Django E-Commerce Framework

2011-12-07 Thread Andre Terra
On Tue, Dec 6, 2011 at 7:45 PM, Stuart Laughlin wrote:

> In my opinion ecommerce is not where you want to make
> your own mistakes and go by trial and error. Better to benefit from
> the experience, mistakes, and corrections of others when it comes to
> ecommerce. Leave the wheel reinventing for your blog. :)
>

I wholeheartedly agree. Avoiding the "not invented here" syndrome is even
more important when we're talking about customers making online payments.


Cheers,
AT

-- 
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: pip installs the wrong version of django-registration

2011-12-07 Thread Andre Terra
Hello, Kenneth

*I am posting this here as the app in question has not got the issue
> tracker available. On doing pip install registration, a version without
> the registration.default.backends.**urls is installed. Can this be
> corrected?*
>

Only if the author updates the package in pypi[1], which is currently at
0.7.

The "official" bitbucket repo has been sitting at 0.8-alpha since 2009[2],
so this is pretty much abandonware at this point.

You can point pip to download from VCS repositories. The instructions are
easily followed from the docs[3].

As usual, I also recommend reading this guide[4] on using virtualenv/pip
for django development. It's the go-to guide to setting up a sane
environment.

Good luck!


Cheers,
AT


[1] http://pypi.python.org/pypi/django-registration
[2] https://bitbucket.org/ubernostrum/django-registration/downloads
[3]
http://www.pip-installer.org/en/latest/usage.html#version-control-systems
[4]
http://www.saltycrane.com/blog/2009/05/notes-using-pip-and-virtualenv-django/



On Wed, Dec 7, 2011 at 9:36 AM, kenneth gonsalves wrote:

> hi
>
> I am posting this here as the app in question has not got the issue
> tracker available. On doing pip install registration, a version without
> the registration.default.backends.urls is installed. Can this be
> corrected?
> --
> 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.



urlresolver and custom Site model?

2011-12-07 Thread aleksandra.tarkow...@googlemail.com
Hello everyone

Becuase I do not use django database at all my application currently
can't be deployed to a custom location different from "/" quite
simply. I use {% url ... %} template tags within templates and
django.core.urlresolvers.reverse to populate urls. The problem is that
if I deploy myapp under http://host:port/MYSAPCE/myapp and site_id is
not defined in db the url is not picking "MYSAPCE".

What I am trying to do now is to write my own site model (without
using django database) that would be used by urlresolver. I was
wondering if someone could point me how that should be done.

Thanks
Alex

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



Need help for using easy_thumbnails

2011-12-07 Thread Nibil M.S
I am using Django Development trunk version on Fedora 15. I tried to enable
the thumbnails option on my project followed by the instructions given in
https://github.com/SmileyChris/easy-thumbnails . But the thumbnail is not
working. Only the image is loading. Please help to fix the problem.
Attaching the bookpage.html file which uses this thumbnails. I have added
the 'easy_thumbnails' in INSTALLED_APPS of settings.py
-- 
Nibil M.S
'Needam'
Trithala.

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

{% extends "base.html" %}
{% block centercontent %}
{% load thumbnail %}
Bookings

 
 
 Book a Cottage Now
 
{% if list %}


{% for p in list %}
  
{{ p.name }}
 on  {{ p.date|date:"D, jS F Y" }}
{% if p.photo %}

{% endif %}
Booked {{ p.cottage }} from {{ p.datefrom }} to {{ p.dateto }} for {{ p.adults }} Adults and {{ p.child }} Children.



{% endfor %}


{% else %}
Still Under Construction
{% endif %}


 Book a Cottage Now
 

{% endblock %}


Need help for using easy_thumbnails

2011-12-07 Thread Nibil M.S
I am using Django Development trunk version on Fedora 15. I tried to enable
the thumbnails option on my project followed by the instructions given in
https://github.com/SmileyChris/easy-thumbnails . But the thumbnail is not
working. Only the image is loading. Please help to fix the problem.
Attaching the bookpage.html file which uses this thumbnails. I have added
the 'easy_thumbnails' in INSTALLED_APPS of settings.py
-- 
Nibil M.S
'Needam'
Trithala.

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



Django and Windows Forms application data exchange?

2011-12-07 Thread Eugene Goldberg
Hello!
Could you please give me a piece of advice? I've got two applications:
Web-application on Django and Windows Forms application on C#. The
task is to organise communication between this two applications.

C# application need to get some data from server and post data to
server (server is django-app).

It looks like there are actually two tasks:
1. C# reads information from server.
2. C# writes information to server.

I was thinking about construct a web-form on Django, then makes C# app
to make post-request. In this case Django will be able to validete
request. This will solve probtasklem 1.

The task 2, perhaps, may be solved like this: C# creates http-request
and pot query-params in URL, then processing method of Django
generates response (in form of text to be parsed by C# app).

The other option I was thinking about is to somehow find mechanism to
build xml representation of an object and then send this xml from and
to server.

Could you please help me find the best way to do it? What technologies
should I use?

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



pip installs the wrong version of django-registration

2011-12-07 Thread kenneth gonsalves
hi

I am posting this here as the app in question has not got the issue
tracker available. On doing pip install registration, a version without
the registration.default.backends.urls is installed. Can this be
corrected?
-- 
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: Django E-Commerce Framework

2011-12-07 Thread Kai

Hi,

On 2011-12-06 05:40:04 +, Md,Mehedi Hasan Kabir(Tanim) said:


Can anyone give me some suggestion/link for Django E-Commerce Framework?


You might want to look into LFS:

http://www.getlfs.com.

If you need help you are welcome to join us on IRC:

irc://irc.freenode.net/django-lfs


Cheers
Kai


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



Re: Django E-Commerce Framework

2011-12-07 Thread Kai

On 2011-12-06 21:45:05 +, Stuart Laughlin said:


People who recommend
writing your own ecommerce platform have an overly romanticized
perspective. In my opinion ecommerce is not where you want to make
your own mistakes and go by trial and error. Better to benefit from
the experience, mistakes, and corrections of others when it comes to
ecommerce.


+1

Kai


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



documentation patch questions

2011-12-07 Thread Annie
Hi all -

I have some questions before I submit a ticket with a patch to change
a few things in the docs/topics/testing.txt file. One change is a typo
fix, and another is a possible change I have a question about. Since
they're both relatively minor changes to the same file (no major
rewrites required), do I submit both on one ticket (after my question
about the second change is answered here) with my patch, or do they
need to be submitted separately?



This example under the "Running tests" section of the page is what
confused me when I read it, so I thought I should check before I
suggested a change in case I was reading the example incorrectly. *g*

Here's the relevant bit of the docs:



And it gets even more granular than that! To run a *single* test
method inside a test case, add the name of the test method to the
label::

$ ./manage.py test animals.AnimalTestCase.testFluffyAnimals




In both unittest and doctest examples given above that test run
example, there is no testFluffyAnimals method. The unittest defines
testSpeaking and the doctest uses speak. I think it would be clearer
if the example read like this:

$ ./manage.py test animals.AnimalTestCase.testSpeaking


Am I reading the original example correctly? Or is it just that my
brain's tired from looking at this stuff too long today? :)

Ok, I lied, there's actually a third issue--something I noticed as I
was double checking before I sent this email: shouldn't the method be
named test_speaking, if we're supposed to follow the guidelines on the
coding style page? "Use underscores, not camelCase, for variable,
function and method names (i.e. poll.get_unique_voters(), not
poll.getUniqueVoters)."

Thanks for the input -
Annie Mullin

-- 
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: custom attributes of model field

2011-12-07 Thread Doug Ballance
Just to clarify that last bit about a mapping on the model since it's
closest to what you originally described.  Just pseudo-code, but you
can see the idea.

class Model1(models.Model):
   FIELD_DISPLAY={
  'foo': ['a'],
  'bar': ['b','c']
   }
   a = models.CharField()
   b = models.ForeignKey('Model2')
   c = models.IntegerField()

{% for field in form|field_type:"foo" %}{{field}}{% endfor %}
{% for field in form|field_type:"bar" %}{{field}}{% endfor %}

@register.filter
def form_field(form,key):
fields=form.Meta.model.FIELD_DISPLAY[key]
return [form.fields[fn] for f in fields]

-- 
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: custom attributes of model field

2011-12-07 Thread Doug Ballance
I may not be clear on what you are trying to accomplish, but maybe
something like

class Form1(forms.ModelForm):
class Meta:
   model=Model

def type_one_fields(self):
return [self.fields['a']] # Or use whatever criteria you want
for type_one fields.

def type_two_fields(self):
return [self.fields['b']]

def type_three_fields(self):
return [self.fields['c']]

{% for field in form.type_one_fields %}{{field}}{% endfor %}

I don't think the model is where you'd want to do any form/display
stuff.  It would be best kept on the form, or as a template tag.  If
you are trying to make a 'generic' configuration such as putting all
text fields in one section, fks in another, etc... you could make a
filter:

{% for field in form|field_type:"text" %}{{field}}{% endif %}
{% for field in form|field_type:"foreignkey" %}{{field}}{% endif %}

The filter would have to be smart enough to inspect the form variable
and pick the right fields either by widget, checking a mapping on the
model, or some other criteria that fits exactly what you are trying to
do.

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