These are chat archives for django/django

Dec 2017
Dec 21 2017 03:25
I am now implementiang Posgres10 on Debian Stretch 9.3
Installation is success, but I can not start postgres by neither root nor admin
Success. You can now start the database server using:

    /usr/lib/postgresql/10/bin/pg_ctl -D /var/lib/postgresql/10/main -l logfile start

Ver Cluster Port Status Owner    Data directory              Log file
10  main    5432 down   postgres /var/lib/postgresql/10/main /var/log/postgresql/postgresql-10-main.log
update-alternatives: using /usr/share/postgresql/10/man/man1/postmaster.1.gz to provide /usr/share/man/man1/postmaster.1.gz (postmaster.1.gz) in auto mode
Processing triggers for systemd (232-25+deb9u1) ...
Installation success
root@ip-10-0-0-183:/etc/apt# /usr/lib/postgresql/10/bin/pg_ctl -D /var/lib/postgresql/10/main -l logfile start
pg_ctl: cannot be run as root
Please log in (using, e.g., "su") as the (unprivileged) user that will
own the server process.
root@ip-10-0-0-183:/etc/apt# exit
admin@ip-10-0-0-183:~$ /usr/lib/postgresql/10/bin/pg_ctl -D /var/lib/postgresql/10/main -l logfile start
pg_ctl: could not open PID file "/var/lib/postgresql/10/main/": Permission denied
admin@ip-10-0-0-183:~$ su /usr/lib/postgresql/10/bin/pg_ctl -D /var/lib/postgresql/10/main -l logfile start
su: invalid option -- 'D'
Usage: su [options] [LOGIN]

  -c, --command COMMAND         pass COMMAND to the invoked shell
  -h, --help                    display this help message and exit
  -, -l, --login                make the shell a login shell
  -m, -p,
  --preserve-environment        do not reset environment variables, and
                                keep the same shell
  -s, --shell SHELL             use SHELL instead of the default in passwd

Oh. My bad. It started already /etc/init.d/postgresql status
Anish Shrestha
Dec 21 2017 04:39
fields['your_field'].attrs ="your-class1 class2"
in the form initialization
Dec 21 2017 06:01
Hi ..
What is the best audit log for python django (DB level) ..
Also need to consider nested objects also ..
Any one used audit log libraries ?
Happy Tests20
Dec 21 2017 07:05
What is the best audit log for python django (DB level) ..
Also need to consider nested objects also ..
Any one used audit log libraries ?
Dec 21 2017 08:06
@annshress The problem is that gives a class to the input tag, not the label. My problem is to add a 'left ' class to the label i could add a rule in a css file but i'm not a css guy and i would like to use as many things the framework (foundation) offers without editing a new file.
@MariosPanag store it in a variable ?
Anish Shrestha
Dec 21 2017 08:26
  <div id="label-styling">
and in your custom.css file, that is going to be included in the given template..
#label-styling label {your styles}
@LukeVideo something like that?
Dec 21 2017 08:53

That's the code for form.as_p i added the class cell to the input but the label is a different html tag.

  <label for="id_name">Name:</label> 
  <input type="text" name="name" class="cell" maxlength="66" required id="id_name" />

And i looked in the file on django guthub i didn't fing anything that would add classes to the label tag. I found the html attrs variable but it's affects the input tag.

So i guess i have to build a custom loop in the template. I wish i didn't have to because i found that adding the as_p, as_ul work fine other than that.

Anish Shrestha
Dec 21 2017 08:58
If you want all labels to have same style
add a div inside your form as I mentioned
if you only want specific fields label to have that class
you may need to add that manually AFAIK
Dec 21 2017 08:59

I've found this on the docs

{% for field in form %}
    <div class="fieldWrapper">
        {{ field.errors }}
        {{ field.label_tag }} {{ field }}
        {% if field.help_text %}
        <p class="help">{{ field.help_text|safe }}</p>
        {% endif %}
{% endfor %}

that should help ! XD

Dec 21 2017 10:56
@annshress I can't have it that way because i am using Foundation and you just add classes to your div. Here i want one just for label. I can't add custom.css. But thanks anyway :+1:
Dec 21 2017 11:56
hi how can we set cookie ?
i read docs but i found only serverside cookie (session) ...
but i want set cookie on browser???
Dec 21 2017 12:47
@ultra2mh Hi there! about the cookie storage there is a lot of options, you can create or use libraries that manage cookie in the frontend just try google around.
Anish Shrestha
Dec 21 2017 14:31
@LukeVideo Thats a new tool I am hearing of. Good luck.
I cant see its purpose through its docs?
Dec 21 2017 14:33
@annshress Yes. It's a css framework.
Loads of ready classes for nav bars, responsive grid and lot's of gooness for free!
Anish Shrestha
Dec 21 2017 14:34
sounds my kind of thing
I also have my custom admin panels
Maybe this can help
will check
Dec 21 2017 14:40
It's like bootstrap or materialize. I find it super usefull for basic stuff. It take care of the horrible defaults html in no time. But as any framework you have to follow it's rules. Good luck
Daníel Örn Árnason
Dec 21 2017 15:24
I cannot figure out how to serve my static files from a docker container using nginx! Can anyone help?
Dec 21 2017 17:00
Do you use the staticfiles app ?