Re: Django Userena 'OrderedDict' object has no attribute 'keyOrder'

2015-04-16 Thread willyhakim
Thank you guys.

On Wednesday, April 15, 2015 at 5:41:47 PM UTC-5, willyhakim wrote:
>
> Hi everyone,
> I am using django-userena and extend the form class to add some of my own 
> fields. I followed
> the demo and still get the above error. Anyone know what I am doing wrong?
>
> class SignupFormExtra(SignupForm):
> """ 
> A form to demonstrate how to add extra fields to the signup form, in 
> this
> case adding the first and last name.
> 
> """
> first_name = forms.CharField(label=_(u'First name'),
>  max_length=30,
>  required=True)
>
> last_name = forms.CharField(label=_(u'Last name'),
> max_length=30,
> required=False)
> industry = forms.CharField(label=_(u'Industry'),
> max_length=50,
> required=False)
> title = forms.CharField(label=_(u'title'),
> max_length=50,
> required=False)
>
> def __init__(self, *args, **kw):
> """
> 
> A bit of hackery to get the first name and last name at the top of 
> the
> form instead at the end.
> 
> """
> super(SignupFormExtra, self).__init__(*args, **kw)
> # Put the first and last name at the top
> new_order = self.fields.keyOrder[-2]
> new_order.insert(0, 'first_name')
> new_order.insert(1, 'last_name')
> new_order.insert(2, 'industry')
> new_order.insert(3, 'title')
> self.fields.keyOrder = new_order
>
> def save(self):
> """ 
> Override the save method to save the first and last name to the 
> user
> field.
> """
> # First save the parent form and get the user.
> new_user = super(SignupFormExtra, self).save()
>
> new_user.first_name = self.cleaned_data['first_name']
> new_user.last_name = self.cleaned_data['last_name']
> new_user.industry = self.cleaned_data['industry']
> new_user.title = self.cleaned_data['title']
> new_user.save()
>
> # Userena expects to get the new user from this form, so return 
> the new
> # user.
> return new_user
>

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


Django Userena 'OrderedDict' object has no attribute 'keyOrder'

2015-04-15 Thread willyhakim
Hi everyone,
I am using django-userena and extend the form class to add some of my own 
fields. I followed
the demo and still get the above error. Anyone know what I am doing wrong?

class SignupFormExtra(SignupForm):
""" 
A form to demonstrate how to add extra fields to the signup form, in 
this
case adding the first and last name.

"""
first_name = forms.CharField(label=_(u'First name'),
 max_length=30,
 required=True)

last_name = forms.CharField(label=_(u'Last name'),
max_length=30,
required=False)
industry = forms.CharField(label=_(u'Industry'),
max_length=50,
required=False)
title = forms.CharField(label=_(u'title'),
max_length=50,
required=False)

def __init__(self, *args, **kw):
"""

A bit of hackery to get the first name and last name at the top of 
the
form instead at the end.

"""
super(SignupFormExtra, self).__init__(*args, **kw)
# Put the first and last name at the top
new_order = self.fields.keyOrder[-2]
new_order.insert(0, 'first_name')
new_order.insert(1, 'last_name')
new_order.insert(2, 'industry')
new_order.insert(3, 'title')
self.fields.keyOrder = new_order

def save(self):
""" 
Override the save method to save the first and last name to the user
field.
"""
# First save the parent form and get the user.
new_user = super(SignupFormExtra, self).save()

new_user.first_name = self.cleaned_data['first_name']
new_user.last_name = self.cleaned_data['last_name']
new_user.industry = self.cleaned_data['industry']
new_user.title = self.cleaned_data['title']
new_user.save()

# Userena expects to get the new user from this form, so return the 
new
# user.
return new_user

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


Re: Django tutorial with eCommerce solution

2014-10-22 Thread willyhakim
Hi Mudassar,

How are you doing?
Have you looked into django oscar? Google it and take it from there. It is 
the best django ecommerce package.

On Tuesday, October 21, 2014 9:11:15 PM UTC-5, Ezequiel Bertti wrote:
>
> Try this:
>
> http://www.getlfs.com/
>
> On Tue, Oct 21, 2014 at 11:28 PM, Mudassar Hashmi  > wrote:
>
>> I am looking for a django project based tutorial with fully developed 
>> eStore or a commerce solution.
>>
>> Please advise. 
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com 
>> .
>> Visit this group at http://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/3df5aebe-22c0-4d2e-ab6a-245e71062b16%40googlegroups.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> Ezequiel Bertti
> E-Mail: ebe...@gmail.com 
> Cel: (21) 99188-4860
>  

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


django-allauth--"cannot import name SignupForm"

2014-06-12 Thread willyhakim
Good morning the good people of django.


I customized django-allauth signup page with following this advice 

 
from the author himself.
https://stackoverflow.com/questions/12303478/how-to-customize-user-profile-when-using-django-allauth

but I keep getting an error: Error importing form class myusers.forms: 
"cannot import name SignupForm"

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


Re: Django and Rails

2014-05-29 Thread willyhakim
Django learning curve might be steeper than Rails, but it will make you a 
better web dev in the long run. Check out realpython.com and maybe start by 
getting a solid foundation on python


On Wednesday, May 28, 2014 10:55:58 PM UTC-5, Enrique Shadah wrote:
>
> Hi all,
>
> I am learning Django after trying once with Rails. As I am a newbie to 
> software development, Rails seemed more obscure and difficult to digest. I 
> chose to learn Django because Python is easier to understand than Ruby (at 
> least to me) and because I thought it had a bigger or more enthusiastic 
> community to learn from.
>
> However, I am finding that Django has some limitations Rails does not.  
> One is that its community is fading (or at least it feels that way).  
> Another is that Rails seems to be better at automating mundane tasks 
> (staying true to the DRY principle). For example, rake db migrate can 
> add/subtract fields on table without writing any sql.  Django can add 
> fields and tables with syncdb, but if I need to subtract fields or change 
> whether the field is required or not, I am faced to writing sql.  This 
> seems pretty silly given that new site is constantly changing, thus models 
> will suffer many changes as users suggest/reject features.  
>
> These are just two limitations off the top of my head.  I am sure Django 
> is awesome, but could anyone share their views on whether I should just 
> learn Rails off the bat instead of going the Django then Rails route?
>

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


Ajax post problem

2014-04-17 Thread willyhakim
Hi everyone?

I am trying to use ajax to do the following

1)User inputs a number.
2) I use ajax to return a query list into the same page.

Here is my code
and I keep getting this error

Page not found (404)  Request Method: GET  Request URL: 
http://127.0.0.1:8000/newmarkets/search/%20method=?csrfmiddlewaretoken=VkKvStx1qGZOM1YxzM8xenGDbYRBnMPA
  
 
Using the URLconf defined in exportAbroad.urls, Django tried these URL 
patterns, in this order: 

   1. ^$ [name='index'] 
   2. ^about/$ [name='about'] 
   3. ^pricing/$ [name='pricing'] 
   4. ^market_research_tool/$ [name='market_research_tool'] 
   5. ^newmarkets/ ^$ [name='index'] 
   6. ^newmarkets/ ^search/$ [name='search'] 
   7. ^admin/ 
   8. ^accounts/ 
   9. ^static/(?P.*)$ 

The current URL, newmarkets/search/ method=, didn't match any of these.

*views.py*
def index(request):
context = RequestContext(request)
return render_to_response('newmarkets/index.html', context)

def search(request):
if request.is_ajax() and request.method=='POST':
UserHSnumber = request.POST['UserHSnumber']
country_list = Imports.objects.filter(hs_number= UserHSnumber)[1:11]
hsdescript = Products.objects.get(hs_number=UserHSnumber) 
data = {'markets': country_list, 'hsdescript': hsdescript}
mimetype='application/json'
else:
raise Http404 
return HttpResponse(json.dumps(data), mimetype)


*HTML*

{%block body_block%}

 
  What is your product's H.S number?

  
 {% csrf_token %}  
  
  Submit
  







*ajax.js*





*$(document).ready(function() { $('#hs').click(function(){ $.ajax({ 
type:"POST", url:"/newmarkets/search/", 
data:{"userHSnumber":$("#search").val()}, dataType: "json", 
success:function(data){ alert(data.message); } }); });// CSRF code
function getCookie(name) {var cookieValue = null;var i = 
0;if (document.cookie && document.cookie !== '') {var 
cookies = document.cookie.split(';');for (i; i < 
cookies.length; i++) {var cookie = 
jQuery.trim(cookies[i]);// Does this cookie string begin 
with the name we want?if (cookie.substring(0, name.length + 
1) === (name + '=')) {cookieValue = 
decodeURIComponent(cookie.substring(name.length + 1));
break;}}}return cookieValue;
}var csrftoken = getCookie('csrftoken');function 
csrfSafeMethod(method) {// these HTTP methods do not require CSRF 
protectionreturn (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method));}  
  $.ajaxSetup({crossDomain: false, // obviates need for sameOrigin 
testbeforeSend: function(xhr, settings) {if 
(!csrfSafeMethod(settings.type)) {
xhr.setRequestHeader("X-CSRFToken", csrftoken);}}
}); });*




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


Re: ManyToMany quick question

2014-04-01 Thread willyhakim

Camillo, YOU'RE DA MAN! Thank you so much? One day, at djangocon, I will 
buy you a beer

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


Re: ManyToMany quick question

2014-04-01 Thread willyhakim


I think I was missing the concept all together. So the m2m field is just 
there to show the relationship but does not take any data. That is why when 
I look in pgadmin, I do not see it. 
So sorry, I was missing the concept all together.

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


Re: ManyToMany quick question

2014-04-01 Thread willyhakim
Below is my models.py
My problem is when I syncdb (I have dropped the db couple times to start 
over)
the *country_name* field with m2m never shows in the db. what am I doing 
wrong? I am using postgres

class Products(models.Model):

hs_number = models.CharField(primary_key=True, blank=True, max_length=4)
product_descript = models.CharField(max_length=250)

class Meta:
db_table = "Products"

def __unicode__(self):
return self.hs_number


class Countries(models.Model):
country_id = models.CharField(primary_key=True, max_length=2, 
blank=True)
   * country_name = models.ManyToManyField(Products, through="Imports", 
blank=True)*
region = models.CharField(max_length=200)

class Imports(models.Model):
hs_number = models.ForeignKey(Products)
country_id = models.ForeignKey(Countries)
imported_value2008 = models.DecimalField(max_digits=12, 
decimal_places=2, default=0.00)
imported_value2009 = models.DecimalField(max_digits=12, 
decimal_places=2, default=0.00)

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


Re: ManyToMany quick question

2014-03-31 Thread willyhakim


So sorry, I should have been clear. I meant when you are assigning a field 
ManyToManyField (through) properties

 

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


ManyToMany quick question

2014-03-31 Thread willyhakim
when creating your models, how do you know which field to assign the 
ManyToManyField ?

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