Geometric quantization and constraints in field theory