Your question can be solved using ideal factorization. If the norm you're looking for does not have extremely large prime factors in it, it's probably easiest to construct your ideal by multiplying ideals together of appropriate prime power norms. Hence, you'd want to find ideals of prime power norm, for given prime p:

```
sage: K.<a>=QuadraticField(2)
sage: OK=K.maximal_order()
sage: (5*OK).factor()
Fractional ideal (5)
sage: (7*OK).factor()
(Fractional ideal (-2*a + 1)) * (Fractional ideal (2*a + 1))
```

As you can see, 5 is inert, so norms of ideals can only have an even power of 5 in them. 7 on the other hand, splits, so you have two different choices for ideals of norm 7. You can multiply them together in all kinds of ways to make ideals with norm any power of 7.

This related question might help: