Login

Snippets by sebnapi

Snippet List

add port from settings file to an url

I'm working on a Project where on certain places I need absolute URL's, in development mode I need the port 8000 added to any absolute url. This piece of work, took me some time to figure out. Couldn't find something similiar on the net, it's based on Code from the Python urlparse module. You can change the "settings.PORT" part to "settings.DEBUG == True" if you like, and so on. META: replace parameters in URL, edit parameters in URL, edit URL, urlparse

  • url
  • urlparse
  • port
  • replace-parameters-in-url
  • urlsplit
Read More

Handles Inline Formsets and also "in-standard-way" normal forms

If you read the docstring and the example you should get a clue what this Code does. I didn't want a big function everytime that handles every specific form, formset combinations so this how i can add/edit Models with specific Forms given to the magic_handle_inlineformsets function. It also works for Forms without innline_formsets.

  • forms
  • formset
  • inline
  • inlineformset
  • inline_formset
Read More

sebnapi has posted 2 snippets.