Importing the user.id in form.

2013-06-15 Thread shashank sandela
Hi,

I defined a model which has a 'ForeignKey' to the 'User' .

models.py :

*class Design(models.Model):*
* title = models.CharField(max_length=100)*
* designer=models.ForeignKey(User)
*
* description = models.TextField(null = True)*
* def __unicode__(self):*
* return self.title*
*
*
forms.py :

*class UploadForm(forms.ModelForm):  *
*class Meta:*
*model = Design*
*fields = ('title','description')*
*
*
views.py :

*def me(request):*
*if request.POST:*
*form = UploadForm(request.POST, request.FILES)*
*if form.is_valid():*
*form.save()*
*return HttpResponseRedirect('/home/')*
*else:*
*return render_to_response('home/invalid.html')*
*else:*
*form = UploadForm()*
*args = {}*
*args.update(csrf(request))*
*args['form'] = form*
*return render_to_response('home/upload.html', 
args,context_instance=RequestContext(request))*
*
*
Now when I save the save the form, the '*designer=models.ForeignKey(User)' 
*raises 
an error "Column 'designer_id' cannot be null"  . 
A user after logging in can upload a new design.
How to store the " designer_id " i.e, the user.id  of the user who uploaded 
the design?

Can someone help me!!

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: User authentication with either username or email.

2013-06-15 Thread shashank sandela
This helped alot and solved the issue.
Thanks

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.




django vagrant template and project start

2013-06-15 Thread Sven
Hi List,

i only want to share with you some boilerplate stuff. Currently developing 
inside of virtualbox is very common, automatically build from vagrant and 
configured by puppet. 
Therefore i created a django project layout that creates all this from 
scratch. very handy.

Check it out and i really appreachiate your feedback!!

https://github.com/sassman/django-vagrant-template

A how to start read me is allready there. If you have question please contact 
me.

-- 


Best Regards
 
Sven

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Importing the user.id in form.

2013-06-15 Thread Daniel Roseman
On Saturday, 15 June 2013 10:44:03 UTC+1, shashank sandela wrote:

> Hi,
>
> I defined a model which has a 'ForeignKey' to the 'User' .
>
> models.py :
>
> *class Design(models.Model):*
> * title = models.CharField(max_length=100)*
> * designer=models.ForeignKey(User)
> *
> * description = models.TextField(null = True)*
> * def __unicode__(self):*
> * return self.title*
> *
> *
> forms.py :
>
> *class UploadForm(forms.ModelForm):  *
> *class Meta:*
> *model = Design*
> *fields = ('title','description')*
> *
> *
> views.py :
>
> *def me(request):*
> *if request.POST:*
> *form = UploadForm(request.POST, request.FILES)*
> *if form.is_valid():*
> *form.save()*
> *return HttpResponseRedirect('/home/')*
> *else:*
> *return render_to_response('home/invalid.html')*
> *else:*
> *form = UploadForm()*
> *args = {}*
> *args.update(csrf(request))*
> *args['form'] = form*
> *return render_to_response('home/upload.html', 
> args,context_instance=RequestContext(request))*
> *
> *
> Now when I save the save the form, the '*
> designer=models.ForeignKey(User)' *raises an error "Column 'designer_id' 
> cannot be null"  . 
> A user after logging in can upload a new design.
> How to store the " designer_id " i.e, the user.id  of the user who 
> uploaded the design?
>
> Can someone help me!!
>

if form.is_valid():
design = form.save(commit=False) 
design.designer = request.user
design.save()

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Importing the user.id in form.

2013-06-15 Thread shashank sandela
That worked. Thanks alot.

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.




A really simple hosting for my Django app?

2013-06-15 Thread thomaaaas
Hi there!

I just finished my first Django app that's working great locally. I have a 
PHP background, and I'm already a big fan of Django :)
Now I'm looking to host my new app online, but where and how?

My only requirement: I want something *really simple*.
I'm not a sysadmin, and I'm usually pretty bad at playing with the command 
line to install/configure stuff. 
That's why I'm looking to something extremely simple. Something like "drag 
and drop your app folder here, and it's done" would be great.

Does a really simple Django hosting solution exist?
Thanks for your help!

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: A really simple hosting for my Django app?

2013-06-15 Thread Jonathan D. Baker
Check out webfaction. They have a ton of documentation, great support and it's 
only $10/mo.

Sent from my iPhone

On Jun 15, 2013, at 1:32 PM, thoms  wrote:

> Hi there!
> 
> I just finished my first Django app that's working great locally. I have a 
> PHP background, and I'm already a big fan of Django :)
> Now I'm looking to host my new app online, but where and how?
> 
> My only requirement: I want something really simple.
> I'm not a sysadmin, and I'm usually pretty bad at playing with the command 
> line to install/configure stuff. 
> That's why I'm looking to something extremely simple. Something like "drag 
> and drop your app folder here, and it's done" would be great.
> 
> Does a really simple Django hosting solution exist?
> Thanks for your help!
> -- 
> 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.
> For more options, visit https://groups.google.com/groups/opt_out.
>  
>  

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: A really simple hosting for my Django app?

2013-06-15 Thread Enyert Viñas

On 06/15/2013 03:18 PM, Jonathan D. Baker wrote:
Check out webfaction. They have a ton of documentation, great support 
and it's only $10/mo.


Sent from my iPhone

On Jun 15, 2013, at 1:32 PM, thoms > wrote:



Hi there!

I just finished my first Django app that's working great locally. I 
have a PHP background, and I'm already a big fan of Django :)

Now I'm looking to host my new app online, but where and how?

My only requirement: I want something *really simple*.
I'm not a sysadmin, and I'm usually pretty bad at playing with the 
command line to install/configure stuff.
That's why I'm looking to something extremely simple. Something like 
"drag and drop your app folder here, and it's done" would be great.


Does a really simple Django hosting solution exist?
Thanks for your help! --
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.
For more options, visit https://groups.google.com/groups/opt_out.



--
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.
For more options, visit https://groups.google.com/groups/opt_out.



My recommendation is: https://www.openshift.com/


--
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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: A really simple hosting for my Django app?

2013-06-15 Thread m1chael
amazon aws micro instance is free for 1 year i believe


On Sat, Jun 15, 2013 at 3:58 PM, Enyert Viñas  wrote:

>  On 06/15/2013 03:18 PM, Jonathan D. Baker wrote:
>
> Check out webfaction. They have a ton of documentation, great support and
> it's only $10/mo.
>
> Sent from my iPhone
>
> On Jun 15, 2013, at 1:32 PM, thoms  wrote:
>
>  Hi there!
>
> I just finished my first Django app that's working great locally. I have a
> PHP background, and I'm already a big fan of Django :)
> Now I'm looking to host my new app online, but where and how?
>
> My only requirement: I want something *really simple*.
> I'm not a sysadmin, and I'm usually pretty bad at playing with the command
> line to install/configure stuff.
> That's why I'm looking to something extremely simple. Something like "drag
> and drop your app folder here, and it's done" would be great.
>
> Does a really simple Django hosting solution exist?
> Thanks for your help! --
> 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.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>
> --
> 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.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>
> My recommendation is: https://www.openshift.com/
>  
>
> --
> 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.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.