Discriminant of a binary quadratic form and an order of a quadratic number field

Let $ax^2 + bxy + cy^2$ be a binary quadratic form over $\mathbb{Z}$.
Let $D = b^2 – 4ac$ be its discriminant.
It is easy to see that $D \equiv 0$ (mod $4$) or $D \equiv 1$ (mod $4$).

Conversely suppose $D$ is a non-square integer such that $D \equiv 0$ (mod $4$) or $D \equiv 1$ (mod $4$). Then there exists the principal form of discriminant $D$(see this question).

Let $K$ be an algebraic number field of degree $n$.
An order of $K$ is a subring $R$ of $K$ such that $R$ is a free $\mathbb{Z}$-module of rank $n$.
Let $\alpha_1, \cdots, \alpha_n$ be a basis of $R$ as a $\mathbb{Z}$-module.
Let $d = det(Tr_{K/\mathbb{Q}}(\alpha_i\alpha_j))$.
It is easy to see that $d$ is independent of a choice of a basis of $R$.
We call $d$ the discriminant of $R$.

Is the following proposition true?
If yes, how do we prove it?

Proposition
Let $D$ be a non-square integer such that $D \equiv 0$ (mod $4$) or $D \equiv 1$ (mod $4$).
Then there exists an order $R$ of a quadratic number field $K$ such that the discriminant of $R$ is $D$.
$K$ and $R$ are uniquely determined by $D$.

Conversely let $R$ be an order of a quadratic number field $K$.
Let $D$ be the discriminant of $R$.
Then $D$ is a non-square integer such that $D \equiv 0$ (mod $4$) or $D \equiv 1$ (mod $4$).

Solutions Collecting From Web of "Discriminant of a binary quadratic form and an order of a quadratic number field"

By my answer to this question, $D$ can be written uniquely as $D = f^2 d$, where $f \gt 0$ is an integer and $d$ is the discriminant of a unique quadratic number field $K$.
By my answer to this question, there exists a unique order $R$ of $K$ such that $f$ is the order of the group $\mathcal{O}_K/R$ and its discriminant is $D = f^2d$.

It remains to prove the last assertion.
Let $1, \omega$ be the canonical integral basis of $K$(see the definition in my answer to this question).
Let $f$ be the order of the group $\mathcal{O}_K/R$.
By my answer to this question, $D = f^2 d$.
By Lemma 8 in my answer to this question, $d$ is a non-square integer.
Hence $D$ is a non-square integer.
By Lemma 7 in my answer to this question, $d \equiv 0$ (mod $4$) or $d \equiv 1$ (mod $4$).
Since $f^2 \equiv 0$ (mod $4$) or $f^2 \equiv 1$ (mod $4$), $D \equiv 0$ (mod $4$) or $D \equiv 1$ (mod $4$) as desired.