Firstly, the Artinian ring $\mathcal O_k/(q)$ can be written as a finite product $\prod R_i$ of local Artinian rings, and one easily checks that $\mathcal O_k/(q)$ is a principal ideal ring if and only if each $R_i$ is.

You somehow need to use the fact that $\mathcal O_K$ is a regular ring of dimension $1$; for higher-dimensional rings the corresponding statement is false; e.g. $R = k[x,y]/(x^2,xy,y^2)$ is not a principal ideal ring.

**Lemma.** Let $(R,\mathfrak m)$ be a local Artinian ring such that $\dim_{R/\mathfrak m} \mathfrak m/\mathfrak m^2 = 1$. Then $R$ is a principal ideal ring.

*Proof.* Note that $\mathfrak m$ is principal by Nakayama's lemma, since $\dim \mathfrak m/\mathfrak m^2 = 1$. If $\mathfrak m = (\pi)$, then $\mathfrak m^n = (\pi^n)$, so $\dim \mathfrak m^n/\mathfrak m^{n+1} \leq 1$. If this dimension is $0$, then Nakayama's lemma implies that $\mathfrak m^n = 0$. It suffices to show that the only ideals are the $\mathfrak m^n$.

There exists $n_0 \in \mathbb Z_{>0}$ such that $\mathfrak m^n = 0$ if and only if $n \geq n_0$. Thus, we have a filtration
$$0 = \mathfrak m^{n_0} \subsetneq \mathfrak m^{n_0-1} \subsetneq \ldots \subsetneq \mathfrak m \subsetneq R.$$
Since each of the successive subquotients is one-dimensional, we conclude that $\ell(\mathfrak m^n) = n_0-n$ for each $n \in \{0,\ldots,n_0\}$. Moreover, the $R$-module $\mathfrak m^n$ is principal and killed by $\mathfrak m^{n_0-n}$, hence a length computation shows that the surjection $R/\mathfrak m^{n_0-n} \to \mathfrak m^n$ given by $1 \mapsto \pi^n$ is an isomorphism of $R$-modules.

Let $I \subseteq R$ be any ideal, and let $c = \ell(R/I)$ be the colength of $I$. We prove by induction on $c$ that $I = \mathfrak m^c$. The case $c = 0$ is clear. If $c > 0$, then $I \subsetneq R$, so $I \subseteq \mathfrak m$. Because $\mathfrak m \cong R/\mathfrak m^{n_0-1}$, the submodule $I \subseteq \mathfrak m$ corresponds to a submodule $J \subseteq R/\mathfrak m^{n_0-1}$ of colength $c-1$. By the induction hypothesis, we know that $J = \mathfrak m^{c-1}$, hence $I = \mathfrak m^{c-1} \mathfrak m = \mathfrak m^c$, as claimed. $\square$