Brian The short answer is: you need to create a form where you input * no. of dice * no. of sides and then process that POSTed data.
The longer answer is <gentleness_mode_on> that you seem to be confused about a number of basic concepts on Django and web apps. I'd recommend working through The Django Book; Chapter 7 on Forms (http:// www.djangobook.com/en/2.0/chapter07/) has some examples you could adapt for your specific problem. But, you *really* need to start from Chapter 1 so you have grasped the core concepts. I speak from personal experience - its an excellent read.<gentleness_mode_off> Hope this helps! Derek On Dec 6, 3:48 pm, Brian Callies <br...@gibbous.org> wrote: > Good Day, > > As a part of a project I want to create a single page that has a number > of different utilities on it. One of those is a dice roller. Ultimately > I'd like to be able to type in the number of dice and number of sides, > click a button, and return the result on the page. > > I understand you cannot pass arguments from a template without creating > custom tags (I think). So, ignore that aspect for now. > > For now, if someone could just point me in the right direction on how to > call a method from a template and return a result. > > Do I want to create a view as such (assume I have a Class for making > dice rolls): > > def Dice_Roll(request): > roll = Roll(3, 8) > total = roll.output() > return render_to_response('utils/diceroll.html', {'total': total}) > > And call it from the template? > Or, am I going about this all wrong since this page doesn't have dynamic > or database data? Would a static HTML page work better? > > Ah-ha! I see I should use Flatpages, most likely. But, I'm not sure that > solves my problem since it would still use templates and would still > have to call a method. > > Thanks, and hope this wasn't too rambling, > Brian -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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.