Re: Implementing Foreign Key without admin interface

2012-03-28 Thread Sandeep kaur
On Fri, Mar 9, 2012 at 4:31 AM, Ramiro Morales  wrote:
> On Thu, Mar 8, 2012 at 4:44 PM, Sandeep kaur  wrote:
>>                        job_no_id = client.job_no
>>                        ...
>> Am I wrong somewhere?  How should I do this?  Please help!!
>
> Yes, that client variable appears magically. Please paste working code,
> an abridged version but working code.
>
Sorry for very late reply. See my code at :

https://github.com/sandeepmadaan/TCC11_12_1/tree/master/TCC


-- 
Sandeep Kaur
E-Mail: mkaurkha...@gmail.com
Blog: sandymadaan.wordpress.com

-- 
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: Implementing Foreign Key without admin interface

2012-03-08 Thread Ramiro Morales
On Thu, Mar 8, 2012 at 4:44 PM, Sandeep kaur  wrote:
>                        job_no_id = client.job_no
>                        ...
> Am I wrong somewhere?  How should I do this?  Please help!!

Yes, that client variable appears magically. Please paste working code,
an abridged version but working code.

-- 
Ramiro Morales

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



Implementing Foreign Key without admin interface

2012-03-08 Thread Sandeep kaur
I am using forms, to make the entries from the user. But when it comes
to using foreign key in a table and then making entries to it, I am
unable to do so.
See my code:

models.py:

 class ClientJob(models.Model):
"""
:ClientJob:

ClientJob Class is define all field reqiued to submit detail about new 
Job.

"""
job_no = models.AutoField(primary_key=True)
receipt_no = models.CharField(max_length=15, editable=False)
...

 class Amount(models.Model):
id = models.AutoField(primary_key=True)
job_no = models.ForeignKey(ClientJob)
.

and my views.py is

 def report_calculation(request):
id = ClientJob.objects.aggregate(Max('job_no'))
maxid =id['job_no__max']
if request.method == 'POST':
form =AmountForm(request.POST)
if form.is_valid():
cd = form.cleaned_data
job_no_id = client.job_no
...
   form.save()
   return
render_to_response('automation/job_ok.html', {'form': form,
'maxid':maxid}, context_instance=RequestContext(request))
else:
form = AmountForm()
return render_to_response('automation/job_add.html', {'form': form,
'maxid': maxid}, context_instance=RequestContext(request))

Am I wrong somewhere?  How should I do this?  Please help!! 

-- 
Sandeep Kaur
E-Mail: mkaurkha...@gmail.com
Blog: sandymadaan.wordpress.com

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