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!!
Bruce

  



  





On Tuesday, September 25, 2012 4:15:25 PM UTC-4, ke1g wrote:
>
> 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. 
>
> On Tue, Sep 25, 2012 at 3:22 PM, bruce <bruce...@gmail.com <javascript:>> 
> wrote: 
> > 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 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > On Tuesday, September 25, 2012 2:46:21 PM UTC-4, Amyth 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 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 <bruce...@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...@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/ 
> > 
> > -- 
> > 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/-/JoXemRfP_f4J. 
> > 
> > To post to this group, send email to 
> > django...@googlegroups.com<javascript:>. 
>
> > To unsubscribe from this group, send email to 
> > django-users...@googlegroups.com <javascript:>. 
> > For more options, visit this group at 
> > http://groups.google.com/group/django-users?hl=en. 
>

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

Reply via email to