Search Results

Search found 31606 results on 1265 pages for 'generate table'.

Page 22/1265 | < Previous Page | 18 19 20 21 22 23 24 25 26 27 28 29  | Next Page >

  • Django Multi-Table Inheritance VS Specifying Explicit OneToOne Relationship in Models

    - by chefsmart
    Hope all this makes sense :) I'll clarify via comments if necessary. Also, I am experimenting using bold text in this question, and will edit it out if I (or you) find it distracting. With that out of the way... Using django.contrib.auth gives us User and Group, among other useful things that I can't do without (like basic messaging). In my app I have several different types of users. A user can be of only one type. That would easily be handled by groups, with a little extra care. However, these different users are related to each other in hierarchies / relationships. Let's take a look at these users: - Principals - "top level" users Administrators - each administrator reports to a Principal Coordinators - each coordinator reports to an Administrator Apart from these there are other user types that are not directly related, but may get related later on. For example, "Company" is another type of user, and can have various "Products", and products may be supervised by a "Coordinator". "Buyer" is another kind of user that may buy products. Now all these users have various other attributes, some of which are common to all types of users and some of which are distinct only to one user type. For example, all types of users have to have an address. On the other hand, only the Principal user belongs to a "BranchOffice". Another point, which was stated above, is that a User can only ever be of one type. The app also needs to keep track of who created and/or modified Principals, Administrators, Coordinators, Companies, Products etc. (So that's two more links to the User model.) In this scenario, is it a good idea to use Django's multi-table inheritance as follows: - from django.contrib.auth.models import User class Principal(User): # # # branchoffice = models.ForeignKey(BranchOffice) landline = models.CharField(blank=True, max_length=20) mobile = models.CharField(blank=True, max_length=20) created_by = models.ForeignKey(User, editable=False, blank=True, related_name="principalcreator") modified_by = models.ForeignKey(User, editable=False, blank=True, related_name="principalmodifier") # # # Or should I go about doing it like this: - class Principal(models.Model): # # # user = models.OneToOneField(User, blank=True) branchoffice = models.ForeignKey(BranchOffice) landline = models.CharField(blank=True, max_length=20) mobile = models.CharField(blank=True, max_length=20) created_by = models.ForeignKey(User, editable=False, blank=True, related_name="principalcreator") modified_by = models.ForeignKey(User, editable=False, blank=True, related_name="principalmodifier") # # # Please keep in mind that there are other user types that are related via foreign keys, for example: - class Administrator(models.Model): # # # principal = models.ForeignKey(Principal, help_text="The supervising principal for this Administrator") user = models.OneToOneField(User, blank=True) province = models.ForeignKey( Province) landline = models.CharField(blank=True, max_length=20) mobile = models.CharField(blank=True, max_length=20) created_by = models.ForeignKey(User, editable=False, blank=True, related_name="administratorcreator") modified_by = models.ForeignKey(User, editable=False, blank=True, related_name="administratormodifier") I am aware that Django does use a one-to-one relationship for multi-table inheritance behind the scenes. I am just not qualified enough to decide which is a more sound approach.

    Read the article

  • Table cell stretching

    - by Subrat
    I have two columns in my table with equal width(50%, 50%). I am showing search results URL in them. For big urls the columns are stretching and destroying the layout. Any suggestion to the problem? Thanks & Regards, Subrat.

    Read the article

  • jQuery Table - Reference User Input Row Names and Values

    - by Vic
    I have several tables which are generated by another application, which I have no control over. I am totally new to jQuery and ajax, and have only a limited knowledge of jsp. Two sample rows are: <table class="sicknessForm"> <tr id="row_0" class="datarow"> <td id="col_2"><input name="row_0-col_2" class="tabcell" value="Injuries"></td> <td id="col_4"><input name="row_0-col_4" class="tabcell" value="01"></td> <td id="col_5"><input name="row_0-col_5" class="tabcell" value="2"></td> <td id="col_6"><input name="row_0-col_6" class="tabcell" value="5"></td> </tr> <tr id="row_1" class="datarow"> <td id="col_2"><input name="row_1-col_2" class="tabcell" value="Absences"></td> <td id="col_4"><input name="row_1-col_4" class="tabcell" value="100"></td> <td id="col_5"><input name="row_1-col_5" class="tabcell" value="102"></td> <td id="col_6"><input name="row_1-col_6" class="tabcell" value="105"></td> </tr> </table> There are more rows and columns in the actual tables. What I need to do is to pass the ordered row information to the database, e.g.: Injuries, 1, 2, 5 .... Absences 100, 102, 105... I can retrieve the values for each input using: $('#SicknessForm .userInput').each(function() { alert($(this).val()); }); 1) How can I loop through each row, get the value from the first column (Injuries) and place the data into an array to send to the server? 2) How do I reference the first row of each column to disable user input on it? $(:HowDoIReferenceThis).attr('disabled', ''); 3) I need to validate that each cell is numeric, other than the first column. Any pointers on this (otherwise I can check it in my servlet), especially on how to loop through all valid input cells (everything except 'Injuries','Abences', ... cells). Many Thanks! Vic

    Read the article

  • Table Template with Rich UI

    - by sahs
    Hello, I'm trying to find a html (or maybe flash) table template with rich ui features. I googled it, but couldn't find something that has a rich ui, also looked through jquery, still no luck. Before going any deeper search, I believe someone may have suggestions for me. Thanks.

    Read the article

  • php/html add link to table <TD>

    - by Stefan
    How can i add a link to my td tag from a table? onclick doesnt work for me :S, or maybe a good example :P my td tag: $world .= ('<td background="images/world/Heli.jpg" border="1"></td>'); link: <a href="?site=world&action=showvillage&id=' . getVillageID(($xm2), ($ym2)) . '"></a> thnx :D

    Read the article

  • How to convert a table column to another data type

    - by holden
    I have a column with the type of Varchar in my Postgres database which I meant to be integers... and now I want to change them, unfortunately this doesn't seem to work using my rails migration. change_column :table1, :columnB, :integer So I tried doing this: execute 'ALTER TABLE "table1" ALTER COLUMN "columnB" TYPE integer USING CAST(columnB AS INTEGER)' but cast doesn't work in this instance because some of the column are null... any ideas?

    Read the article

  • How to link to specific anchor in table with jquery

    - by LisaH
    I am using this jquery plugin: http://www.jankoatwarpspeed.com/post/2009/07/20/Expand-table-rows-with-jQuery-jExpand-plugin.aspx I have anchors in the code such as: <a name="art" id="art2"></a> Articles How can I open that particular row then? In other words, when a user clicks a link from another page to this landing page I would like the appropriate row to open up based on the anchor tag. Thanks in advance!

    Read the article

  • How to dynamically show/hide rows in a table

    - by pradeep
    I'm working on a website where I need to show/hide table rows. I got the feature working, but the CSS gets bad when I do show. I'm providing a working link; click the 'More...' link and see the action for an example. I'm using jQuery's toggle(slow) for hiding and showing

    Read the article

  • Convert file to html table with PERL

    - by user329313
    Hi everyone, I am trying to write a simple Perl CGI script that: -runs a CLI script -reads the resulting .out file and converts the data in the file to an HTML table. Here is some sample data from the .out file: 10.255.202.1 2472327594 1720341 10.255.202.21 2161941840 1484352 10.255.200.0 1642646268 1163742 10.255.200.96 1489876452 1023546 10.255.200.26 1289738466 927513 10.255.202.18 1028316222 706959 10.255.200.36 955477836 703926 Any help would be much appreciated. -Sebastian

    Read the article

  • GWT: Getting events in a button in a panel used as a Table cell

    - by mjeffw
    I'm using GWT 1.6. I am creating a panel that contains a Button and a Label, which I then add to a FlexTable as one of its cells. The Button is not receiving any Click events. I see that the table supports determining which Cell is clicked on, but in this case, I want the Mouse events to propagate to the various widgets inside the cell. Any idea on how to do that?

    Read the article

  • MySQL friends table

    - by asmo
    I have a MySQL DB in which I store data about each user. I would like to add a list of friends for each user. Should I create a table of friends for each user in the DB or is there a better way?

    Read the article

  • TSQL Writing into a Temporary Table from Dynamic SQL

    - by Jeff
    Consider the following code: SET @SQL1 = 'SELECT * INTO #temp WHERE ...' exec(@SQL1) SELECT * from #temp (this line throws an error that #temp doesn't exist) Apparently this is because the exec command spins off a separate session and #temp is local to that session. I can use a global temporary table ##temp, but then I have to come up with a naming scheme to avoid collisions. What do you all recommend?

    Read the article

< Previous Page | 18 19 20 21 22 23 24 25 26 27 28 29  | Next Page >