You are not logged in.

Change Language:

Profile for angelo_bixly

Name angelo_bixly
Email Address n/a
Posts7
  • Re: Tag for returning url
    Board » Django » Templates
    You can use this template tag: {{ request.get_full_path }}

    This will display the urls segments after www.example.com/ Cheers!

    Brought to you by Bixly Dev Angelo. http://bixly.com
  • Re: TemplateSyntaxError at /user/myuser/
    Board » Django » Templates
    Your endfor tag looks like this {% endfor %> . Change it to {% endfor %}. Cheers!

    Brought to you by Bixly Dev. Angelo. http://bixly.com
  • Re: TypeError: 'str' object is not callable
    Board » Django » Views
    Change this line if request.method() == 'POST':

    to

    if request.method == 'POST':

    Brought to you by Bixly Dev Angelo. http://bixly.com
  • Re: Working with django and template with css and web 2.0
    Board » Django » Templates
    You can read about Django templates here:
    https://docs.djangoproject.com/en/dev/ref/templates/builtins/?from=olddocs
    http://www.djangobook.com/en/beta/chapter04/

    You should understand first the templating system of Django before you apply CSS, JS and other stuff to make things easier for you.

    For applying the CSS and other things you will use in your project, you can try these steps:

    1. open your settings.py and

    -add this at the first line of your file:

    import os.path


    -change your STATIC_ROOT's value to:

    STATIC_ROOT = os.path.join(PROJECT_DIR, 'static/')

    -change your STATIC_URL's value to:

    STATIC_URL = '/static/'


    2. create a folder named "static" in your project root.
    3. create a folder for your static files like css, javascript and etc. I recommend you use a different folder for different types of files.
    4. open the urls.py of your project
    -add this to your imports: import settings
    -add this to the url patterns:

    (r'(?:.*?/)?(?P<path>(css|jquery|jscripts|images)/.+)$', 'django.views.static.serve', {'document_root': settings.STATIC_ROOT }),

    NOTE: In this example, there are folders named css, jquery, jscripts and images inside my static folder.


    5. In your template add this:

    for css files: (in this example, default.css is the name of the css file)

    <link href="/{{ STATIC_ROOT }}css/default.css" rel="stylesheet" type="text/css" media="all" />

    for javascript:

    <script type="text/javascript" src="/{{ STATIC_ROOT }}jquery/jquery.js"></script>


    Now for the templates that you downloaded, just edit the parts in the templates where you want the data to be rendered.

    Brought to you by Bixly Dev Angelo. http://bixly.com
  • Re: Change in Fields is not synced with DB
    Board » Django » Models
    Django does not modify database fields when you do a syncdb. But you can:
    -edit the table in your database
    -use django migration tools such as SOUTH and dmigrations. NOTE: dmigrations is for mysql only
    -delete/drop the tables related to the model that has changes and syncdb it again.

    Brought to you by Bixly Dev Angelo. http://bixly.com
  • Re: user authentication for every page
    Board » Django » Views
    You need to setup Django decorators and setup the settings for it to work. Here is a link for Django Decorators https://docs.djangoproject.com/en/dev/topics/http/decorators/

    Add these to your settings.py:

    LOGIN_URL = '/login/'
    LOGIN_REDIRECT_URL = '/homepage/'

    Just change the values according to your specifications. (/login/ and /homepage/ are URLs).

    Brought to you by Bixly Dev Angelo. http://bixly.com
  • Re: clean methods for validation
    Board » Django » Views
    How about trying:

    def clean_Password(self):
    upass=self.cleaned_data['Password']
    uname = self.cleaned_data['Username'] # to get the username value


    Brought to you by Bixly Dev Angelo. http://bixly.com

    --- Last Edited by angelo_bixly at 2012-01-25 03:21:01 ---

    --- Last Edited by angelo_bixly at 2012-01-25 03:22:04 ---


Powered by Sphene Community Tools