sorry, change userdata = UserData.objects.filter(userid=1) to userdata = UserData.objects.filter(id=userid)
On Wed, Sep 26, 2012 at 12:15 AM, Amyth Arora <aroras.offic...@gmail.com>wrote: > What do you mean by generating a Static HTML page for each user? > > From what i understand you can simply have a profile layout's html > template and use simple template tags to retrieve user data. > > For example: > > 1. Define a UserData class in your models.py that will basically store all > the user data. > 2. Then in Views.py create a view that uses a username or user id to get > data, something like this: > > #imports > from models import UserData > > > def user_profile(request, userid): > userdata = UserData.objects.filter(userid=1) > return render_to_response('profile.html', {'userdata': userdata}, > context_instance=RequestContext(request)) > > 3. You can use named > groups<https://docs.djangoproject.com/en/dev/topics/http/urls/#named-groups> > to > pass the userid to the view. Something like this, > > urlpatterns += patterns('', > (r'^users/(?P<userid>.+?)/$', 'views.user_profile'), > ) > > 4. Then in the template you can use for loop template tag like > > {% if userdata %} > <h1>userdata.username</h1> > <table> > <tr> > <td>Example Field:</td> > <td>userdata.example_field</td> > <tr> > <table> > {% endif %} > > > > > > On Tue, Sep 25, 2012 at 11:44 PM, bruce <brucehar...@gmail.com> wrote: > >> God. The original subject is too long. >> I made the Subject shorter. >> >> Thanks, >> Bruce >> >> >> >> >> >> On Tuesday, September 25, 2012 2:11:45 PM UTC-4, bruce wrote: >>> >>> Dear All, >>> >>> I am a novice. >>> Currently, >>> I am thinking to build a simple static personal web page generator for >>> the people in my group. So, they can login my django powered site and input >>> their info, such as name, title, photo, education background and etc. Then, >>> the person's static web page will be generated automatically. I know I can >>> use some advanced tools, such as DreamWeaver and frontpage editor, to get >>> it done. However, I prefer to use my freshly learned knowledge to build a >>> cms-like site to automatically generate the static web pages. >>> >>> Currently, the site has been done. But I am stuck with a new problem. >>> The static web page doesn't have HTML tables. >>> For example, person A need a table(5 rows x 3 columns), person B needs a >>> table(2 rows x 2 columns). >>> >>> do you have any suggestion? >>> What kind of topic should I go to google? >>> or, do you have any recommendation? django-cms? >>> >>> Thanks All! >>> Bruce >>> >>> >>> >>> >>> >>> -- >> 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/-/r7or5qkzDaIJ. >> >> 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. >> > > > > -- > Thanks & Regards > ---------------------------- > > Amyth [Admin - Techstricks] > Email - aroras.offic...@gmail.com, ad...@techstricks.com > Twitter - @mytharora > http://techstricks.com/ > -- Thanks & Regards ---------------------------- Amyth [Admin - Techstricks] Email - aroras.offic...@gmail.com, ad...@techstricks.com Twitter - @mytharora http://techstricks.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.