These are chat archives for django/django

21st
Dec 2017
:]
@elcolie
Dec 21 2017 03:25
Hello
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
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/postmaster.pid": 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]

Options:
  -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

admin@ip-10-0-0-183:~$
Evidence
Oh. My bad. It started already /etc/init.d/postgresql status
Anish Shrestha
@annshress
Dec 21 2017 04:39
@LukeVideo
fields['your_field'].attrs ="your-class1 class2"
in the form initialization
muthuveltenmiles
@muthuveltenmiles
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
@HTests20_twitter
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 ?
Luke-VideoLibre
@LukeVideo
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
@annshress
Dec 21 2017 08:26
<form>
  <div id="label-styling">
      {{form}}
  </div>
</form>
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?
Luke-VideoLibre
@LukeVideo
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.

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

And i looked in the forms.py 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
@annshress
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
Luke-VideoLibre
@LukeVideo
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 %}
    </div>
{% endfor %}

that should help ! XD

Luke-VideoLibre
@LukeVideo
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:
mohammadreza
@devmrh
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???
Roel
@roelzkie15
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
@annshress
Dec 21 2017 14:31
@LukeVideo Thats a new tool I am hearing of. Good luck.
I cant see its purpose through its docs?
Luke-VideoLibre
@LukeVideo
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
@annshress
Dec 21 2017 14:34
Hmm
sounds my kind of thing
I also have my custom admin panels
Maybe this can help
will check
Luke-VideoLibre
@LukeVideo
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
@danielarnason
Dec 21 2017 15:24
I cannot figure out how to serve my static files from a docker container using nginx! Can anyone help?
Luke-VideoLibre
@LukeVideo
Dec 21 2017 17:00
Do you use the staticfiles app ?