On October 27, 1995, Bruce Edward Wheeler, M.D. filed a pleading entitled “Petition Contesting Coroner’s Election”. Made defendants were Ralph Kelley, who received more votes than Dr. Wheeler in a coroner’s election held on October 21, 1995; Jerry Fowler, in his official capacity as Commissioner of Elections for the State of Louisiana; and W. Fox MeKeithen, in his official capacity as Secretary of State for the State of Louisiana. Both Wheeler and Kelley qualified as candidates for coroner in Union Parish, but only Wheeler is a licensed physician. Under the provisions of LSA-Const. Article V, Section 29, a parish coroner shall be a licensed physician unless no licensed physician will accept the office. Because Wheeler would accept the office, he claimed that Kelley could not assume the office of coroner. Accordingly, Wheeler sought a judgment declaring Kelley ineligible to hold or assume the office of coroner and declaring Wheeler to have been properly elected to the office of coroner.
Kelley filed Exceptions of No Right of Action, No Cause of Action, and Peremption, relying upon the provisions of LSA-R.S. 18:1405 requiring that an action objecting to the candidacy of a person be instituted within seven (7) days after the close of qualifications for the primary election. Similarly, the Commissioner of Elections filed an Exception of No Cause of Action, and, in the alternative, an exception of failure to join indispensable and/or necessary parties. Relying upon the provisions of Louisiana’s Election Code, the commissioner asserted that Wheeler’s petition failed to allege any of the grounds set forth in the Election Code to invalidate the election and declare Wheeler the winner. Alternatively, the commissioner alleged that Wheeler had failed to join as necessary and/or indispensable parties the appropriate governing authority in Union Parish charged with the responsibility of dealing with vacancies in the office of coroner.
| zAfter conducting a hearing on the petition, the trial court issued written reasons for judgment on November 1, 1995. The trial court stated that the issue raised by the exceptions was whether the court had the authority to invalidate the coroner’s election based on an objection to the qualifications of a candidate. Citing the seven day time limit for objecting to candidacy, found in both LSA-R.S. 18:1405 and 18:493, the court found that Dr. Wheeler failed to comply with the procedural mechanism for challenging the candidacy of Mr. Kelley, and concluded that the court was without authority to declare the election invalid at that time. The court also noted that although Dr. Wheeler had alleged there were “substantial irregularities” justifying the relief sought, Dr. Wheeler’s suit was not the vehicle to raise the issue. The court then sustained the exceptions and dismissed Wheeler’s petition. This appeal followed.
On appeal Dr. Wheeler states that he did not object to Mr. Kelley’s candidacy, and does not now object to Kelley’s qualifying as a candidate. Instead, Wheeler asserts that the Constitution prohibits Kelley from holding the office of coroner under the facts presented. Furthermore, he alleges that under the provisions of LSA-R.S. 18:1401(B), he can challenge the election on the basis that a substantial irregularity occurred when Kelley was allowed to run for the office of *561coroner despite the fact that Wheeler had qualified for the election.
DISCUSSION
Actions objecting to candidacy or contesting an election are subject to special procedural requirements in the Election Code. See LSA-R.S. 18:1401 et seq. Under the provisions of LSA-R.S. 18:1405, an objection to candidacy shall be instituted within seven (7) days after the close of qualifications for candidates in the primary election, while an action contesting any election involving election to office | sshall be instituted on or before the ninth day after the date of the election. To the extent that Dr. Wheeler’s action could be construed as one objecting to the candidacy of Mr. Kelley, such an action plainly is barred by the time constraints of Section 1405. Furthermore, we conclude that Dr. Wheeler’s challenge to Mr. Kelley’s qualifications does not come within the scope of “substantial irregularities” that would allow Wheeler to bring an action contesting the election. See Kelly v. Village of Greenwood, 363 So.2d 887 (La.1978); and LSA-R.S. 18:1432(A). Accordingly, we conclude that the trial court correctly sustained the exceptions filed to the extent that Dr. Wheeler’s action is one brought pursuant to the provisions of Chapter 9 of Louisiana’s Election Code.
On the other hand, the trial court not only sustained the exceptions, but dismissed the plaintiff’s petition, even though the trial court’s reasons for decision indicate that Dr. Wheeler’s substantive claim against Mr. Kelley might be raised through another procedural mechanism or vehicle. Under Louisiana’s procedural system of fact pleading, the “theory of the case” pleading has been suppressed, and with the exception of a default judgment, a final judgment shall grant the relief to which the party in whose favor it is rendered is entitled, even when the party has not demanded such relief in the pleadings. See LSA-C.C.P. Art. 862. Therefore, to the extent that Dr. Wheeler’s petition may state any cause of action against Mr. Kelley, the trial court should not dismiss that petition. To the contrary, even if the petition failed to state a cause of action, but the deficiency might be removed by amendment of the petition, the judgment sustaining the exception should order amendment rather than dismissal. See LSA-C.C.P. Art. 934.
Under the provisions of LSA-C.C.P. Art. 2164, an appellate court shall render any judgment which is just, legal, and proper upon the record on appeal. The ^purpose of this article is to give an appellate court complete freedom to do justice on the record irrespective of whether a particular legal point or theory was made, argued, or passed upon by the court below; Article 2164 insures that the “theory of the case” doctrine is not applicable to appeals under the Code of Civil Procedure. See Official Revision Comment (a) to Article 2164.
In the instant case, we conclude that the interest of justice would be better served by remanding the ease to the district court to consider both the procedural and substantive aspects of Dr. Wheeler’s claim that Mr. Kelley is constitutionally ineligible to assume or hold the office of coroner in Union Parish. Although Wheeler’s petition contains allegations broad enough to present this issue outside the scope of an “election suit”, and although the district court was aware that the issue might be raised outside the scope of "an “election suit” against proper party defendants, the issue was poorly developed and the procedural aspects virtually untouched in the trial court. We do no more than recognize that any action that Dr. Wheeler may have is not subject to the summary proceedings required in election contests, but may proceed via ordinaria. Such an action suggests itself to being the nature of an action for Quo Warranto, as exemplified by the provisions of LSA-R.S. 42:71 et seq. Accordingly, we hereby remand this matter to the district court for further proceedings in accordance with this opinion.
DECREE
We affirm the sustaining of the exceptions of the partial no cause of action only insofar as the petitioner seeks relief under the Election Code, La.R.S. Title 18. We reverse the judgment insofar as it sustains the exceptions of no cause of action and dismisses *562plaintiffs action to contest the constitutional eligibility of the defendant Ralph Kelley to assume or hold the office of coroner. We remand to | sallow plaintiff to join proper parties defendant and amend, if necessary, his petition in accord with C.C.P. Art. 934. Costs shall be divided equally between Wheeler and Kelley.
AFFIRMED IN PART; REVERSED IN PART; REMANDED.