Re: If any one have experience with Django treebeard package

2018-07-08 Thread 'Kristofer Pettijohn' via Django users
object.add_child(...) 


From: "pranay reddy"  
To: "django-users"  
Sent: Friday, July 6, 2018 6:12:44 AM 
Subject: If any one have experience with Django treebeard package 

Plz expalin how to add child for sibling 

Sent via the [ http://play.google.com/store/apps/details?id=com.blackberry.hub 
| BlackBerry Hub for Android ] 


-- 
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 [ mailto:django-users+unsubscr...@googlegroups.com | 
django-users+unsubscr...@googlegroups.com ] . 
To post to this group, send email to [ mailto:django-users@googlegroups.com | 
django-users@googlegroups.com ] . 
Visit this group at [ https://groups.google.com/group/django-users | 
https://groups.google.com/group/django-users ] . 
To view this discussion on the web visit [ 
https://groups.google.com/d/msgid/django-users/7ghvd1dmetpgb93m1ovrb08q.1530875564068%40gmail.com?utm_medium=email_source=footer
 | 
https://groups.google.com/d/msgid/django-users/7ghvd1dmetpgb93m1ovrb08q.1530875564068%40gmail.com
 ] . 
For more options, visit [ https://groups.google.com/d/optout | 
https://groups.google.com/d/optout ] . 

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


Re: Doubts about static files

2017-08-30 Thread 'Kristofer Pettijohn' via Django users
Point Apache at static_root. 

Django apps you install may also include static files, and "collectstatic" 
gathers all of those together and puts them in one place (under STATIC_ROOT). 


From: "sarfaraz ahmed"  
To: "Django users"  
Sent: Wednesday, August 30, 2017 8:58:05 AM 
Subject: Doubts about static files 

Hello Team, 

I have doubts about static files. I read articles on Django but it does not 
clearly states that atleast I got confused. 

STATICFILES_DIRS = [os.path.join(BASE_DIR, "static")] this is my 
STATICFILES_DIRS settings which points out to static folder under my project. 
Also, I can add all the folder from individual app which hold static files here 
so that it search for static files. 
STATIC_ROOT = os.path.join(os.path.dirname(BASE_DIR),'static_root') which 
points out to one level up folder than my project. This is how my project 
folder structures look like 

static_root 
MyProject 
--static 
CSS 
JS 
imgs 
--MyProject 
--MyApp 

When I run collectstatic files moves files from static files from static folder 
to static root. 

Now, my question is when deploy it on apache which folder should I point to in 
my conf files. static_root or static. 

Regards, 
Sarfaraz Ahmed 







-- 
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 [ mailto:django-users+unsubscr...@googlegroups.com | 
django-users+unsubscr...@googlegroups.com ] . 
To post to this group, send email to [ mailto:django-users@googlegroups.com | 
django-users@googlegroups.com ] . 
Visit this group at [ https://groups.google.com/group/django-users | 
https://groups.google.com/group/django-users ] . 
To view this discussion on the web visit [ 
https://groups.google.com/d/msgid/django-users/6b7e06ea-a56b-4b4b-b0ad-79ee4dbc3884%40googlegroups.com?utm_medium=email_source=footer
 | 
https://groups.google.com/d/msgid/django-users/6b7e06ea-a56b-4b4b-b0ad-79ee4dbc3884%40googlegroups.com
 ] . 
For more options, visit [ https://groups.google.com/d/optout | 
https://groups.google.com/d/optout ] . 

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


Re: Stripe Not Returning Token (test mode)

2016-06-18 Thread Kristofer Pettijohn
Yes, I am using CSRF on the form and do not have any issues with it. 




 

{% csrf _token %} 

https://checkout.stripe.com/checkout.js&quot</a>; class="stripe-button" 

data-key="{{ stripe_publishable_key }}" 

data-amount="{{ stripe_amount }}" 

data-name="..." 

data-description="..." 

data-zip-code="true" 

data-billing-address="true" 

data-allow-remember-me="true" 

data-email="{{ summary_dict.email_address }}" 

data-locale="auto" 

data-label="Register with Card" 

data-zip-code="true"> 

 

 


From: "Chris Kavanagh" <cka...@gmail.com> 
To: "Digest Recipients" <django-users@googlegroups.com> 
Sent: Friday, June 17, 2016 8:51:04 PM 
Subject: Re: Stripe Not Returning Token (test mode) 

One last question, if you don't mind. Did you have to use a {% csrf_token %} on 
your form? I read somewhere on stackoverflow that Stripe Checkout wouldn't 
accept the csrf token? Thanks again, Kristofen. 

On Fri, Jun 17, 2016 at 4:49 PM, Kristofer Pettijohn < kristo...@cybernetik.net 
> wrote: 



This is how I did it. This is using Stripe Checkout. 

forms.py ... (you can omit the address pieces if you don't need them) 

class StripeForm(forms.Form): 
stripeToken = forms.CharField(max_length=80) 
stripeBillingName = forms.CharField(max_length=80, required=False) 
stripeBillingAddressLine1 = forms.CharField(max_length=80, required=False) 
stripeBillingAddressZip = forms.CharField(max_length=80, required=False) 
stripeBillingAddressState = forms.CharField(max_length=80, required=False) 
stripeBillingAddressCity = forms.CharField(max_length=80, required=False) 
stripeBillingAddressCountry = forms.CharField(max_length=80, required=False) 


views.py ... 

stripe_form = StripeForm(request.POST or None) 
if request.method == 'POST' and stripe_form.is_valid(): 
token = stripe_form.cleaned_data['stripeToken'] 
customer = stripe.Customer.create( 
description=summary_dict['email_address'], 
source=token 
) 



From: "Chris Kavanagh" < cka...@gmail.com > 
To: "Django users" < django-users@googlegroups.com > 
Sent: Thursday, June 16, 2016 2:20:22 PM 
Subject: Stripe Not Returning Token (test mode) 

Stripe Not Returning Token (test mode) 

I'm trying out Stripe in test mode on a site I'm building, and for some reason 
Stripe won't return a token as it's supposed to. 
I can tell it's not returning a token, because I get a MultiValueDictKeyError 
when submitting the form. Plus, it won't print 
the token out to the console, so it's obviously not returning one. 

If I change the line ( token = request.POST['stripeToken'] ) to ( token = 
request.POST.get('stripeToken ')), I get the error " 
Request req_8eOcfP3bw2bzDd: Must provide source or customer." This way will 
actually create 
a customer I can see in the Stripe Dashboard but won't create a charge, and of 
course 
I get the error "must provide a source or customer." 

Here's the link to Stripe form documentation along with javascript. . . 
https://stripe.com/docs/custom-form 

I've double checked the keys to make sure they are correct, and it's definitely 
in test mode. From the examples & 
tutorials I've looked at, I don't see a reason it shouldn't be working. Any 
help is greatly appreciated, thanks Chris. 

Anyway, here's the code: 

#views.py 

def checkout(request): 
publishable_key = settings.STRIPE_PUBLISHABLE_KEY 
stripe.api_key = settings.STRIPE_SECRET_KEY 
if request.method == "POST": 
#token = request.POST.get('stripeToken') 
token = request.POST['stripeToken'] 
print token 
customer = stripe.Customer.create(description='test', source=token) 
print customer 
stripe.Charge.create(amount=500, currency='usd', source=token, 
description='test') 
#stripe.Charge.create(amount=500, currency='usd', customer=customer, 
description=customer_data['description']) 
return redirect('orders:thanks.html') 
context = {'publishable_key': publishable_key} 
return render(request, 'orders/checkout.html', context) 





#template checkout,html 

{% extends "base.html" %} 

{% block jQuery %} 
https://js.stripe.com/v2/</a> "> 

 
Stripe.setPublishableKey('{{ publishable_key }}'); 

$(function() { 
var $form = $('#payment-form'); 
$form.submit(function(event) { 
// Disable the submit button to prevent repeated clicks: 
$form.find('.submit').prop('disabled', true); 

// Request a token from Stripe: 
Stripe.card.createToken($form, stripeResponseHandler); 

// Prevent the form from being submitted: 
return false; 
}); 
}); 

function stripeResponseHandler(status, response) { 
// Grab the form: 
var $form = $('#payment-form'); 

if (response.error) { // Problem! 

// Show the errors on the form: 
$form.find('.payment-errors').text(response.error.message); 
$form.find('.submit').prop('disabled', false); // Re-enable submission 

} 

Re: Stripe Not Returning Token (test mode)

2016-06-17 Thread Kristofer Pettijohn
This is how I did it. This is using Stripe Checkout. 

forms.py ... (you can omit the address pieces if you don't need them) 

class StripeForm(forms.Form): 
stripeToken = forms.CharField(max_length=80) 
stripeBillingName = forms.CharField(max_length=80, required=False) 
stripeBillingAddressLine1 = forms.CharField(max_length=80, required=False) 
stripeBillingAddressZip = forms.CharField(max_length=80, required=False) 
stripeBillingAddressState = forms.CharField(max_length=80, required=False) 
stripeBillingAddressCity = forms.CharField(max_length=80, required=False) 
stripeBillingAddressCountry = forms.CharField(max_length=80, required=False) 


views.py ... 

stripe_form = StripeForm(request.POST or None) 
if request.method == 'POST' and stripe_form.is_valid(): 
token = stripe_form.cleaned_data['stripeToken'] 
customer = stripe.Customer.create( 
description=summary_dict['email_address'], 
source=token 
) 



From: "Chris Kavanagh"  
To: "Django users"  
Sent: Thursday, June 16, 2016 2:20:22 PM 
Subject: Stripe Not Returning Token (test mode) 

Stripe Not Returning Token (test mode) 

I'm trying out Stripe in test mode on a site I'm building, and for some reason 
Stripe won't return a token as it's supposed to. 
I can tell it's not returning a token, because I get a MultiValueDictKeyError 
when submitting the form. Plus, it won't print 
the token out to the console, so it's obviously not returning one. 

If I change the line ( token = request.POST['stripeToken'] ) to ( token = 
request.POST.get('stripeToken ')), I get the error " 
Request req_8eOcfP3bw2bzDd: Must provide source or customer." This way will 
actually create 
a customer I can see in the Stripe Dashboard but won't create a charge, and of 
course 
I get the error "must provide a source or customer." 

Here's the link to Stripe form documentation along with javascript. . . 
https://stripe.com/docs/custom-form 

I've double checked the keys to make sure they are correct, and it's definitely 
in test mode. From the examples & 
tutorials I've looked at, I don't see a reason it shouldn't be working. Any 
help is greatly appreciated, thanks Chris. 

Anyway, here's the code: 

#views.py 

def checkout(request): 
publishable_key = settings.STRIPE_PUBLISHABLE_KEY 
stripe.api_key = settings.STRIPE_SECRET_KEY 
if request.method == "POST": 
#token = request.POST.get('stripeToken') 
token = request.POST['stripeToken'] 
print token 
customer = stripe.Customer.create(description='test', source=token) 
print customer 
stripe.Charge.create(amount=500, currency='usd', source=token, 
description='test') 
#stripe.Charge.create(amount=500, currency='usd', customer=customer, 
description=customer_data['description']) 
return redirect('orders:thanks.html') 
context = {'publishable_key': publishable_key} 
return render(request, 'orders/checkout.html', context) 





#template checkout,html 

{% extends "base.html" %} 

{% block jQuery %} 
https://js.stripe.com/v2/";> 

 
Stripe.setPublishableKey('{{ publishable_key }}'); 

$(function() { 
var $form = $('#payment-form'); 
$form.submit(function(event) { 
// Disable the submit button to prevent repeated clicks: 
$form.find('.submit').prop('disabled', true); 

// Request a token from Stripe: 
Stripe.card.createToken($form, stripeResponseHandler); 

// Prevent the form from being submitted: 
return false; 
}); 
}); 

function stripeResponseHandler(status, response) { 
// Grab the form: 
var $form = $('#payment-form'); 

if (response.error) { // Problem! 

// Show the errors on the form: 
$form.find('.payment-errors').text(response.error.message); 
$form.find('.submit').prop('disabled', false); // Re-enable submission 

} else { // Token was created! 

// Get the token ID: 
var token = response.id; 

// Insert the token ID into the form so it gets submitted to the server: 
$form.append($('').val(token)); 

// Submit the form: 
$form.get(0).submit(); 
} 
}; 
 

{% endblock %} 


{% block content %} 
Credit Card Payment 
 
 
 
{% csrf_token %} 


 
Card 
 
 
 
 
 
Expiration (MM/) 
 
 
 
 
 
 
 
 
 
 
CVC 
 
 
 
 
 
 
 
 
 
 
 
 
{% endblock %} 



Request req_8eOcfP3bw2bzDd: Must provide source or customer. 

MultiValueDictKeyError at /orders/checkout/ 
"'stripeToken'" 


-- 
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 https://groups.google.com/group/django-users . 
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/8596d735-c697-4734-a2a3-a6bbec0ee2e2%40googlegroups.com
 . 
For more options, visit https://groups.google.com/d/optout . 

-- 
You received this message because you are subscribed to the Google Groups 

Re: Django 1.9.5 Cookies. how can I set and display them?

2016-05-05 Thread Kristofer Pettijohn
I recommend looking at the Django documentation. You set cookies via 
request.session.set(). And you typically do not modify the response value 
returned from HttpResponse() unless you are doing more advanced things. 

For example (straight from the docs): 

def post_comment(request, new_comment): 
if request.session.get('has_commented', False): 
return HttpResponse("You've already commented.") 
c = comments.Comment(comment=new_comment) 
c.save() 
request.session['has_commented'] = True 
return HttpResponse('Thanks for your comment!') 

or: 

def login(request): 
m = Member.objects.get(username=request.POST['username']) 
if m.password == request.POST['password']: 
request.session['member_id'] = m.id 
return HttpResponse("You're logged in.") 
else: 
return HttpResponse("Your username and password didn't match.") 

or if you want to delete a cookie: 

def logout(request): 
try: 
del request.session['member_id'] 
except KeyError: 
pass 
return HttpResponse("You're logged out.") 



From: "shaukat ali"  
To: "Django users"  
Sent: Thursday, May 5, 2016 3:30:50 AM 
Subject: Django 1.9.5 Cookies. how can I set and display them? 

Hey Guys 
I have a website which do some calculations in different ways. It will use 
COOKIES. So how can I set and display the COOKIES? So can you guys guide me. 

My code id: 

response = HttpResponse( 'true' ) 
DEFAULT_DATE_FORMAT = ' MM/dd/ ' 
# Here I am setting my cookies 
response.set_cookie('DEFAULT_DATE_FORMAT', DEFAULT_DATE_FORMAT) 

# Here I am displaying my cookies 
mycookies = request.COOKIES['DEFAULT_DATE_FORMAT'] 
print( mycookies) 

I does not display any error message but it just stop my code execution. 
NOTE: My browser's cookies are enabled. 


-- 
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 https://groups.google.com/group/django-users . 
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/cff8d681-5be5-4754-939e-2294f3cf71b3%40googlegroups.com
 . 
For more options, visit https://groups.google.com/d/optout . 

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


Re: url redirect with kwargs no NoReverseMatch

2016-04-05 Thread Kristofer Pettijohn
You need to name your URLs: 
https://docs.djangoproject.com/es/1.9/topics/http/urls/#naming-url-patterns 


urlpatterns = [ 
url(r'^doll/$', views.doll_describer), 
url(r'^yourdolldata/(?P\d+)/$', views.yourDollData, name='yourDollData' ), 
url(r'^connexion/$', views.connexion), 
url(r'^logout/$', views.deconnexion), 
] 


From: "Luigi Mognetti"  
To: "Django users"  
Sent: Tuesday, April 5, 2016 12:17:39 PM 
Subject: url redirect with kwargs no NoReverseMatch 

http://stackoverflow.com/questions/36411798/url-redirect-with-kwargs-no-noreversematch
 

main-project urls.py : 

from django . conf . urls import include , url 
from django . contrib import admin 

urlpatterns = [ 
url ( r '^admin/' , include ( admin . site . urls )), 
url ( r '' , include ( 'data.urls' )), 
] 





urls.py : (from the data_app) 


urlpatterns = [ 
url ( r '^doll/$' , views . doll_describer ), 
url ( r '^yourdolldata/(?P\d+)/$' , views . yourDollData ), 
url ( r '^connexion/$' , views . connexion ), 
url ( r '^logout/$' , views . deconnexion ), 
] 



views.py 

def doll_describer ( request ): 
# if this is a POST request we need to process the form data 
if request . method == 'POST' : 
# create a form instance and populate it with data from the request: 
form = DollForm ( request . POST ) 
print ( form ) 
# check whether it's valid: 
if form . is_valid (): 
print ( "was valid" ) 
doll = form . save ( commit = False ) 
doll . save () 
print ( "DOG.ID=" , doll . id ) 
return HttpResponseRedirect ( reverse ( 'yourDollData' , kwargs ={ 'id' : doll 
. id })) 

else : 
print ( "form is not valid" ) 

# if a GET (or any other method) we'll create a blank form 
else : 
form = DollForm () 
print ( "wasn't valid" ) 

return render ( request , 'data/doll.html' , { 'form' : DollForm }) 

def yourDollData ( request , id ): 
doll = DollData . objects . get ( id = id ) 
print ( "Doll=" , doll ) 
print ( "DOG_TYPE=" , type ( doll )) 
return render ( request , 'data/save.html' , { 'doll' : doll }) 


I can 't understand why i' m getting the following error : 

> NoReverseMatch at /doll/ 

And it concerns the 
`HttpResponseRedirect(reverse('yourDollData', kwargs={'id': doll.id}))` 

Tough, everything's fine with the `doll.id` which is printed out correctly one 
line before. 

Of course when I hard access in my browser to 127.0.0.1:8000/yourdolldata/15/ 
it works perfectly. So it's all about this reversing process. I guess it has 
something to do with my url regex not matching what I think I'm reversing ... 

How can i get that fixed ? I know it's a common mistake but I can't see any 
thing done the wrong way after I've done my internet research. 



-- 
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 https://groups.google.com/group/django-users . 
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/91eb6688-9f83-4491-b871-58ad7bb65d49%40googlegroups.com
 . 
For more options, visit https://groups.google.com/d/optout . 

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


Re: Django + Nginx + X-Accel-Redirect

2016-03-31 Thread Kristofer Pettijohn
Try changing file_url to be relative: 

file_url = '/media/users/avatar.png' 

Also check the nginx error log to make sure the path is being constructed 
properly by nginx. 


From: "Neto"  
To: "Django users"  
Sent: Thursday, March 31, 2016 11:04:07 AM 
Subject: Django + Nginx + X-Accel-Redirect 

How do I access protected directories using Django? I have the following 
configuration but is not working, there is always page 404 when I try to access 
the directory. 

Django: 

def test ( request ): 
file_url = 'http://mysite.com/media/users/avatar.png' 
response = HttpResponse () 
response [ 'X-Accel-Redirect' ] = file_url 
return response 

Nginx: 

server { 
listen 80 ; 
server_name mysite . com ; 

location / media / { 
internal ; 
alias / home / ubuntu / webapps / myapp / media /; 
} 
} 





-- 
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 https://groups.google.com/group/django-users . 
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c965f092-bf02-4146-8a5f-2e5f7fef90db%40googlegroups.com
 . 
For more options, visit https://groups.google.com/d/optout . 

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


Re: Migrating older 1.4 project to 1.9

2016-03-30 Thread Kristofer Pettijohn
I have also upgraded a few apps this way, from 1.5 to 1.9. Keep your eyes on 
the release notes for each version for big changes. It also helps to have good 
test cases written so that you can run them upon each upgrade. 


From: "Gergely Polonkai"  
To: "Django users"  
Sent: Wednesday, March 30, 2016 1:06:45 PM 
Subject: Re: Migrating older 1.4 project to 1.9 



I have already suggested this approach to someone with a similar problem: 
upgrade one version at a time. I’m sure it is possible to find older versions; 
1. upgrade to the next minor release (1.4 => 1.5, etc), 2. do the necessary 
adjustments, 3. goto 1. 

It may be a lot of work, but at the end of the day you will have a perfectly 
upgraded application. I have successfully upgraded 3 apps this way, one of them 
being really big (tens of thousands of code lines). 
Roger, 

Yeah, I too have a large project that I'll hopefully be migrating 
from 1.4 to 1.9 soon. 

It's about 3.5 years worth of work, over 200,000 lines of code 
in about 1000 Python source file and Django template files. 

So any tips you come up with will be invaluable. Please post 
anything you learn to this thread. 

Thanks! 
--Fred 
Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/ 
Bristle Software, Inc -- http://bristle.com -- Glad to be of service! 
Open Source: Without walls and fences, we need no Windows or Gates. 
On 3/30/16 9:23 AM, bobhaugen wrote: 



We feel your pain. If you do it, and write down how it goes, we would be 
grateful. 
https://github.com/valnet/valuenetwork 

On Tuesday, March 29, 2016 at 4:19:59 PM UTC-5, Roger Dunn wrote: 
BQ_BEGIN

I've inherited a moderately large project written 2 years ago using Django 1.4, 
and wondering if it is worth creating a fresh 1.9 project and porting in the 
old code, or doing an in-place upgrade to 1.9? 

I have it running on 1.4 'as is' but if I run python manage.py migrate it comes 
unglued as a lot of stuff has changed since 1.4. 






-- 
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 https://groups.google.com/group/django-users . 
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/2a3de1fc-5032-4807-b008-66f2e381ac7f%40googlegroups.com
 . 
For more options, visit https://groups.google.com/d/optout . 

BQ_END



-- 
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 https://groups.google.com/group/django-users . 
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/56FBDDBE.9020409%40bristle.com . 
For more options, visit https://groups.google.com/d/optout . 


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

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


Re: What am I supposed to do if I want a Wizard?

2015-12-09 Thread Kristofer Pettijohn
If you just want something simple, stick with Form Wizard. If it doesn't do 
something you need, see if you can extend it by creating a new class and 
overriding methods that you need to change. Otherwise if you need more 
functionality, I would roll your own. 


From: "Martín Torre Castro" <martin.torre.cas...@gmail.com> 
To: django-users@googlegroups.com 
Sent: Wednesday, December 9, 2015 4:30:08 PM 
Subject: Re: What am I supposed to do if I want a Wizard? 



Thank you, Kristofer. It's interesting. I'm looking right now. 

It seems complex, but I will investigate, although I would prefer a more 
generic way of doing this, because I suspect I will be using many wizards soon. 

Any other suggestions? 
El 9 dic. 2015 10:56 p. m., "Kristofer Pettijohn" < kristo...@cybernetik.net > 
escribió: 



I sdid my own form wizard for a project I worked on. For a good example, you 
can look at Oscar Ecommerce in github, and look at their checkout app within 
the code. That may inspire you with some ideas on how to implement such a 
behavior. 


From: "Martin Torre Castro" < mad...@gmail.com > 
To: "Django users" < django-users@googlegroups.com > 
Sent: Wednesday, December 9, 2015 5:10:14 AM 
Subject: What am I supposed to do if I want a Wizard? 

Hello, 
I was investigating about form wizards in Django, but I have seen that recently 
this has changed in the deprecation timeline doc: 

" The form wizard has been refactored to use class-based views with pluggable 
backends in 1.4. The previous implementation will be removed. " 

I understand that the old form wizard is now part of the form-tools package and 
I must install it if I want to use it. 

My question is if I should do it or maybe I should "use class based-views with 
pluggable backends", which I'm not sure of what means and sounds like doing all 
the classes and boilerplate for doing wizards all again on my own. 


Please, could someone give me some advice. If I go with class based views, 
could someone pass me a link where I can find some example with a form wizard 
made in such way. 


Thank you very much in advanced. 


-- 
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/ac8fecc6-baed-4b40-8f71-bfdc17a69ee7%40googlegroups.com
 . 
For more options, visit https://groups.google.com/d/optout . 


-- 
You received this message because you are subscribed to a topic in the Google 
Groups "Django users" group. 
To unsubscribe from this topic, visit 
https://groups.google.com/d/topic/django-users/_8_lqJsiqkc/unsubscribe . 
To unsubscribe from this group and all its topics, 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/2461989.1453939.1449698183679.JavaMail.zimbra%40cybernetik.net
 . 
For more options, visit https://groups.google.com/d/optout . 





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

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


Re: What am I supposed to do if I want a Wizard?

2015-12-09 Thread Kristofer Pettijohn
I sdid my own form wizard for a project I worked on. For a good example, you 
can look at Oscar Ecommerce in github, and look at their checkout app within 
the code. That may inspire you with some ideas on how to implement such a 
behavior. 


From: "Martin Torre Castro"  
To: "Django users"  
Sent: Wednesday, December 9, 2015 5:10:14 AM 
Subject: What am I supposed to do if I want a Wizard? 

Hello, 
I was investigating about form wizards in Django, but I have seen that recently 
this has changed in the deprecation timeline doc: 

" The form wizard has been refactored to use class-based views with pluggable 
backends in 1.4. The previous implementation will be removed. " 

I understand that the old form wizard is now part of the form-tools package and 
I must install it if I want to use it. 

My question is if I should do it or maybe I should "use class based-views with 
pluggable backends", which I'm not sure of what means and sounds like doing all 
the classes and boilerplate for doing wizards all again on my own. 


Please, could someone give me some advice. If I go with class based views, 
could someone pass me a link where I can find some example with a form wizard 
made in such way. 


Thank you very much in advanced. 


-- 
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/ac8fecc6-baed-4b40-8f71-bfdc17a69ee7%40googlegroups.com
 . 
For more options, visit https://groups.google.com/d/optout . 

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


Re: Login in all pages

2015-02-05 Thread Kristofer Pettijohn
I think the login decorator may give you what you are trying to do in a much 
easier way: 
https://docs.djangoproject.com/en/1.7/topics/auth/default/#limiting-access-to-logged-in-users
 

Unless I am not understanding your issue. 


From: "Juan Diego Gonzalez"  
To: django-users@googlegroups.com 
Sent: Thursday, February 5, 2015 7:35:09 AM 
Subject: Login in all pages 

Hi, I need to put the django login feature in all pages, I mean, the user will 
be able to login in the reserved area of the web from any public page. 

I have all the implementation done, and it works with a single page, in this 
way: 
url(r'^home/$', magic.views.login, {'template_name':'magic/index.html'}), 

I have put the code in a template, and it works only with home page, that is 
logical. Could anyone help me, please. I doesn't find any documentation. 

May be something like url(r'^*/$', magic.views.login, 
{'template_name':'magic/index.html'}), 

where * means any page. 

Thank you very much. 

Diego. 


-- 
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/d44e8397-4b0a-4056-8f48-908793762ff4%40googlegroups.com
 . 
For more options, visit https://groups.google.com/d/optout . 

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


Re: Why using admin.py in apps?

2015-01-25 Thread Kristofer Pettijohn
Your admin.py is specific to each app, on how you want the models for your app 
to show up (or not show up) in the admin page. 

Each app's admin.py will be unique to the models specific in that app. 

The tutorial in the Django documentation shows a good example. 


From: "Aliane Abdelouahab"  
To: django-users@googlegroups.com 
Sent: Sunday, January 25, 2015 10:59:09 AM 
Subject: Why using admin.py in apps? 

Hi, 
My question seem dumb, but what is the purpose of repeating the admin.py in the 
apps? 

as i understand, if i want to have a good practice, i separate my application 
on mini apps so i can re-use them, and one of the apps that is always used, are 
Logins (Registrations), so, why i have to repeat the admin.py for every app, 
since the admin.py is related for the big project (startproject), and not for 
the small application (startapp) (login here) ?! 


-- 
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/99db6624-f50c-420c-81d6-89efa42286d2%40googlegroups.com
 . 
For more options, visit https://groups.google.com/d/optout . 

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


Re: Recommendations for hosting service?

2015-01-06 Thread Kristofer Pettijohn
Also +1 for AWS. You can start out small for free for your first year, and grow 
to the size of Pinterest over time. All of the other tools they provide are 
helpful as well: RDS so you don't have to manage your own database, Caching 
Service, Queuing Service, etc. 


From: "Fred Stluka"  
To: django-users@googlegroups.com 
Sent: Tuesday, January 6, 2015 8:01:25 PM 
Subject: Re: Recommendations for hosting service? 

+1 for AWS. 

Been using it for years. Keeps getting cheaper and better. 

--Fred 
Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/ 
Bristle Software, Inc -- http://bristle.com -- Glad to be of service! 
Open Source: Without walls and fences, we need no Windows or Gates. 
On 1/6/15 10:46 AM, Mark Phillips wrote: 



+1 for Linode and Digital Ocean. 

Also, you can get 2 Virtual Private Servers on AWS EC2 for free for the first 
year. 

http://aws. amazon .com/free/ 

Mark 

On Tue, Jan 6, 2015 at 7:21 AM, claudiomet < claudio...@gmail.com > wrote: 

BQ_BEGIN

I have digitalocean and no problems 

2015-01-06 11:05 GMT-03:00 Vijay Khemlani < vkhem...@gmail.com > : 


BQ_BEGIN

I like Linode, and DigitalOcean is also a great choice. 

Both require low-level configuration of the server but I prefer that over the 
pre-packaged solutions. 

On Tue, Jan 6, 2015 at 10:44 AM, Brad Rice < bradri...@gmail.com > wrote: 

BQ_BEGIN

I like webfaction, too. I think they would have all the stuff you list as well 
as more. 

On Tuesday, January 6, 2015 6:30:18 AM UTC-5, Bobby Mozumder wrote: 
BQ_BEGIN
Anyone have recommendations for hosting services that can do Django, Node.js, 
Postgreqsl, python3, as well as PHP/MySQL for legacy stuff? I’m also looking to 
have IMAP email. This would be for several domains, with maybe 100GB of data. 

-bobby 


-- 
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/1c61b6c7-ae41-48fa-a2f1-2eb1b8a7ea68%40googlegroups.com
 . 

For more options, visit https://groups.google.com/d/optout . 

BQ_END


-- 
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/CALn3ei2Vh-OmGWYd25-fL829cokjKLvcF59EV0nvpk7E%2BQEd5g%40mail.gmail.com
 . 

For more options, visit https://groups.google.com/d/optout . 

BQ_END




-- 
Claudio Cortes N. 
Project Engineer 
Environmental Area 
MICOMO S.A. 
Tel: +56 (2) 22400516 
Cel: +56 (9) 65871064 
ccor...@micomo.cl 
www.micomo.cl 
Antonio Rabat Sur 6165, Vitacura 
Región Metropolitana, Chile 
-- 
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/CABWjCh3rsr23aw2LwhJPcO3SkR_FG3_Ct4VPAAUdi9iz97WBfQ%40mail.gmail.com
 . 

For more options, visit https://groups.google.com/d/optout . 

BQ_END


-- 
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/CAEqej2NKH9_yz1WKkYg95cu8Z0qikPsqyJcuVrHs1He-fTSG5Q%40mail.gmail.com
 . 
For more options, visit https://groups.google.com/d/optout . 

BQ_END



-- 
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/54AC9375.1020804%40bristle.com . 
For more options, visit https://groups.google.com/d/optout . 

-- 
You 

Re: Change keys in values dictionary.

2015-01-03 Thread Kristofer Pettijohn
This is a feature request that didn't make it into 1.7: 
https://code.djangoproject.com/ticket/16735 



From: "Lee Hinde"  
To: django-users@googlegroups.com 
Sent: Friday, January 2, 2015 7:34:59 PM 
Subject: Change keys in values dictionary. 

If I do a query: 

messages = 
Recipient.objects.filter(user__system_id=user_id).values("message__id","message__subject")
 
and then 

{"data":list(messages)} 

jsonify it, I end up with: 

"data" : [ 
{ 
"message__id" : "2f24d132-4321-4d63-868a-21de6fbc0d44", 
"message__subject" : "And look, a new subject." 
} 
], 

Let's assume there are lots of messages. 

What's the best way rename the keys? I.e, I'd like "message__id" to be "id". 




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

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


Re: Bulk add foreign keys in admin interface

2013-10-27 Thread Kristofer Pettijohn
I found that previously, but it doesn't seem to be quite what I need.

Let me try to rephrase.  I want to add two multi-selection boxes within the 
admin view page for the Product model.  One of the multi-selections will be 
for Colors, and one will be for Sizes.  I then want a button that the user 
can click after the select options from both multi-selection boxes.  The 
button will redirect to a method that will loop through the product of the 
two selections and add a Variation for each combination to the single 
Product (not multiple products).

For example, if the user wants to add Green, Yellow, Blue, Pink, Orange, 
and White colors with sizes 2, 4, 6, 8, 10, and 12, they can do it all with 
one click, versus manually adding 32 (Green-2, Green-4, Green-6, Blue-2, 
Blue-4, Blue-6, etc.) items into the TabularInline section

On Saturday, October 26, 2013 5:17:47 AM UTC-5, Timothy W. Cook wrote:
>
> Yes it is possible and quite easy to do.  Take a look at 
> https://docs.djangoproject.com/en/1.6/ref/contrib/admin/actions/
>
> Cheers,
> Tim
>
>
> On Sat, Oct 26, 2013 at 12:17 AM, Kristofer Pettijohn <
> kris...@cybernetik.net > wrote:
>
>> I am using the following type of model setup:
>>
>> class Product(models.Model):
>> name = models.CharField(max_length=40)
>> description = models.TextField(blank=True)
>> active = models.BooleanField(default=True)
>> priority = models.IntegerField(default=100)
>> size_chart = models.ForeignKey(SizeChart)
>> designer = models.ForeignKey(Designer)
>> collections = models.ManyToManyField(Collection)
>> categories = models.ManyToManyField(Category)
>> price = models.DecimalField(max_digits=6, decimal_places=2)
>> def __unicode__(self):
>> return self.name
>>
>> class Variation(models.Model):
>> color = models.ForeignKey(Color)
>> size = models.ForeignKey(Size)
>> product = models.ForeignKey(Product)
>> price_override = models.DecimalField(max_digits=6, decimal_places=2, 
>> blank=True)
>>
>> I have Variations setup as TabularInline in Django admin.  However, there 
>> are > 200 different colors, and about 20 sizes.  Adding 10 different colors 
>> with 15 sizes is a lot of clicking for someone.  What I would like to do is 
>> add some type of dropdown where multiple colors, along with multiple Sizes, 
>> can be selected, and then all of the Variations will be created for the 
>> cross product of those two selections.
>>
>> What I envision is having an area somewhere in the Django Admin for 
>> Product that is titled "Bulk Add" with drop down boxes for both Color and 
>> Size where multiple values for each can be selected.  When the user is 
>> happy with their selection, they will click a button and all of the 
>> Variations will be created and the user will be back to the product page 
>> with all of the options now visible in the TabularInline section.
>>
>> Is this type of action possible?
>>
>>  -- 
>> 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/1899431826.178951.1382753821780.JavaMail.zimbra%40cybernetik.net
>> .
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>
>
> -- 
> MLHIM VIP Signup: http://goo.gl/22B0U
> 
> Timothy Cook, MSc   +55 21 94711995
> MLHIM http://www.mlhim.org
> Like Us on FB: https://www.facebook.com/mlhim2
> Circle us on G+: http://goo.gl/44EV5
> Google Scholar: http://goo.gl/MMZ1o
> LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
>  

-- 
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/b9f05437-8f26-4481-98ee-12c1bc6641fa%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Bulk add foreign keys in admin interface

2013-10-25 Thread Kristofer Pettijohn
I am using the following type of model setup: 

class Product(models.Model): 
name = models.CharField(max_length=40) 
description = models.TextField(blank=True) 
active = models.BooleanField(default=True) 
priority = models.IntegerField(default=100) 
size_chart = models.ForeignKey(SizeChart) 
designer = models.ForeignKey(Designer) 
collections = models.ManyToManyField(Collection) 
categories = models.ManyToManyField(Category) 
price = models.DecimalField(max_digits=6, decimal_places=2) 
def __unicode__(self): 
return self.name 

class Variation(models.Model): 
color = models.ForeignKey(Color) 
size = models.ForeignKey(Size) 
product = models.ForeignKey(Product) 
price_override = models.DecimalField(max_digits=6, decimal_places=2, 
blank=True) 

I have Variations setup as TabularInline in Django admin. However, there are > 
200 different colors, and about 20 sizes. Adding 10 different colors with 15 
sizes is a lot of clicking for someone. What I would like to do is add some 
type of dropdown where multiple colors, along with multiple Sizes, can be 
selected, and then all of the Variations will be created for the cross product 
of those two selections. 

What I envision is having an area somewhere in the Django Admin for Product 
that is titled "Bulk Add" with drop down boxes for both Color and Size where 
multiple values for each can be selected. When the user is happy with their 
selection, they will click a button and all of the Variations will be created 
and the user will be back to the product page with all of the options now 
visible in the TabularInline section. 

Is this type of action possible? 

-- 
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/1899431826.178951.1382753821780.JavaMail.zimbra%40cybernetik.net.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Specific models without a database table

2011-08-21 Thread Kristofer Pettijohn
> That is substantially harder, but could be possible. The main problem is that 
> the Django ORM will want to write SQL queries when there's a link to the 
> EmailAccount model.
> 
> Your best bet is probably a proxy model that contains a reference to the 
> relevant API record (e.g. the email address identifier or whatever the API 
> uses), and then a custom save() method that writes the values out to the DB. 
> You can use the Django form logic etc without it needing to be backed by a 
> model.
> 
> It will largely depend on how you want the EmailAccount to look - the closer 
> you want it to work to a standard ORM model, the more work you'll have to do 
> to trick things. If it's a simple field that isn't used for queries, then you 
> could look at creating a custom field type that knows how to read/write the 
> values to the API.

Are there any examples out there that get me started for overriding the save() 
method?

Ideally, I'd like to create fields in the Model that will similarly match 
fields in the mail server's API, so I can do queries, updates, etc.  I realize 
that I will need to do a lot of trickery to try to bring it closer to the 
standard ORM model.  So any little examples that might be out there would be 
helpful.

> All the above advice is worth exactly what you paid for it!

Thanks again!

-- 
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: Specific models without a database table

2011-08-21 Thread Kristofer Pettijohn
Great, thank to both of you.

I'm coming from a world of CakePHP.  I did more Python programming back in the 
day, and am getting back into it, so I'm trying to get more familiar with 
Django.

Thanks for the suggestions, I'll see what I can make happen.

- Original Message -
From: sedl...@gmail.com
To: "Django users" <django-users@googlegroups.com>
Sent: Saturday, August 20, 2011 11:44:33 AM
Subject: Re: Specific models without a database table

Hi,
you may use custom model manager (responsible for retrieving objects
from DB) and custom save method (which would not call Model.save),
together with managed=True.

You may still face some issues, however I think this should be
possible.

Cheers,
Filip

On 20 srp, 12:51, Malcolm Box <malcolm@gmail.com> wrote:
> On 20 August 2011 02:33, Kristofer Pettijohn <kristo...@cybernetik.net>wrote:
>
> > Hello,
>
> > Is it possible to create specific models without a database table?
>
> Yes, it's possible. You want the "managed" attribute on the model - 
> seehttps://docs.djangoproject.com/en/1.3/ref/models/options/#managed
>
> This will prevent Django from creating or modifying the db table
>
> > Basically what I would like to do is create an email account management
> > application that ties into my existing mail server and its API.  I would
> > like Django to have a Users model and keep track of users, a Domains model
> > to keep track of the email domains for the user, but I don't want it to
> > actually keep track of email addresses.  Once the user is in the
> > application, they will go into the "EmailAccount" model and I simply want
> > the model to query my mail server via its SOAP API.  So when they
> > create/delete/edit email accounts, there will be form pages and simple
> > validation done by Django, but the actual work will be done by connecting to
> > the mail servers API and not a database.
>
> Is this possible?
>
> That is substantially harder, but could be possible. The main problem is
> that the Django ORM will want to write SQL queries when there's a link to
> the EmailAccount model.
>
> Your best bet is probably a proxy model that contains a reference to the
> relevant API record (e.g. the email address identifier or whatever the API
> uses), and then a custom save() method that writes the values out to the DB.
> You can use the Django form logic etc without it needing to be backed by a
> model.
>
> It will largely depend on how you want the EmailAccount to look - the closer
> you want it to work to a standard ORM model, the more work you'll have to do
> to trick things. If it's a simple field that isn't used for queries, then
> you could look at creating a custom field type that knows how to read/write
> the values to the API.
>
> All the above advice is worth exactly what you paid for it!
>
> Malcolm

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



Specific models without a database table

2011-08-19 Thread Kristofer Pettijohn
Hello, 


Is it possible to create specific models without a database table? 

Basically what I would like to do is create an email account management 
application that ties into my existing mail server and its API. I would like 
Django to have a Users model and keep track of users, a Domains model to keep 
track of the email domains for the user, but I don't want it to actually keep 
track of email addresses. Once the user is in the application, they will go 
into the "EmailAccount" model and I simply want the model to query my mail 
server via its SOAP API. So when they create/delete/edit email accounts, there 
will be form pages and simple validation done by Django, but the actual work 
will be done by connecting to the mail servers API and not a database. 


Is this possible? 


Thanks, 
Kris 

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