Posts

Django login redirect_field_name 'next' forces new session

Image
0 I'm building an e-commerce website, I enable guest users to add products to their carts saving the cart_id in session and when they proceed to checkout, I redirect them to login as follows inside the checkout view if not request.user.is_authenticated: login_url = reverse('accounts:login') check_out_url = reverse('cart:checkout') redirect_url = "{}?next={}".format(login_url, check_out_url) return redirect(redirect_url) # checkout process here It works, however the cart_id is no longer in the session. If I don't use the next parameter and just redirect to login_url the cart_id stays in session. P.S: Same thing happens with login_required_decorator Is there a way to keep the session data intact ? django d...

Prescribed set of continuous functions

Image
3 Given two sets $X$ , $Y$ and a set of functions $F subset Y^X$ such that every constant function from $X$ to $Y$ is in $F$ . Question: Are there topologies on $X$ and $Y$ such that the set $C(X,Y)$ of continuous function is equal to $F$ ? It is clear that it suffices to find a suitable topology on $Y$ and then take the initial topology on $X$ with respect to all functions in $F$ . In general, if we take any topology on $Y$ and initial topology on $X$ with respect to all functions in $F$ , we will get $F subset C(X,Y)$ . But in many cases we are not able to conclude equality, e.g. if $card(X) = card(Y)$ , $F neq Y^X$ but contains some bijective function and Y carries the discrete topology, we will get as initial topology on X again the discrete topology and therefore we have that $C(X,Y) = Y^X neq F$ ....