Python : Can I do front end of django project using HTML / CSS? - python

Hi I am totally new to web development frameworks .I am currently learning python and django from the Django project tutorial..
My (rather dumb) question is when I am done with the small "poll" website will I be able to modify the front end of this project using HTML/CSS ?
Also, should I use tools like Dreamweaver to do that ? or are there other ways ?

Of course you will be able. That is the point of the web frameworks to let you build the whole application including frontend.
You'll get it all once you finish the tutorial. You'll see that Django has very nice templating language that allows you to build a html page according to data you get from your application.
<h1>{{ section.title }}</h1>
This result in normal HTML page in the end. And of course you can write any kind of CSS for those pages to get whatever look for your page you like.

Yes you can, you'll need to edit the templates in the location specified by TEMPLATE_DIRS. The templates are just html mixed with some python code to fill the content.

Related

Limit scope of external css to only a specific page?

I am creating a django project using HTML5, and CSS,.
while extending the base.html to other files ,when I load in a new css file, it (obviously) overrides the one I'm using to style the page, and therefore most of the elements are affected like a tag and others. so is there Limit scope of external css to only a specific file.?
Please tell me some solution i am a beginner and i am frustrated by this

How to create a fillable and savable pop-up form in a Django project?

How do I trigger a fillable pop-up form when the user clicks on an image, on a Django web app that then winds up sorting the following result ?
I couldn't find a solution to that on other websites. Is this something that can be done solely with HTML, CSS, and JS, or do I have to use python to then save the data to the SQLite database?
If someone can suggest or hint at the steps that I need to follow to get this done I would really appreciate it.
okay for the Popup you need some JS. For the Data of the Popup you have two options
If the Data is static for this page you can add it in the Django template
If its dynamic (it depends on user input at this page) you have to load it as a JSON and display it with JS (for example with Django-Rest Framework

Wagtail - extending PageChooserBlock to support external URLs

I'm building a site with Wagtail and using StreamField to build up content on a homepage. I've built a block that allows users to add featured links, which could be internal or external links. Currently the featured links have both a PageChooserBlock and a URLBlock, but I'd like to add a new custom block type that allows a user to specify either an internal page or a URL. I can't see anything in the docs that would help me. Any ideas where to start?
This is nothing Wagtail supports yet, but there's a lot of interest in this feature, see issue https://github.com/wagtail/wagtail/issues/3141.
To solve this there is a pull request work in progress (see https://github.com/wagtail/wagtail/pull/1645) that aims to unify link choosers.
Maybe you are able to contribute, I'm sure this would be very welcome!
you can use this library: https://pypi.org/project/wagtail-link-block/
From the docs:
"A link block to use as part of other StructBlocks which lets the user choose a link either to a Page, Document, or external URL, and whether or not they want the link to open in a new window."

Add a custom link to hudson project page

I'm using Hudson to generate the documentation for a Python project using Sphinx. This generates HTML documentation in the folder project/_build/html, which I set up to be used as an build artifact. Now after running the job, I can navigate to the documentation by clicking on the "Artifacts" link, then on the folder, and then on the index.html file. That's a bit cumbersome so I would like to customize the project page so I can have a "View Documentation" link that takes me straight to the index.html file. Is there any way to do that with hudson?
I know the question is closed, but I thought you could try this. You don't need a separate http server just to serve HTML documentation, artifact or not. You can use the plugin:
http://wiki.hudson-ci.org/display/HUDSON/HTML+Publisher+Plugin
The Project Description allows HTML, just edit it and place the link to your docs from the last successful build.
Get the sidelink plugin. That let's you add a link to the ones that are on the left-hand side of the project page.

Pylons: Routes information availability from templates

I'm building a Pylons application using evoque as our templating engine, though I think my question is relevant to other template engines. I have a base template that I'm using for our pages, and that base template does all the includes for CSS and Javascript files. I'd like to perform conditional test to include/exclude CSS and Javascript files based on the actual page being display. Is there a way to access the routes information from the template, in other words to get the /{controller}/{action} information? This would allow me to get only the relevant CSS and Javascript files for that page based on the controller/action combination.
Thanks in advance,
Doug
You can pull the controller and action information from environ['pylons.routes_dict']['controller'] and ['action'].
I'm not sure if environ is passed into the tmpl_context by default, but if not, you can just add something like this to the BaseController.__before__ method:
c.routes_dict = environ['pylons.routes_dict']
Then reference c.routes_dict['controller'] in your template.

Categories

Resources