Re: Tough finding a form with dynamic fields out there

2012-05-30 Thread Daniel Roseman
So, compare this:

def __init__(self, mailboxes, *args, **kwargs):
>

 with how you're calling it:
 

> form = MboxReg(request.POST, int(mailboxes))
>
>
and you should see why you're getting this: 
 

> Error:
> Exception Value: 
>
> int() argument must be a string or a number, not 'QueryDict'
>
> On the
>
> for i in range(int(mailboxes)):
>
> -- Mike
>
>
-- 
DR.  

-- 
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/-/z68uQEeQ4fsJ.
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: how to do this?

2012-05-26 Thread Daniel Roseman
On Saturday, 26 May 2012 15:03:47 UTC+1, doniyor wrote:
>
> the reason why i want to do this is this: 
>
> the user should be able to select products from products table as many as 
> he wants, at each selection i will save the product information in db, then 
> the user clicks on "book" button, which leads to another book.html template 
> where extra fields should be created for data of each selected product. 
>
> for example: user has selected 3 items from products table and then goes 
> to next step where he sees what he has selected and then he submits the 
> booking with some last information of his personal. the  point is that if 
> he has selected 3 items, then there are 3 items in db, so i create 3 html 
> input fields for each selected item where i will render the data that i get 
> from db. thats why i want to create these html input fields according to 
> the number of items in db.. 
>

But that doesn't explain why you want to do it. Say you do as you describe, 
and you've got x separate "htmls", however that happens. What do you do 
with them now? They're of no use unless you show them to the user. So you 
need to somehow concatenate them and include them into a surrounding HTML 
page. Which is exactly what Kenneth's suggestion of doing it all in the 
template would achieve.
--
DR.

-- 
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/-/ftXGQASZdQUJ.
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: how to do this?

2012-05-26 Thread Daniel Roseman
On Saturday, 26 May 2012 09:08:47 UTC+1, doniyor wrote:
>
> Yeah, but then i dont create htmls. What i want is to create so many htmls 
> as the number of objects in db. Is it possible to go around the “return“ 
> till the end of loop? Then i will have all htmls created with rendered 
> values. Is it possible to render a html particle wihthout return 
> statement.. I am also thinking now.. 
>
> Thanks man ;)


You haven't explained why you want to do this. What are you going to do 
with all these "htmls"? What's the point of creating them individually? 
Where will they be used?
--
DR. 

-- 
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/-/jc2JK3HYMYIJ.
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-crequest - New app announcement

2012-05-24 Thread Daniel Roseman
On Thursday, 24 May 2012 11:35:37 UTC+1, Alireza wrote:
>
> Hi
> Yesterday i released an app for django.
> *Basically it's just a middleware to access current request of your 
> django application from anywhere in your code.*
> Other information described in the README and pypi page.
>
> pypi:
> http://pypi.python.org/pypi/django-crequest
>
> github repo:
> https://github.com/Alir3z4/django-crequest
>
> That's it ;)
>

Aargh. This is extremely dangerous. You're setting state on the middleware 
object, but middleware objects are shared between multiple requests. Have 
you actually tried it in a production environment? The likelihood is that 
you'll get leakage between the different requests. Please don't do this.

(If you really must do this, you could try the `threadlocals` trick - it's 
still a horrible hack, but less so than this.)
--
DR.

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



Foreignkeys on multiple fields

2012-05-20 Thread Daniel Roseman
unique_together needs to be in the inner Meta class. 

But your model structure doesn't seem to make sense. Why have two ForeignKeys 
From Members to Intro? That means that a member could point to different 
entries for village and household number, which can't be right. The usual thing 
to do is to have a single FK, and access eg member.intro.village and 
member.intro.household. 
-- 
DR. 

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



Foreignkeys on multiple fields

2012-05-20 Thread Daniel Roseman
unique_together needs to be in the inner Meta class. 

But your model structure doesn't seem to make sense. Why have two ForeignKeys 
From Members to Intro? That means that a member could point to different 
entries for village and household number, which can't be right. The usual thing 
to do is to have a single FK, and access eg member.intro.village and 
member.intro.household. 
-- 
DR. 

-- 
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/-/knQW9bKkX68J.
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 forms - overriding constructor for changing field type depending by input

2012-05-20 Thread Daniel Roseman
On Sunday, 20 May 2012 12:49:28 UTC+1, luke lukes wrote:
>
> Hi. already tried this way --> fields are instantiated 
> () but are not 
> rendered in the template...
>
>>
>> You should be assigning your new fields to `self.fields['fieldname']`, 
not `self.fieldname`.
--
DR. 

-- 
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/-/mGk743JWTzsJ.
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: Newbie Stuck on Django Tutorial 3 - Django Template system

2012-05-17 Thread Daniel Roseman
On Thursday, 17 May 2012 19:39:53 UTC+1, Bob Loblaw wrote:
>
> I was cruising along fine, but am stuck now...  Any help would be 
> greatly appreciated 
>
> OS: Mac OS X Version 10.6.8 
> Python: 2.6.1 
> Django: 1.4 
>
> Issue: system throwing an error message during template rendering when 
> trying to implement Django template system.  So I guess I must have a 
> config snag somewhere in Django. 
>
>
>
> Here is the error message... 
>
> Error during template rendering 
>
> In template /data/templates/polls/index.html, error at line 20 
> Invalid block tag: ' 10p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier; 
> color: #008080; background-color: #e0ffb8} 
> 11p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier; 
> background-color: #e0ffb8} 
> 12p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier; 
> color: #80; background-color: #e0ffb8} 
> 13span.s1 {color: #99} 
> 14span.s2 {color: #00} 
> 15span.s3 {color: #80} 
> 16span.s4 {color: #bb8844} 
> 17   
> 18 
> 19 
> 20{% 
> if latest_poll_list  class="s1">%} 
> 21   
>   class="s3">ul 
> 22{% class="s2"> for poll in  span>latest_poll_list %} b> 
> 23lia span> href="/polls/ span>{{  span>poll.id }} span>/" class="s1">{{ poll.question class="s2"> }} class="s3">/a/li 
> 24   
>   class="s1">{% endfor %} span> 
> 25/ul 
> 26{% else 
>  class="s1">%} 
> 27   
>   class="s3">pNo polls are available. class="s3">/p 
> 28{% endif 
>  class="s1">%} 
> 29 
> 30 
>
>
> Here is the index.html (verbatim from tutorial)... 
>
> {% if latest_poll_list %} 
>  
> {% for poll in latest_poll_list %} 
> {{ poll.question }} li> 
> {% endfor %} 
>  
> {% else %} 
> No polls are available. 
> {% endif %} 
>

That's not the template file that's being used, as you can see from the 
error traceback - the real file appears to have a whole load of extraneous 
formatting in it. Are you using something like Word to edit your templates?
--
DR.

-- 
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/-/VePKXyM265AJ.
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: form resubmit on refresh problem

2012-05-14 Thread Daniel Roseman


On Monday, 14 May 2012 02:39:53 UTC+1, jondykeman wrote:
>
> Hello,
>
> I have a form submission problem I can't seem to figure out a way around. 
>
> Normally, once a form was submitted I would HttpResponseRedirect() to the 
> main page.
>
> However, there is something I can't seem to make work with this approach. 
>
> The form is being completed/submitted in the context of an "active 
> account" ie. there is a hidden form field "account" with value="account #"
>
> So when the form is submitted the view saves the data to that account #.
>
> Once the new form data is saved I would like it to reload to that accounts 
> summary page. ie. the summary view needs to be passed the account #
>
> This is where my issue arises. I know this would be easy to pass 
> the HttpResponseRedirect() the view with args=(account#,) yielding an 
> appropriate summary page of eg. /summary/account3/
>
> The kicker is I can't pass any account information through the urls so 
> there can only ever be a /summary/ url. The other views all work by passing 
> around the account # through POST. However, using this method to end the 
> form save view allows the user to reload the page and resubmit the form. 
>
> Any help would be greatly appreciated!!
>
> Thanks,
>
> JD
>

Store it in the session. That's a safer way of doing it anyway, rather than 
making everything a POST.
--
DR. 

-- 
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/-/yV61xAwxrVMJ.
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: New Install - django-admin.py ... just gives contest/options but doesn't run?

2012-05-09 Thread Daniel Roseman
On Wednesday, 9 May 2012 18:34:41 UTC+1, Robert G wrote: 
>
>
> I can't seem to find much about this error online - any suggestions?


On the contrary, this is very much a FAQ. Your Windows installation is set 
to run scripts against Python, but without passing any arguments.

Easiest way to fix it is to explicitly use `python django-admin.py 
startproject mysite` instead. 
--
DR.

-- 
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/-/1sQGBYobhLQJ.
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: Parse Custom html in custom template tags, django 1.4

2012-04-30 Thread Daniel Roseman


On Monday, 30 April 2012 09:03:56 UTC+1, 95felipe wrote:
>
> Hi. I've been struggling with this problem the whole night and just 
> couldn't find any solution. I've tried reverse engineering the 
> template/base.py file, but things are getting ugly. :S
>
> How can I, inside a custom tag class (template.Node), make the parser 
> render a snippet of html with tags in it? For example:
>
> @register.tag(name='addspam')
> class AddSpam(template.Node):
> def __init__(self, parser, token): ...
> def render(self, context):
> spam_html = "SPAM { any_tag_here } SPAM"
> return spam_html
>
> Here, AddSpam, when 'called', returns 'SPAM { any_tag_here } SPAM', 
> without rendering the any_tag_here.That's obviously the predictable, but 
> how can I change the return value so that any_tag_here is rendered as if it 
> was 'native'? Are there any methods using the context and the parser that I 
> could use? Thanks!
>

You could simply instantiate and render a template.Template object with the 
content of `spam_html` and the existing context:

spam_tpl = template.Template(spam_html)
return spam_tpl.render(context)
--
DR.

-- 
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/-/EInWLvpkZL0J.
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: outdated django book

2012-04-28 Thread Daniel Roseman
Which, of course, is nothing to do with Django versions, and was true even 
when the Django book was new.

On Saturday, 28 April 2012 03:30:26 UTC+1, jondbaker wrote:
>
> You need to import User from django.contrib.auth.models and login_required 
> from django.contrib.auth.decorators. Hope this helps. 
>
> Sent from my iPhone 
>
> On Apr 27, 2012, at 8:09 PM, knowledge_seeker wrote: 
>
> > My Django book (from the university library) said to add the label 
> > "@login_required" to views that I wish to restrict user access on. 
> > Django 1.4 does not allow this; obviously the book is dated! Is there 
> > a more modern way to get the same effect? 
> > 
> > Similarly, admin does not allow access to my classes, even when I have 
> > created an Admin class; is this a new security feature? 
> > 
> > Finally, when I tried to create a view that allowed web-based user 
> > creation, the views.py file would not recognize the class "User"; is 
> > there something I need to import? 
>
>

-- 
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/-/6ExeXS4aUn8J.
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: cannot locate syntax error in urls.py

2012-04-23 Thread Daniel Roseman
On Monday, 23 April 2012 15:03:35 UTC+1, r0pewalker wrote:
>
> Hi everybody. I recently started working on a project involving heavy 
> Django usage. 
> I basically retrieve data in xml  from a SOAP web service using suds, 
> parse the xml into a db and then (I should) popuate a web page. 
> I'm a beginner both in Python and Django, please bear with me and my 
> possibly ill-formed questions! 
> I've formed a reduced set of correct views and templates for the 
> purpose of testing but i cannot step through this: 
>
> 
>
 

> Exception Type: SyntaxError at /comunali/ 
> Exception Value: invalid syntax (urls.py, line 23) 
>
>
> which I confirmed by trying to import urls py fin the shell. 
> I'm quite puzzled by the fact that line 23 in my file is not a line of 
> code, since urls.py has only 22 lines. I looked through it in search 
> of tab/whitespace misuse or punctuation errors (that I often get when 
> first running any script I made). 
> Here is urls.py: 
>
> from django.conf.urls.defaults import * 
>
> urlpatterns = patterns('', 
> #Example: 
> url('^$','comunali.views.index', name='comunali_index'), 
> url(r'^provincia/(?P[^/]+)/','comunali.views.provincia', 
> name = 'comunali_provincia'), 
> url(r'^comune/(?P[^/]+)/', 'comunali.views.comune', name 
> = 'comunali_comune'), 
> url(r'^ballottaggio/(?P[^/]+)/', 
> 'comunali.views.ballottaggio', name = 'comunali_ballottaggio'), 
> url(r'^province/(?P[^/] 
> +)/','comunali.views.province', name = 'comunali_province'), 
> url(r'^province/$','comunali.views.province', name = 
> 'comunali_province'), 
> url(r'^comuni/(?P[^/]+)/', 'comunali.views.comuni', 
> name = 'comunali_regioni'), 
> url(r'^comuni/$', 'comunali.views.comuni', name = 
> 'comunali_regioni'), 
> url(r'^search/(?P[^/]+)/', 
> 'comunali.views.search_comuni', name = 'comunali_search_comuni'), 
> url(r'^(?P[^/]+)/comune/(?P[^/]+)/', 
> 'comunali.views.comune', name = 'comunali_comune'), 
> url(r'^incluso/', 'comunali.views.inc', name = 
> 'comunali_incluso'), 
>
> #Uncomment the admin/doc line below and add 
> 'django.contrib.admindocs' 
> #to INSTALLED_APPS to enable admin documentation: 
> (r'^admin/doc/', include('django.contrib.admindocs.urls')), 
>
> #Uncomment the next line to enable the admin: 
> (r'^admin/', include(admin.site.urls)), 
>
> any suggestions are welcome. 
>
>
Indeed, you're missing a line 23, which would close the parentheses opened 
in the first line.
--
DR. 

-- 
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/-/zfNEhB7f3lQJ.
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: Returning template data from a ManyToMany model

2012-04-17 Thread Daniel Roseman
On Tuesday, 17 April 2012 07:10:35 UTC+1, LJ wrote:
>
> I am having trouble figuring out how to query the database and return 
> the results in a format that my template can render appropriately. 
> I have a model that has a ManyToMany field: 
>
> class Student() 
>  ... 
>  parents = models.ManyToManyField('parents.Parent', blank=True, 
> null=True) 
>  ... 
> The Parent model looks like: 
>
> class Parent() 
> ... 
> first_name  models.CharField(max_length=30) 
> last_name  models.CharField(max_length=30) 
> gender  models.CharField(max_length=1) 
> ... 
> def __unicode__(self): 
>   return u'Parent : %s %s' % (self.first_name, self.last_name) 
>
> The method in my view currently looks something like this: 
>
> def get_parents( request, template ) 
>id=request.GET['id'] 
>template_data["parents"] = Parent.objects.filter(student=id) 
>return render_to_response( template, template_data, 
> context_instance=RequestContext(request)) 
>
> The template data is returning the data in the format: 
>   [ , ] 
>
> Instead, I need the template data formatted with the other fields in 
> my Parent model, like: 
>   [ , 
>  ] 
>
> The format doesn't have to be exactly like the above, but I need to 
> include the index, and to return some of the other fields defined in 
> my Parent model. 
> My template will look something like: 
> {% for parent in parents.object_list %} 
>  
>  {{parent.id}} 
>  {{parent.first_name}} 
>  {{parent.last_name}} 
> {% endfor %} 
>
> Can someone give me some ideas about how I can change my view to 
> return my template data in a more useable format?



This has nothing to do with your view, which is fine. The query isn't 
returning the data like that - you're just showing a string representation 
of the queryset, created by calling `repr()` (which calls `unicode()`) on 
each parent. The objects are there in full.

Your proposed template code is correct, except that you should iterate 
through just `parents`, not "parents.object_list".
--
DR.

-- 
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/-/ocAvS-nMvHcJ.
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: How to change widgets for admin site?

2012-04-16 Thread Daniel Roseman
On Monday, 16 April 2012 06:24:54 UTC+1, Gchorn wrote:
>
> Hello, I'm trying to create a blog site using Django (with "Post" as 
> my main model and "text" as the attribute corresponding to the main 
> body of text for each post).  On the admin page, when someone is 
> filling out fields to create a new blog post, I want the "text" entry 
> field to be larger than the default field for a CharField attribute. 
>
> In this part of the docs: 
>
> https://docs.djangoproject.com/en/1.4/ref/contrib/admin/ 
>
> in the "ModelAdmin options" section, under "ModelAdmin.fieldsets", 
> there is an image of pretty much what I want--a set of text entry 
> fields, where one of the fields, named "Content", is much larger than 
> the others to make it easier for whoever uses the admin site to type 
> in larger amounts of text.  However, there isn't any clear explanation 
> that I can find in this section about how to achieve this. 
>
> The closest thing I can find is a little ways further, there's a 
> section that says you can use "classes" as a field_options dictionary 
> key, and it mentions two classes defined by the default admin style 
> sheet (collapse and wide).  I think I need to specify some kind of 
> class in this way, but I don't know where on my file system the 
> default admin style sheet is located in order to read it and see if 
> there are any classes there I can use. 
>
> Can anyone help with this?  Is there a built-in CSS class that does 
> what I want, or do I need to write it myself?  If the latter, can 
> anyone tell me where I should write it and where I need to reference 
> it so that it affects the admin site?


'content' in that model is a models.TextField, not models.CharField. 
TextFields by default render with the Textarea widget.
--
DR.

-- 
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/-/7aPR5gfE6mYJ.
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: Form Validation

2012-04-15 Thread Daniel Roseman
On Sunday, 15 April 2012 10:22:43 UTC+1, coded kid wrote:
>
>
> def my_memb(request): 
> if request.method=="POST": 
> form=MembForm(request.POST) 
> if form.is_valid(): 
> data=form.cleaned_data 
> form.save() 
> return HttpResponseRedirect('/test/') 
> else: 
> form=MembForm() 
> return render_to_response('member.html', 
> {'MembForm':MembForm}, context_instance=RequestContext(request)) 
>
>
Take another look at the code above. If it's a POST, it checks the form's 
validity and if it's valid it saves. But the redirect is being executed 
whether or not the form is valid. It should be fairly clear how to fix that.
--
DR.

-- 
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/-/qPwVh6Zl2isJ.
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: South tutorial is not working

2012-04-13 Thread Daniel Roseman
On Friday, 13 April 2012 22:51:06 UTC+1, alex3627 wrote:
>
> Hi, 
>
> I added the following line in the section of INSTALLED_APPS of my 
> settings.py:
>
>  'south',
>
> then I ran "python manage.py syncdb" giving this error:
>
>   Error: No module named adminsouth
>
>
> Any ideas I have done wrong again?
>
> Alex
>
>>
>>>
You're missing a comma at the end of the line before 'south', which 
presumably ends in 'admin'.
--
DR.
 

-- 
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/-/NXuBF0szBuMJ.
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: no such column: jobs_job.mainloc

2012-04-13 Thread Daniel Roseman
On Friday, 13 April 2012 21:25:06 UTC+1, alex3627 wrote:
>
> Hi, 
>
> before even thinking to use 'South', I want to get it to work quick and 
> quick. I don't care about existing databases, I have no information in the 
> database anyway. Is there a way to just recreate a new, empty database from 
> scratch? Really, remove the old database and create a new database so that 
> it corresponds the one I have defined in models.py.
>

"manage.py reset" will drop and recreate all the tables.
 

>
> On the other side, I am not able to look at the database myself, because 
> when trying to open it I get the error:
>
>ERROR 2002 (HY000): Can't connect to local MySQL server through socket 
> '/var/run/mysqld/mysqld.sock' (2)
>
> Is there a way to access the database, and to possibly alter it, via 
> "python manage.py shell"?
>

"manage.py dbshell" will open the database shell with a connection to your 
DB.

-- 
DR. 

-- 
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/-/fgs05tsYuFYJ.
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: Working Hello World Ajax example via django pleeeease

2012-04-13 Thread Daniel Roseman


On Friday, 13 April 2012 17:04:49 UTC+1, Eli_West wrote:
>
> Thanks, I tried to stay clear of posting code because I've tried maybe 
> 20 different ways and nothing seems to work. I have used the {% url %} 
> tag and yesterday competed - a 'ajax_user_search' tut using django Q 
> still no luck. This was the load call: 
>
> $( document ).ready( function() { 
> $( '#searchSubmit' ).click( function() { 
> q = $( '#q' ).val(); 
> $( '#results' ).html( '' ).load( 
> '{% url userbase_user_search %}?q=' + q ); 
> }); 
> }); 
>
> Upon setting everything up and clicking the tag, nothing happens as 
> usual. I'm going to try the tut posted below with high hopes - and I 
> am considering trying 'djaxice' 
>
 

> OK. So, next question: where is that Javascript? In which file? Is it 
inside the HTML template that is parsed by Django, or is it in a separate 
.js file that is served by the static server? The second won't work, 
because the `url` tag will not be resolved to the actual URL. In either 
case, have a look at the rendered output of that JS to see that it has the 
URL you expect.
--
DR.

-- 
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/-/01xuMfbquQwJ.
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: no such column: jobs_job.mainloc

2012-04-13 Thread Daniel Roseman
On Friday, 13 April 2012 19:33:07 UTC+1, alex3627 wrote:
>
> Here is a repetition of what exactly I have done:
>
> 1. Add this field in my models.py
>
> 2. Run " python manage.py sql  jobs" (jobs is the name of the directory); 
> in this step the field in question is explicitly written to stdout
>
> 3. Run "python manage.py syncdb"
>
> 4. Run "python manage.py runserver"
>
> 5. Go to the admin webpage to look at "jobs", and get this error. 
>
> Maybe I missed something? Or had the wrong order? Even if I repeat those 
> steps I get the same result. 
>
>>
>>
So, as Timothy says, you added since you originally ran syncdb.  The 
documentation[1] is clear that this doesn't work:
"Syncdb will not alter existing tables
syncdb will only create tables for models which have not yet been 
installed. It will never issue ALTER TABLE statements to match changes made 
to a model class after installation. Changes to model classes and database 
schemas often involve some form of ambiguity and, in those cases, Django 
would have to guess at the correct changes to make. There is a risk that 
critical data would be lost in the process.
If you have made changes to a model and wish to alter the database tables 
to match, use the sql command to display the new SQL structure and compare 
that to your existing table schema to work out the changes."

Or, as Timothy also said, use South.

 [1]:https://docs.djangoproject.com/en/1.3/ref/django-admin/#syncdb
--
DR.

-- 
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/-/gmtPdIXAu7sJ.
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: Working Hello World Ajax example via django pleeeease

2012-04-13 Thread Daniel Roseman
On Friday, 13 April 2012 08:08:19 UTC+1, Eli_West wrote:
>
> I've been attempting the most basic ajax call (.load()  )  through 
> django for over a month now - each time trying a different method or 
> tutorial none with success. Can someone post a working paradigm for 
> whatever django csrf, firefox, ect. workaround they use? 
>
> I can get jquery .load() to load content from an external file with 
> static files , no django. Same file served through django/templating 
> and the ajax is blocked. This is the general jquery call: 
>
> $(document).ready(function() { 
> $('.list').click(function () { 
> $('#message').load('namesinfo.htm li'); 
> return false; 
> }); 
> }); 
>
> To make things worse I found that Firefox/Chrome breaks Jquery's 
> sample 'Tabs: load content via ajax'  in the Themroller download. But 
> it works in IE :/. Same .load() calls occuring here. Just working w 
> static files no django. Could it be related to Firefox/Chrome? 
>
> I am pretty sure it is not: static file serving issues. I have heard 
> comments to follow django 'csrf / ajax' and included their sameOrgin 
> script to no avail. : 
>
> https://docs.djangoproject.com/en/dev/ref/contrib/csrf/ 
>
> A similar issue even though this guys solution is hard to understand: 
>
>
> http://stackoverflow.com/questions/6643242/jquery-load-not-working-in-django 
>
>  
The argument to `load` is the URL you want to load. If you want that to be 
served by Django, you need to pass in a URL that's handled by your Django 
urls.py. 'namesinfo.htm' seems unlikely to be a Django url.
--
DR.

-- 
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/-/3CzEsK5NobAJ.
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: DB queries at import time

2012-04-12 Thread Daniel Roseman
On Thursday, 12 April 2012 13:09:54 UTC+1, guettli wrote:
>
> Hi,
>
> sometimes it happens, that db queries get executed at import time (during 
> importing the file by the interpreter).
> That's waste of time a resources.
>
 
Why? Imports only happen the first time a process accesses a module. A 
process lasts for many requests.

 

> Is there a way to test how many queries get executing during import? I 
> want some automated way to detect these db queries.
>
> Example:
>
> def mychoices():
> for obj in MyModel.objects.all(): # this hits the db during import. 
> That's not good.
> 
>
> class MyForm(forms.Form):
>  foo=forms.ChoiceField(choices=mychoices())
>

The problem caused by this being executed at import time is not a "waste of 
time and resources", but the fact that if you add objects to MyModel, they 
won't appear in the MyForm.foo choices, until the process is restarted - 
which could be several days.
--
DR.

-- 
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/-/XwdAWoqNwv8J.
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 tutorial

2012-04-10 Thread Daniel Roseman
On Tuesday, 10 April 2012 22:15:40 UTC+1, Ed McLaughlin wrote:
>
> DATABASES = { 
> 'default': { 
> 'ENGINE': 'django.db.backends.sqlite3', # Add 
> 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. 
> 'NAME': '/usr/local/mysql/data/mysite',  # 
> Or path to database file if using sqlite3. 
> 'USER': '',  # Not used with sqlite3. 
> 'PASSWORD': '',  # Not used with sqlite3. 
> 'HOST': '',  # Set to empty string for 
> localhost. Not used with sqlite3. 
> 'PORT': '',  # Set to empty string for 
> default. Not used with sqlite3. 
> } 
> } 
>

You haven't given the path to a file in the NAME value, as requested - 
you've given the path to a directory.
--
DR.

-- 
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/-/R4t7qhr__mMJ.
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: Advice on installing Django in a fresh OSX Lion machine

2012-04-10 Thread Daniel Roseman
On Tuesday, 10 April 2012 00:00:32 UTC+1, Paulo wrote:
>
> So I follow your advice and did sudo easy_install pip and sudo pip install 
> virtualenvwrapper.
> Then I instaled homebrew and wget as mentioned in the site. And then I hit 
> the wall. 
> When I tried to python setup.py install --prefix=~/.local the return was a 
> error:
>
>>
>>>
Which bit of advice is this following? None of shacker's steps seem to 
involve running setup.py.
--
DR.

-- 
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/-/TXcIm9170jMJ.
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: superclass SingleObjectMixin

2012-04-07 Thread Daniel Roseman
On Saturday, 7 April 2012 16:40:05 UTC+1, Dave wrote:
>
> Hi, I need to manipulate my pk when using new class based views. In 
> order to DRY I think what's needed is to superclass SingleObjectMixin. 
>
> I have the following but it's not working. Greatly appreciate help/ 
> suggestions! 
>
> In view.py have the below which does not work. 
>
> from django.views.generic.detail import SingleObjectMixin 
> class SingleObjectMixin(SingleObjectMixin): 
>
> def get_object(self, *args, **kwargs): 
> queryset = self.get_queryset() 
> pk = pid_to_oid(self.kwargs.get('pk')) 
> queryset = queryset.filter(pk=pk) 
> obj = queryset.get() 
> return obj 
>
> return super(SingleObjectMixin,self).get_object(self, *args, 
> **kwargs) 
>
> from django.views.generic import ListView, DetailView 
>
> but if I do the below it works(but prefer to not have to add this to 
> each CBV). 
>
> class ItemDetailView(DetailView): 
> model=Item 
>
> def get_object(self): 
> queryset = self.get_queryset() 
> pk = pid_to_oid(self.kwargs.get('pk')) 
> queryset = queryset.filter(pk=pk) 
> obj = queryset.get() 
> return obj 
>
> Thanks in advance for the help. 
>
> Dave 
>
>
>
I'm not quite sure what you're trying to do here, especially in your use of 
"superclass" rather than the more normal "subclass". In any case, you can't 
simply subclass something but call your class the same name as the parent 
class and just expect all references to the superclass to be magically 
replaced by your class.

The thing I guess you're missing is that SingleObjectMixin is, well, a 
mixin. So you can just mix it in to your view class:

class ItemDetailView(MySingleObjectMixin, DetailView): 

and according to Python's rules of inheritance, it will find your 
get_object method in place of the original one.
--
DR.

-- 
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/-/oQkXKxxp7EkJ.
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: getting POST 500 (OK), when using $.ajax on that url

2012-04-01 Thread Daniel Roseman
On Saturday, 31 March 2012 23:23:26 UTC+1, Ahmad wrote:
>
> I trying to use jquery ajax to send json data to django
>
> sorry if providing javascript code but it may help solving my problem
> 
> $("#send").click(function() {
> events = $('#calendar').fullCalendar('clientEvents');
>console.log(events);
>var filter = new Array();
>filter[0] = 'start';
>filter[1] = 'end';
>filter[2] = 'title';
>events = JSON.stringify(events, filter, '\t');
>console.log(events);
>$.ajax({
>type: "POST",
>data: "events",
>url: ,
>});
> });
> _
>
> on chrome devtool every thing is ok until the last $.ajax()
>
> it throw this error
>
>
>1. POST   500 (OK)
>   1. 
> f.support.ajax.f.ajaxTransport.sendjquery-1.7.1.min.js:4
>   2. 
> f.extend.ajaxjquery-1.7.1.min.js:4
>   3. (anonymous function) 
>   4. 
> f.event.dispatchjquery-1.7.1.min.js:3
>   5. f.event.add.h.handle.i
>   
>
>
> so why am I getting 500 error, event I tried to use csrf_exempt or 
> disabling the csrf entirely but nothing changed
>
> If any one can figure out what I'm doing wrong please go ahead 
>
> thanks in advance
>
> Ahmad
>
>1. 
>
>

If that's your real code, you seem to be sending the string "events" as the 
POST data. Presumably you meant to send the contents of the variable events 
instead.
--
DR. 

>
>1.  
>
>

-- 
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/-/IyNt8bVGtN4J.
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: strange problem deleting objects

2012-03-29 Thread Daniel Roseman
On Thursday, 29 March 2012 00:06:29 UTC+1, Marc Aymerich wrote:
>
> Hi!,
> I've overrided the save() method of one of my ModelForms and I'm
> performing a delete of some related objects depending on some form
> fields values. The thing is I'm getting differents behaviours
> dependening on how the deletion is performed, consider:
>
> 1) self.instance.delete()
> 2) MyModel.objects.get(pk=self.instance.pk).delete()
>
> I'm listening the post_delete of self.instance class, in there I
> create a "dependency graph" of their related objects. The problem is
> that at some point I'm retriveing self.instance like:
> MyRelatedModel.self_instance_related_name and with the first (1)
> delete method I can still access to self.instance but with the second
> (2) delete method i'm getting a DoesNotExist.
>
> Why it's different?
>
> Thanks!
> -- 
> Marc
>

self.instance.delete() will delete the item from the database, but the 
instance itself will still exist in memory. As long as you don't save it, 
it will disappear when it goes out of scope, or you can explicitly call 
del() on it.
--
DR.

-- 
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/-/SBZb9WcCztsJ.
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: IntegrityError at /register/ auth_user.username may not be NULL

2012-03-28 Thread Daniel Roseman
On Wednesday, 28 March 2012 20:31:09 UTC+1, laurence Turpin wrote:
>
> I'm getting the following error with my registration  section of my 
> program. 
>
> IntegrityError at /register/ 
> auth_user.username may not be NULL 
>
> I am using django 1.3.1 and python 2.7.2 and I'm using sqlite3 as the 
> database. 
> I am a newbie and I'm learning Djanogo from the book "Learning website 
> development with Django" 
>
> The registration form is displayed ok  and I'm able to fill it out and 
> it is when I click register that the problem occurs. 
>
> ///
>  
>
>
> My views.py  looks like the following and register_page is the 
> relevant function here: 
>
> 
>
 

> def clean_username(self): 
> username = self.cleaned_data['username'] 
> if not re.search(r'^\w+$', username): 
> raise forms.ValidationError('Username can only contain 
> alphanumeric characters and underscores') 
> try: 
> User.objects.get(username=username) 
> except ObjectDoesNotExist: 
> return username 
> raise forms.ValidationError('Username already taken. ') 
>
 
Looks like you have an indentation problem in clean_username - the lines 
under the first "raise forms.ValidationError" should be one level to the 
left, otherwise they will never be reached and the method will never return 
the cleaned value for username.
--
DR.

-- 
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/-/sXr3JbbnrqcJ.
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: Looking for a developer who knows Django well

2012-03-27 Thread Daniel Roseman
On Tuesday, 27 March 2012 12:34:46 UTC+1, MSSONI wrote:
>
> I have just started a company. The company is yet to be registered. We 
> have launched our product www.instashare.me. Our alpha has just 
> launched. We are looking for passionate developers. Our salary will 
> range from 15-25k depending on the developers abilities.


Seems legit... No location, salary absurdly low even though it's not clear 
what currency we're talking about, no contact details. Yes, this must be a 
real startup.
--
DR.

-- 
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/-/Ijh5LE1YAdgJ.
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: User/UserProfile Queryset problem

2012-03-27 Thread Daniel Roseman
On Tuesday, 27 March 2012 02:15:04 UTC+1, bcrem wrote:
>
> Hello Django Nerds! 
>
> So I have a (somewhat) complicated lookup I'm trying to do; here's the 
> gist of it: 
>
>   1.  I have a Store class, with a User ManyToManyField, Store.users 
>   2.  I have a user profile class associated with each user, 
> UserProfile, accessible through the usual User.get_profile() 
>   3.  UserProfile has a status variable, UserProfile.status, which can 
> be 'Active', 'Inactive', or 'Deleted' 
>
> I'm trying to display a list of users for a particular store; 
> currently I generate this list using the following line: 
>
>userList = request.session['currentStore'].users.all() 
>
> Works great; however, now I'd like to filter out all users with a 
> status of 'Deleted'.  Now, if status were a User attribute, I could 
> just try this: 
>
>userList = 
> request.session['currentStore'].users.exclude(status=='Deleted') 
>
> or something similar. 
>
> THE PROBLEM:  How do I generate this no-deleted-users list for the 
> given store, using the ManyToManyField Store.users, but based on the 
> store.users UserProfile.status?  I know there's some kinky django 
> black magic reverse-lookup way to do it in a single magnificent 
> line...just haven't a clue what it might be.  Ideas? 
>
> First person with the right answer: thank you - please treat yourself 
> to a donut...


The session seems to be a red herring here. You're just doing a filter 
across a related field, which is done with the normal double-underscore 
syntax:

current_store.users.exclude(userprofile__status='Deleted')
--
DR.

-- 
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/-/sVcHJjNplGoJ.
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: Using _set.all in template when ForiegnKey is linked to Self

2012-03-22 Thread Daniel Roseman
On Thursday, 22 March 2012 01:12:21 UTC-7, Jam wrote:
>
> Hi All,
>
> I have a model where it can link to itself using ForeignKey('self'). This 
> is so I can have parent and child objects.
>
> I have called the parent and in the template I want to be able to access 
> all the child objects.
>
> I have been using the _set.all template command on the field but it 
> returns no results.
>
> Any ideas why this would happen? This is the first time I have used 
> ForeignKey('self') so I am a bit clueless.
>
> Thank you all
> Jamie
>

You'll need to be a bit more specific. Please show your model, and the 
exact template code you are using. 
--
DR.

-- 
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/-/484iTAEhTToJ.
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: Session resets - help me find the bug.

2012-03-21 Thread Daniel Roseman
On Wednesday, 21 March 2012 11:12:09 UTC-7, Daniel Sokolowski wrote:
>
> Hi All, 
>
> I have the following code: http://dpaste.com/719654/ for a session 
> based cart implementation I've created. I run into an odd bug/issue 
> that I can't figure out, when I create or retrieve the Cart instance 
> from session by hooking into __new__ class method my session gets 
> wiped or corruped I think, for example I get logged out of admin 
> howefver the cart contents seem to stick. Also the session key stays 
> the same as I have tested for that. But if I create the cart by 
> calling the Cart.get_cart(...) method all works as expected. 
>
> Any thoughts? I might have a bug somewhere else, and so second hand of 
> eyes helps. 
>
> Please note if you are using __new__ or get_cart uncomment either line 
> 78-79



Argh. I can't read that code at all. If you're posting code for feedback, 
please remove commented-out lines.

You shouldn't be overriding __new__ at all. There's almost never a reason 
to do this. Use __init__ instead.
--
DR.

-- 
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/-/u59qmdLinNQJ.
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: usage of url template tag

2012-03-21 Thread Daniel Roseman
On Wednesday, 21 March 2012 03:01:23 UTC-7, larry@gmail.com wrote:
>
>
> I'm very new to django. The rest of the URL comes from the index
> function in views.py. I wasn't sure if it violated the DRY principle
> to hardcode it.
>

Fine, but you can't reverse a URL that does not exist. If you tried to 
access "/report/faloom/EventLog/" in your browser, you would get a 404 
because you have no URLconf that matches it. So there's no point in 
outputting that URL in your template.
--
DR.

-- 
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/-/MpcZpiFzvCIJ.
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: usage of url template tag

2012-03-20 Thread Daniel Roseman
On Tuesday, 20 March 2012 15:27:27 UTC-7, larry@gmail.com wrote:
>
> I'm trying to generate a URL that looks something like this:
>
>
> /report/faloom/EventLog/?message=EventSearchString_ids=13_1=Tool_2=Time_3=Module_4=Message_preview=Generate+Report
>
> I have the values for the arguments (message, tool_ids, etc)  available to 
> me.
>
> My urlconf has:
>
> (r'^report/$', motor.ui.views.index)
>
> If I put this in my template:
>
> {% url motor.ui.views.index %}
>
> I get:
>
> /report/
>
> What do I use as arguments with the url tag to get the URL I want?
> I've tried many, many different things, but no matter what, I get a
> NoReverseMatch exception.
>

This question makes no sense at all. Your URL is just "/report/". You can 
add the  GET parameters manually, since they aren't matched in a URLconf, 
but where is the 'faloom/EventLog' bit supposed to be coming from? There is 
no URL that matches that.
--
DR. 

-- 
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/-/bynHvgPkDSwJ.
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: how to display development server page

2012-03-16 Thread Daniel Roseman
On Friday, 16 March 2012 22:23:43 UTC-7, Alex Glaros wrote:
>
> Newbie trying to run Django for the first time. 
>
> I'm using a hosted Linux server; I run python manage.py runserver, and 
> get: 
>
> Validating models... 
>
> 0 errors found 
> Django version 1.3.1, using settings 'alexSite.settings' 
> Development server is running at http://127.0.0.1:8000/ 
> Quit the server with CONTROL-C. 
>
> But my browser doesn't see anything at http://127.0.0.1:8000/ 
>
> Any hints?  Where is the page, on my PC or the hosted server? 
>
> Thanks, 
>
> Alex Glaros


The development server isn't meant to be run on a host. It's meant to be 
run on your development machine.

(You can make this work, but your life will be simpler if you install and 
run Django locally when in development).
--
DR.

-- 
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/-/3he_ZgLIx4kJ.
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: How can I print form errors from inside the test

2012-03-14 Thread Daniel Roseman
On Wednesday, 14 March 2012 16:43:12 UTC-7, somecallitblues wrote:
>
> Thanks Daniel and Karen,
>
> Karen, I;'m not entirely sure what an unbound form is. :)
>

Then you must not have read the documentation[1], which goes into great 
detail about bound and unbound forms. That's pretty much a prerequisite 
before asking for help, I'm afraid.
 

>
> Anyway, this is my test code:
>
> def test_appointment_form(self):
>
> c = Client()
>
> base_data = {
> 'name':'Foo name',
> 'slug':'foo-session',
> 'short_descr':'foo tagline',
> 'long_descr':'long foo description',
> 'staff':self.staff,
> 'business':self.business,
> 'start_date':'2012-07-24',
> 'end_date':'2012-07-24',
> }
> self.form = 
> AppointmentForm(business=self.business,staff=self.staff,initial=base_data)
>

As that documentation points out, `initial` does not bind the form.
 

> self.failUnless(self.form.is_valid()) #< This fails
>
> print self.form.errors #
> response = c.post('/console/appointments/add', {'form':self.form})
>

Not the cause of your current problem, but this makes no sense: you can't 
POST a form object.

 [1]: https://docs.djangoproject.com/en/1.3/topics/forms/#using-a-form-in-a-view

--
DR.


-- 
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/-/r8lcpGOgA5gJ.
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: Jquery .load() function not responding with django

2012-03-14 Thread Daniel Roseman
On Wednesday, 14 March 2012 09:21:29 UTC-7, Eli_West wrote:
>
> I've ran into in issue where jquery .load() will load extra content by 
> directly opening html file in a browser but if served through Django 
> devel server the jquery load() is ignored. Have no idea what could be 
> happening but I've seen someone use a django url in the .load() call 
> instead of pointing .load() directly to a file: 
>
>  
> $('.myClass').load('{% url update_dropdown %}', 
> {'kind': "Book" }, 
> function(data){ 
> alert(data); 
>  }); 
>
>  
>
> He said he saw issues with a jquery library Any thoughts would be 
> great. BTW not a static file serving issue. Here is the very simple 
> code that works w/o django, but same thing loaded through django 
> fails: 
>
>
> ///code from apress jquery, thanks to Bintu Harwani 
>
> basic jquery load function 
>
> $(document).ready(function() { 
> $('.list').click(function () { 
> $('#message').load('namesinfo.htm li'); 
> return false; 
> }); 
> }); 
>
>
> /basic html file 
>
>  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd;> 
>
> http://www.w3.org/1999/xhtml; xml:lang="en" lang="en"> 
>
>  
> JQuery Examples 
>  script> 
>