Re: App_step.readme_id may not be NULL

2014-01-30 Thread Wnt2bsleepin
Neither seem to work

readme_form.user = request.user
readme_object = readme_form.save()
step_forms.readme_template = readme_object
step_forms.save()

or

readme_form.user = request.user
readme_object = readme_form.save()
step_forms.readme = readme_object
step_forms.save()

It is still giving me the integrity error, and the readme model doesn't 
seem to have the user assigned to it.

-- 
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/3fc72c97-a3fe-4ce0-a37b-1ef0442fd051%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: App_step.readme_id may not be NULL

2014-01-30 Thread Wnt2bsleepin

>
> Didn't seem to work. The step_forms is a modelformset_factory, so I don't 
> know if that makes a difference. I would also like to assign a user to 
> the readme_form, but 
>


readme_form.user_id = request.user.id
readme_object = readme_form.save()
step_forms.readme = readme_object
step_forms.save() 

doesn't work. 

 

-- 
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/3f38ece6-cb56-4761-9a99-9855db45473a%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


App_step.readme_id may not be NULL

2014-01-30 Thread Wnt2bsleepin
I am new to Django and am trying to save two objects from the same form. 

Models:

class ReadmeTemplate(models.Model):
"""
Represents a bugfix README

Contains step models, which contain multiple steps.
"""

def __unicode__(self):
return self.title

title = models.CharField(max_length=200)
author = models.CharField(max_length=200)
user = models.ForeignKey(User,editable=False)


class Step(models.Model):
"""
Represents a single step in a Readme Template
"""
step_text = models.TextField()
readme = models.ForeignKey(ReadmeTemplate)


I am able to save the ReadmeTemplate fine, but the Steps are not able to be 
saved. Here is what I am trying in the view.

def createTemplate(request):
StepFormSet = modelformset_factory(Step, max_num=100, 
form=CreateStepForm,extra=1)
if(request.method == 'POST'):
readme_form = CreateReadmeTemplateForm(request.POST)
step_forms = StepFormSet(request.POST)
if readme_form.is_valid() and step_forms.is_valid():
try:
readme_object = readme_form.save()
readme_object.user = request.user
readme_object.save()
step_forms.readme_id = readme_object.id
step_forms.save()
except forms.ValidationError, error:
readme_object = None

return HttpResponse('opener.dismissAddAnotherPopup(window, "%s", 
"%s");' % (escape(readme_object._get_pk_val()), 
escape(readme_object)))
return 
render(request,'App/newtemplate.html',{'readme_form':readme_form,'step_forms': 
step_forms})
else:
readme_form = CreateReadmeTemplateForm()
step_forms = StepFormSet(queryset=Step.objects.none())
return 
render(request,'App/newtemplate.html',{'readme_form':readme_form,'formset': 
step_forms})


Is there anyway to get the id of the readme object and assign it to the 
step object? Thanks for any 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/1b99affb-a246-45cd-9f3d-b011361254e3%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Modify FileField in Admin

2014-01-16 Thread Wnt2bsleepin
Hello,

I am new to Django and have run into a small problem with my application's 
admin page. It displays the full url to the uploaded file, but when I click 
on it the link is warped. I have a method to retrieve the file as a 
download, and would like to put that there instead of the plain url. Is 
there anyway to customize the link that is displayed there? 
Hereis a link to the picture in a larger size



Thank you for any 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/646fc99b-594f-4792-aece-3f9d7b4106c9%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Django Internal Server Error

2012-10-09 Thread Wnt2bsleepin


On Tuesday, 9 October 2012 13:46:02 UTC-4, Wnt2bsleepin wrote:
>
> Can you explain why it's bad to use uppercase names in Nix systems? I will 
> remake the account if I need to. 
> Here is the output of python
>
>  
>
> Python 2.4 (#2, Oct  7 2012, 20:19:23)
> [GCC 4.1.2 20080704 (Red Hat 4.1.2-52)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import django
> Traceback (most recent call last):
>   File "", line 1, in ?
> ImportError: No module named django
> >>>
>
> and under python 2.7
> Python 2.7.2 (default, Oct  6 2012, 14:11:15)
> [GCC 4.1.2 20080704 (Red Hat 4.1.2-52)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import django
> >>> print django.VERSION
> (1, 4, 1, 'final', 0)
> >>>
>
>
>
>
>
>

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



Re: Django Internal Server Error

2012-10-09 Thread Wnt2bsleepin
Can you explain why it's bad to use uppercase names in Nix systems? I will 
remake the account if I need to. 
Here is the output of python

 

Python 2.4 (#2, Oct  7 2012, 20:19:23)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-52)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import django
Traceback (most recent call last):
  File "", line 1, in ?
ImportError: No module named django
>>>

and under python 2.7
Python 2.7.2 (default, Oct  6 2012, 14:11:15)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-52)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import django
>>> print django.VERSION
(1, 4, 1, 'final', 0)
>>>





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



Django Internal Server Error

2012-10-07 Thread Wnt2bsleepin
I looked in the log files for apache and it came up with the following. 

 File "/home/Yourdogsdead/uglstats/uglstats/wsgi.py", line 26, in ?
 from django.core.wsgi import get_wsgi_application
 ImportError: No module named django.core.wsgi

I am not sure why it's not importing properly. 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/9ao5LPpT3NkJ.
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.