[need advice and suggestion] questions about generating static web page.

34 views
Skip to first unread message

bruce

unread,
Sep 25, 2012, 2:11:45 PM9/25/12
to django...@googlegroups.com
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





bruce

unread,
Sep 25, 2012, 2:14:33 PM9/25/12
to django...@googlegroups.com
God. The original subject is too long.
I made the Subject shorter.

Thanks,
Bruce

Amyth Arora

unread,
Sep 25, 2012, 2:45:43 PM9/25/12
to django...@googlegroups.com
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 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 %}
--
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...@googlegroups.com.
To unsubscribe from this group, send email to django-users...@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....@gmail.com, ad...@techstricks.com
Twitter - @mytharora
http://techstricks.com/

Amyth Arora

unread,
Sep 25, 2012, 2:48:55 PM9/25/12
to django...@googlegroups.com
sorry, change    userdata = UserData.objects.filter(userid=1)  to    userdata = UserData.objects.filter(id=userid) 

Bill Freeman

unread,
Sep 25, 2012, 3:02:06 PM9/25/12
to django...@googlegroups.com
It sounds a bit like you want a profile app. It's model holds those
things beyond what is already in auth User, which could include one or
more text fields, perhaps using TinyMCE or markdown. There is
plumbing in Django whereby if you specify such a model in settings.py
it will get attached OneToOne to the User instance, and both provide
means for getting from one to the other. You can create custom views
to, for example, list users by name, with office and phone columns,
assuming that you defined such fields in the Profile model. See:

https://docs.djangoproject.com/en/1.4/topics/auth/#storing-additional-information-about-users

bruce

unread,
Sep 25, 2012, 3:22:04 PM9/25/12
to django...@googlegroups.com
Thanks!!
Yes. This is exact what I did.
Actually, I finish this in the admin template.
But my question is:
the template may contain some tables.
These tables may have different number of rows and columns.


so, in the model,
there will be an additional class mytable.
mytable should contain the number of rows and columns. mytable also needs to contain the content to fill the table.
is there an existing modules for the table? How can I implement to allow the template show different size of tables.

Thanks,
Ming

Bill Freeman

unread,
Sep 25, 2012, 4:14:40 PM9/25/12
to django...@googlegroups.com
I, and probably others, would need a more detailed description of
these tables and how they are to be used, before we could offer help
on them.
> https://groups.google.com/d/msg/django-users/-/JoXemRfP_f4J.

bruce

unread,
Sep 25, 2012, 5:12:22 PM9/25/12
to django...@googlegroups.com
Thanks very much!
Let me post the class in my models.py

so, in the models.py, there are three classes: person, section and item.
a person has several sections. each section contains several items.

class Person
       ......

class Section(models.Model):
    person = models.ForeignKey(Person)
    section_headings = models.CharField(blank=True,max_length=100)
    ......(also contains some fields for sorting and etc.)

 
class Item(models.Model):
    section = models.ForeignKey(Section)
    item_text = models.TextField()
    .......(also contains some fields for sorting and etc.)

The item is pretty simple.
but if I am going to create a html table. what I can do.
One way I can image is:
I am going to add a new class named Table.

class Table(models.Model):
       section = models.ForeignKey(Section)

class Row(models.Model):
        table = models.ForeignKey(Table).
        ......

class Cell(models.Model):
        row = models.ForeignKey(Row)
        .........


Do you think is there any better way to do this?

Thanks!!

Ezequiel

unread,
Sep 25, 2012, 5:17:42 PM9/25/12
to django...@googlegroups.com
On Tuesday, September 25, 2012 3:11:45 PM UTC-3, 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 

Bruce, take a look to http://nikola.ralsina.com.ar/

Ezequiel.
Reply all
Reply to author
Forward
Message has been deleted
0 new messages