iron_houzi: though based on the files this is looking for this has little to do with your actual problem which is getting Django to find your static files
bibhas
kraghot, read about backward relationships in the documentation
kraghot, these are really basic things.
iron_houzi
mlavin: OK, so you can tell from the log that the static files aren't found?
kraghot
bibhas: OK, sure will. This is my first day with django and python and any sort of database, so I'm really slow at it
CarlFK
bibhas: if my start,loc is: (1/12 8:00, A) (1/12 8:00 B) (1/12 9:00, A) I have to strip the time bit off to get the 2 A's next to each other.
mlavin
iron_houzi: yes I'm assuming that a URL which ends in .js is a static file
bibhas
kraghot, ah. no worries. keep digging the doc.
iron_houzi
mlavin: Correct, but do you have a suggestion for what could be wrong with my config?
kraghot
bibhas: sure will :)
bibhas
CarlFK, you can strip the time when printing. it's a datetimefield. it'll be sorted chronologically.
mlavin
iron_houzi: I haven't seen your config but if I had to take a wild guess you have some "project level" static files but haven't properly configured STATICFILES_DIRS
iron_houzi: or you have static files in an app but it isn't in your INSTALLED_APPS
bibhas: you aren't paying attention. this is what happens when I sort chronologically: (1/12 8:00, A) (1/12 8:00 B) (1/12 9:00, A) and that is not what I want.
jtiai joined the channel
munichlinux joined the channel
ojii joined the channel
Genitrust joined the channel
bibhas
CarlFK, ah. order_by('x', 'y') means that order by x first and then order by y among them. what is the expected output?
CarlFK
bibhas: result I am after: (1/12 8:00, A) (1/12 9:00, A) (1/12 8:00 B)
pancakes9 has quit
maryokhin has quit
bibhas: if it helps, I want order by: date, loction, time
hiaselhans has quit
bibhas: 5 day conference. for each day (like Jan 12) I want to see the talks in the first room, then the talks in the 2nd room...
the_rat joined the channel
Serraphyn joined the channel
motakjuq has quit
Serraphyn
What do you guys use to secure your contact and other email forms such? I'm trying to avoid as much spam as possible
bibhas
CarlFK, you might have to extract the date and time inside `extra` using DBMS specific function and then sort using them. Because it's a datetimefield, the data type in db is also datetime.
v0lksman joined the channel
CarlFK
can I use .annotate() to give me just the date from a datetime?
pwnz0r joined the channel
the_rat has quit
v0lksman
I have a manager that is supposed to spit back published articles, for some reason the date seems to be sticking to the date when the process (uwsgi) was started. Is this not the right way to do this?
tbaxter
Serraphyn: rule #1 of contact forms: Never expose an email address, anywhere.
tbaxter: I don't I just have the user put in their name, email, and message (for now)
tbaxter
I mean, don’t expose recipient emails.
maryokhin joined the channel
Although, if they’re logged in, sender shouldn’t necessarily need to give their email either.
Serraphyn
I don't, the forms all come to one address
trog1odyt has left the channel
tbaxter
which is done server-side, right?
Serraphyn
they are not logged in yet, this site is very simple for now, it will grow but for now
tbaxter: yes
I'm using the try, except BadHeaderError to avoid injected emails
tbaxter
OK, so sounds like you’ve met rule #1.
Kromey
serraphyn: you can use a captcha, though if your contact form only ever emails one particular address and is hardened against header injection, it's of little-to-no use to spammers
tbaxter
Now, if they don’t have to be logged into send a message, the second thing you want to do is to avoid bots. honeypots are helpful.
Serraphyn
honeypots are like fields that are not to be filled in that they will try to fill in?
tbaxter
right. if the hidden field has a value, the email should be rejected
Serraphyn
ah okay
mkoistinen has quit
Destos joined the channel
Kinda nice not using captcha, so many people have problems with them I find
nonny_t has quit
areski joined the channel
tbaxter
not a fan of captchas.
viiralvx has quit
nonny_t joined the channel
Kromey
me neither, which is why i designed a textual one that just asks for a simple arithmetic question to be solved
v0lksman
do I have to define my manager in models.py for some reason? right now I import it from managers.py
Kromey
not hard to enter "2" when it says "what's 1+1"
tbaxter
Kromey: much less intrusive.
Serraphyn
so far this project I'm doing is just static pages and forms, but by the end of today I'm gonna add on some database parts.
Would it be wise to make one mailing function and just call it from the other apps or should I do a seperate def for each one? I have like 5 forms in total and don't want to start working things in a manner that is not a good practice.
doismellburning
Serraphyn: repeating yourself as little as possible (code-wise) would be sensible
Serraphyn
guess I'll have to learn how to do helpers or w/e they are called in python
doismellburning
functions?
Serraphyn
I mean in a seperate file
doismellburning
Serraphyn: modules?
Serraphyn
like if I want to make a utils directory and then I can reference it from other apps in my project
mordonez joined the channel
temhaa joined the channel
temhaa
Hello
Serraphyn
are those modules?
temhaa
Im using ldap for authentication in my django
jwa
how can I mock a relatedmanager object? e.g. `mypoll.choices`. trying to monkeypatch the attribute directly tries to call manager.add(*value)
I created some models. I want releating model to ldap users
vbabiy has quit
vbabiy joined the channel
syphar joined the channel
for example my model is Ticket. And Ticket has a creator and assignee. Some users has creator and some user has just operations eleman(assignee). I want to do role based structure
How can I do. user role based structure using ldap
davesque joined the channel
dkb20k joined the channel
dvl` has quit
mkoistinen joined the channel
darkpixel has quit
davesque
sort of complicated question: has anyone found any creative alternatives to downloading production databases and/or media files for local dev setups? when a site or project is still small, you just download a mysql or postgres dump and import it in your local dev setup and rsync media files from the live server, but this eventually becomes impractical as the database and media files grow. what’s a more scalable option for this?
Serraphyn
doismellburning: thanks that worked out well for me I just need to know how to import it from /projectroot/utils/file.py into an app and I'll be sound as a pound
moldy
doismellburning: thanks for your input!
doismellburning: i think i will go with simple tar.gz files, at least for now
webtechfl joined the channel
mekhami
davesque i would just have a dev database that does not contain the full production database. smaller sample sizes, etc.
theslow1 joined the channel
moldy
doismellburning: though i have not decided finally yet. i don't think i want to maintain my own debian package mirror, looks like overengineering in my case.
sedeki has quit
davesque
mekhami: right. but i would hope there could be some easy way to create a small subset of the live database and media files. that can be useful, for instance, if you want to troubleshoot a bug with more or less the same application state in which it arises.
nonny_t has quit
theslow1 has quit
tbaxter
temhaa: and you’re successfully authenticating users via LDAP?
Serraphyn
google is not forth coming with how to import this module :-/
mkoistinen has quit
theslow1 joined the channel
skylite has quit
mkoistinen joined the channel
Kromey
davesque: at my last job we dealt with that routinely, and the best solution we ever came up with was bzip-compressed SQL dumps of the production database; however, note that 9 times out of 10, you don't need the full production database, just e.g. the settings and users tables, and a subset of other data to get your application to run
stickperson has quit
so really most of the time we only downloaded a table or two, and the results of a couple of SQL queries with LIMIT clauses
davesque
Kromey: right. thankfully, in my case, the database is still small enough that i can download a gzipped dump pretty quickly. the media files are a different question though. i wonder if there’s a way to create a media file manager that will defer to an S3 account if it can’t find a file locally or something like that.
Kromey: then i can have a kind of layer file system for media files…i dunno :P.
Serraphyn
so let me see if I understand this, I need to make a utils app and include that?
vishaldeep has quit
bnmalcabis joined the channel
davesque has quit
mandarbel__ has quit
limbera joined the channel
limbera
morning all, i'm trying to pass some template variables to javascript files
but i'd like to do it without globals
is there a solution that anyone can recommend?
restful
is it normal for all quotes to be escaped (\") in the output of return JsonResponse()?
tbaxter
limbera: assign them to scoped object instead of globals?
Serraphyn: sounds to me like you want a contact form app, not a utils app.
munichlinux joined the channel
Serraphyn
tbaxter: I wanted a place I could put reusable functions, which I've got working fine, now I'm off to validating field info like emails and such
limbera
makes sense! tbaxter
crazydiamond joined the channel
collinanderson
restful: it could be quoted by python or by json
VinceZa has quit
mandarbel__ joined the channel
restful
collinanderson: do you think it is a problem?
collinanderson
restful: my guess is it's operating correctly :).
restful
k thx!
collinanderson
restful: if you run into trouble, dpase.de an example
chachan joined the channel
darkpixel joined the channel
livingstn joined the channel
Serraphyn
can you guys direct me to a tut or link about how to refill in a form that has errors?
GoClick joined the channel
GoClick
I’ve got a model that often has 3-15 objects with FKs to it and I’d like to represent them in my template nicely in a grid so I need to chunk down to a new row every 4 objects. Is there a clean way to do this?